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

[lintian] 01/01: Factor out simple filename checks into a Lintian::Data variable.



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

lamby pushed a commit to branch master
in repository lintian.

commit 766ec728bb3f14daf811147a31003cc702ba8ed2
Author: Chris Lamb <lamby@debian.org>
Date:   Tue Dec 26 10:25:33 2017 +0000

    Factor out simple filename checks into a Lintian::Data variable.
---
 checks/files.pm   | 18 +++++-------------
 data/files/fnames |  6 ++++++
 debian/changelog  |  1 +
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/checks/files.pm b/checks/files.pm
index e05ec01..051a82f 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -31,6 +31,7 @@ use Lintian::SlidingWindow;
 
 use constant BLOCKSIZE => 16_384;
 
+my $FNAMES = Lintian::Data->new('files/fnames', qr/\s*\~\~\s*/);
 my $FONT_PACKAGES = Lintian::Data->new('files/fonts', qr/\s++/);
 my $TRIPLETS = Lintian::Data->new('files/triplets', qr/\s++/);
 my $LOCALE_CODES = Lintian::Data->new('files/locale-codes', qr/\s++/);
@@ -406,8 +407,10 @@ sub run {
             tag 'file-name-is-not-valid-UTF-8', $file;
         }
 
-        if ($fname =~ m,[*?],) {
-            tag 'file-name-contains-wildcard-character', $file;
+        # check for generic bad filenames
+        foreach my $tag ($FNAMES->all()) {
+            my $regex = $FNAMES->value($tag);
+            tag $tag, $file if $fname =~ m/$regex/;
         }
 
         if ($file->is_hardlink) {
@@ -459,12 +462,6 @@ sub run {
             push(@devhelp_links, $blessed);
         }
 
-        tag 'package-contains-python-doctree-file', $file
-          if $file->basename =~ m/\.doctree$/;
-        if ($file->basename eq 'gschemas.compiled') {
-            tag 'package-contains-compiled-glib-schema', $file;
-        }
-
         # check for generic obsolete path
         foreach my $obsolete_path ($OBSOLETE_PATHS->all) {
             my $obs_data = $OBSOLETE_PATHS->value($obsolete_path);
@@ -1180,11 +1177,6 @@ sub run {
             tag 'package-installs-python-egg', $file;
         }
 
-        # ---------------- .coverage (coverage.py output)
-        if ($file->basename eq '.coverage') {
-            tag 'package-contains-python-coverage-file', $file;
-        }
-
         # ---------------- .class (compiled Java files)
         if (   $fname =~ m,\.class$,o
             && $fname !~ m,(?:WEB-INF|demo|doc|example|sample|test),o) {
diff --git a/data/files/fnames b/data/files/fnames
new file mode 100644
index 0000000..6167504
--- /dev/null
+++ b/data/files/fnames
@@ -0,0 +1,6 @@
+# Simple checks against (entire) filenames
+# Format: tag ~~ $fname regexp
+file-name-contains-wildcard-character   ~~ [*?]
+package-contains-compiled-glib-schema   ~~ (^|/)gschemas\.compiled$
+package-contains-python-coverage-file   ~~ (^|/)\.coverage$
+package-contains-python-doctree-file    ~~ \.doctree$
diff --git a/debian/changelog b/debian/changelog
index 1123ae1..29ed896 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,7 @@ lintian (2.5.66) UNRELEASED; urgency=medium
       Thanks to Helmut Grohne for the idea.  (Closes: #885096)
     + [CL] Warn about packages that ship non-reproducible Python .doctree
       files.  (Closes: #885327)
+    + [CL] Factor out simple filename checks into a Lintian::Data variable.
   * checks/init.d.{pm,desc}:
     + [CL] Don't emit init.d-script-needs-depends-on-lsb-base if the
       package ships a Systemd service file.  (Closes: #864999)

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


Reply to: