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

[SCM] Debian package checker branch, master, updated. 2.3.3-56-g5ddc15f



The following commit has been merged in the master branch:
commit 85dc1b09379a1a0670c07c98b14403c41c473844
Author: Russ Allbery <rra@debian.org>
Date:   Sat Mar 20 21:58:22 2010 -0700

    Coding style and test update for empty-binary-package
    
    Rework the implementation of empty-binary-package a bit, add a test
    case, and add a changelog entry.  Add "transitional package" as a
    special phrase.

diff --git a/checks/files b/checks/files
index 106a243..bcbbf28 100644
--- a/checks/files
+++ b/checks/files
@@ -20,10 +20,12 @@
 
 package Lintian::files;
 use strict;
-use Util;
+
 use File::Basename;
+
 use Lintian::Data;
 use Lintian::Tags qw(tag);
+use Util;
 
 our $FONT_PACKAGES;
 our $TRIPLETS;
@@ -118,29 +120,17 @@ our @flash_nonfree = (
 #    qr,(?i)xspf_jukebox\.swf$,
 );
 
-# List of entries to identify metapackages
-our @metapkg_match = (
-    "metapackage",
-    "meta package",
-    "meta-package",
-    "dummy",
-    "dependency package",
-    "empty package",
-    "virtual package"
-);
+# Regexes to try against the package description to find metapackages or
+# transitional packages.
+our @METAPKG_REGEX =
+    (qr/meta[ -]?package/, qr/dummy/,
+     qr/(?:dependency|empty|transitional|virtual) package/);
 
-# List of common files stored in /usr/share/doc/$pkg
-our @doc_files = (
-    "AUTHORS.gz",
-    "NEWS.gz",
-    "README.gz",
-    "COPYING.gz",
-    "HACKING.gz",
-    "TODO.gz",
-    "copyright.gz",
-    "changelog.gz",
-    "changelog.Debian.gz"
-);
+# Common files stored in /usr/share/doc/$pkg that aren't sufficient to
+# consider the package non-empty.
+our %STANDARD_FILE = map { $_ => 1 }
+    qw(AUTHORS AUTHORS.gz COPYING.gz HACKING HACKING.gz NEWS NEWS.gz README
+       README.gz TODO TODO.gz copyright changelog.gz changelog.Debian.gz);
 
 sub run {
 
@@ -194,40 +184,41 @@ my @devhelp_links;
 my %x11_font_dirs;
 
 # Check if package is empty
-my $valid_empty = 0;
-foreach (@metapkg_match) {
-    if ($info->field('description') =~ m,($_),) {
-        $valid_empty = 1;
-        last;
+my $is_empty = 1;
+my $description = $info->field('description');
+if ($description) {
+    for my $regex (@METAPKG_REGEX) {
+	if ($description =~ /$regex/) {
+	    $is_empty = 0;
+	    last;
+	}
     }
 }
-if ($valid_empty == 0) {
-    foreach my $file (sort keys %{$info->index}) {
+if ($is_empty) {
+    for my $file (sort keys %{$info->index}) {
         # Ignore directories
         unless ($file =~ m,/$,) {
             # Skip if $file is an empty string
             next if not $file;
             # Skip if $file is outside /usr/share/doc/$pkg directory
-            if ($file !~ m,usr/share/doc/($pkg),) {
-                $valid_empty = 0;
-                last;
-            }
+            if ($file !~ m,usr/share/doc/\Q$pkg\E,) {
+		$is_empty = 0;
+		last;
+	    }
             # Skip if /usr/share/doc/$pkg has files in a subdirectory
-            if ($file =~ m,usr/share/doc/($pkg)/.*/,) {
-                $valid_empty = 0;
-                last;
-            }
-            # Check if files is one of those usually stored in /usr/share/doc/$pkg
-            my $bfile = basename($file);
-            unless (grep (/($bfile)/i, @doc_files)) {
-                $valid_empty = 0;
-                last;
-            }
-            # If everything fails, mark package as candidate to be empty
-            $valid_empty = 1;
+            if ($file =~ m,usr/share/doc/\Q$pkg\E/.*/,) {
+		$is_empty = 0;
+		last;
+	    }
+            # For files directly in /usr/share/doc/$pkg, if the file isn't one
+            # of the uninteresting ones, the package isn't empty.
+	    unless ($STANDARD_FILE{basename($file)}) {
+		$is_empty = 0;
+		last;
+	    }
         }
     }
-    tag 'empty-binary-package' if ($valid_empty);
+    tag 'empty-binary-package' if $is_empty;
 }
 
 # Read package contents...
diff --git a/checks/files.desc b/checks/files.desc
index ad65645..ff71bc9 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -1134,10 +1134,14 @@ Info: This package contains a directory under <tt>/lib</tt> or
  installed.
 
 Tag: empty-binary-package
-Severity: serious
+Severity: important
 Certainty: wild-guess
-Info: This binary package appears to be empty, and its description
- does not mention it is neither meta package or transitional package.
+Info: This binary package appears to be empty, and its description does
+ not say that it's a meta-package or a transitional package.  This is
+ often due to problems with updating debhelper *.install files during
+ package renames or similar problems where installation rules don't put
+ files in the correct place.
  .
- You should check if package is deliberately empty, and then state
- so in package description, or fix it to provide missing files.
+ If the package is deliberately empty, pleaes mention in the package long
+ description one of the phrases "meta-package," "dummy," "dependency
+ package," "empty package," or "virtual package."
diff --git a/debian/changelog b/debian/changelog
index cc99aa9..c604351 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ lintian (2.3.4) UNRELEASED; urgency=low
   * Summary of tag changes:
     + Added:
       - control-file-with-CRLF-EOLs
+      - empty-binary-package
       - missing-debian-source-format
       - possible-new-upstream-release-without-new-version
       - unknown-file-in-debian-source
@@ -48,6 +49,11 @@ lintian (2.3.4) UNRELEASED; urgency=low
       unsupported-source-format.  Patch from Raphaël Hertzog.
     + [RA] Stop recommending a dependency on perl-modules.  Patch from
       Niko Tyni.  (Closes: #568749)
+  * checks/files{,.desc}:
+    + [RA] New check for binary packages that are empty except for
+      standard files and don't declare themselves to be metapackages or
+      other types of dummy packages.  Based on a patch from Luca
+      Falavigna.  (Closes: #569220)
   * checks/init.d:
     + [RA] Exclude symlinks to upstart-job from init script syntax checks.
       Based on a patch by Jos Boumans.  (Closes: #569492)
diff --git a/t/tests/basic-3.0-native/debian/README b/t/tests/files-empty/debian/README
similarity index 100%
copy from t/tests/basic-3.0-native/debian/README
copy to t/tests/files-empty/debian/README
diff --git a/t/tests/generic-dh-make-2008/debian/debian/docs b/t/tests/files-empty/debian/debian/docs
similarity index 100%
copy from t/tests/generic-dh-make-2008/debian/debian/docs
copy to t/tests/files-empty/debian/debian/docs
diff --git a/t/tests/files-empty/desc b/t/tests/files-empty/desc
new file mode 100644
index 0000000..0b595fe
--- /dev/null
+++ b/t/tests/files-empty/desc
@@ -0,0 +1,4 @@
+Testname: files-empty
+Sequence: 6000
+Version: 1.0
+Description: Test of empty binary package detection
diff --git a/t/tests/files-empty/tags b/t/tests/files-empty/tags
new file mode 100644
index 0000000..598a167
--- /dev/null
+++ b/t/tests/files-empty/tags
@@ -0,0 +1 @@
+W: files-empty: empty-binary-package

-- 
Debian package checker


Reply to: