[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/03: L::Util: Add $PKGVERSION_REGEX variable



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 0bb310f4c756a631890be2a69a33c3f188924f65
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Dec 17 11:24:44 2016 +0000

    L::Util: Add $PKGVERSION_REGEX variable
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 debian/changelog    |  2 ++
 lib/Lintian/Util.pm | 18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index e4bc634..02282a4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -126,6 +126,8 @@ lintian (2.5.49) unstable; urgency=medium
   * lib/Lintian/Util.pm:
     + [NT] Add a "do_fork()" sub to ensure signal handling is
       reset for child processes.
+    + [NT] Add $PKGVERSION_REGEX variable containing a regex matching
+      valid versions.
 
   * t/tests/shared-libs-non-pic-i386/debian/Makefile:
     + [JW] Pass -fno-PIE and -fno-pie to GCC, so that the test works even
diff --git a/lib/Lintian/Util.pm b/lib/Lintian/Util.pm
index 329b403..c166e30 100644
--- a/lib/Lintian/Util.pm
+++ b/lib/Lintian/Util.pm
@@ -91,7 +91,9 @@ BEGIN {
           unix_locale_split
           pipe_tee
           untaint
-          $PKGNAME_REGEX),
+          $PKGNAME_REGEX
+          $PKGVERSION_REGEX
+          ),
         @{ $EXPORT_TAGS{constants} });
 }
 
@@ -213,6 +215,20 @@ is not anchored and does not enforce any "boundary" characters.
 
 our $PKGNAME_REGEX = qr/[a-z0-9][-+\.a-z0-9]+/o;
 
+=item $PKGVERSION_REGEX
+
+Regular expression that matches valid package versions.  The
+expression is not anchored and does not enforce any "boundary"
+characters.
+
+=cut
+
+our $PKGVERSION_REGEX = qr/
+                 (?: \d+ : )?                # Optional epoch
+                 [0-9][0-9A-Za-z.+:~]*       # Upstream version (with no hyphens)
+                 (?: - [0-9A-Za-z.+:~]+ )*   # Optional debian revision (+ upstreams versions with hyphens)
+                          /xoa;
+
 =back
 
 =head1 FUNCTIONS

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: