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

[lintian] 02/04: Use Lintian::Data for VCS file list



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

broucaries-guest pushed a commit to branch master
in repository lintian.

commit bd115b0383f1110a60e5e8cbc4ee645cd2a59f51
Author: Bastien ROUCARIÈS <roucaries.bastien@gmail.com>
Date:   Sun Dec 22 16:28:23 2013 +0100

    Use Lintian::Data for VCS file list
    
    Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
 checks/files.pm              | 21 +++++++++++++++------
 data/files/vcs-control-files |  7 +++++++
 debian/changelog             |  1 +
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/checks/files.pm b/checks/files.pm
index c205870..2d06d76 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -68,6 +68,20 @@ my $DUPLICATED_COMPRESSED_FILE_REGEX
 my $COMPRESSED_SYMLINK_POINTING_TO_COMPRESSED_REGEX
   = qr/\.($COMPRESS_FILE_EXTENSIONS_OR_ALL)\s*$/;
 
+# vcs control files
+my $VCS_FILES = Lintian::Data->new(
+    'files/vcs-control-files',
+    qr/\s++/,
+    sub {
+        my $regexp = $_[0];
+        $regexp =~ s/\${COMPRESS_EXT}/$COMPRESS_FILE_EXTENSIONS_OR_ALL/g;
+        return qr/(:?$regexp)/x;
+    });
+
+# an OR (|) regex of all vcs files
+my $VCS_FILES_OR_ALL = sub { qr/$_[0]/ }
+  ->(join('|',map($VCS_FILES->value($_),$VCS_FILES->all)));
+
 # A list of known packaged Javascript libraries
 # and the packages providing them
 my @jslibraries = (
@@ -1189,12 +1203,7 @@ sub run {
             }
 
             # ---------------- vcs control files
-            if (
-                $file =~ m{ \.(?:
-                         (?:cvs|git|hg)ignore|arch-inventory
-                           |hgtags|hg_archival
-                         \.txt)\Z}xsm
-              ) {
+            if ($file =~ m,$VCS_FILES_OR_ALL,) {
                 tag 'package-contains-vcs-control-file', $file;
             }
 
diff --git a/data/files/vcs-control-files b/data/files/vcs-control-files
new file mode 100644
index 0000000..f94abc8
--- /dev/null
+++ b/data/files/vcs-control-files
@@ -0,0 +1,7 @@
+# vcs control files regex
+# ${COMPRESS_EXT} will be replaced by compression extension list
+# please alpha sort
+/\.arch-inventory(?:\.${COMPRESS_EXT})?\Z
+/\.hgtags(?:\.${COMPRESS_EXT})?\Z
+/\.(?:cvs|git|hg)ignore(?:\.${COMPRESS_EXT})?\Z
+/\.hg_archival\.txt(?:\.${COMPRESS_EXT})?\Z
\ No newline at end of file
diff --git a/debian/changelog b/debian/changelog
index ef54f26..e8ff25e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ lintian (2.5.21) UNRELEASED; urgency=medium
   * checks/files.{desc.pm}:
     + [BR] Add xz and zip to duplicated-compressed-file regexp.
     + [BR] Use Lintian::Data for compressed file extension.
+    + [BR] Use Lintian::Data for vcs files list.
 
   * debian/control:
     + [NT] Add relevant relations on libyaml-perl, which is

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


Reply to: