Bug#569220: Check for empty packages
Package: lintian
Version: 2.3.3
Severity: wishlist
Tags: patch
As announced in [1], I prepared a patch implementing a new tag called
empty-binary-package, which tries to catch empty binary packages which
are not meta-packages or transitional packages.
I also provided a patch for devref [2] asking to document transitional
or meta-package status in long description.
[1] http://lists.debian.org/debian-lint-maint/2010/02/msg00026.html
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=569219
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-trunk-486
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages lintian depends on:
ii binutils 2.20-6 The GNU assembler, linker and bina
ii diffstat 1.47-1 produces graph of changes introduc
ii dpkg-dev 1.15.5.6 Debian package development tools
ii file 5.04-1 Determines file type using "magic"
ii gettext 0.17-8 GNU Internationalization utilities
ii intltool-debian 0.35.0+20060710.1 Help i18n of RFC822 compliant conf
ii libapt-pkg-perl 0.1.24 Perl interface to libapt-pkg
ii libclass-accessor-perl 0.34-1 Perl module that automatically gen
ii libipc-run-perl 0.84-1 Perl module for running processes
ii libparse-debianchangel 1.1.1-2 parse Debian changelogs and output
ii libtimedate-perl 1.2000-1 collection of modules to manipulat
ii liburi-perl 1.52-1 module to manipulate and access UR
ii locales 2.10.2-5 Embedded GNU C Library: National L
ii man-db 2.5.6-5 on-line manual pager
ii perl [libdigest-sha-pe 5.10.1-11 Larry Wall's Practical Extraction
lintian recommends no packages.
Versions of packages lintian suggests:
pn binutils-multiarch <none> (no description available)
pn libtext-template-perl <none> (no description available)
ii man-db 2.5.6-5 on-line manual pager
-- no debconf information
diff --git a/checks/files b/checks/files
index cb1171b..106a243 100644
--- a/checks/files
+++ b/checks/files
@@ -21,6 +21,7 @@
package Lintian::files;
use strict;
use Util;
+use File::Basename;
use Lintian::Data;
use Lintian::Tags qw(tag);
@@ -117,6 +118,30 @@ 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"
+);
+
+# 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"
+);
+
sub run {
my $pkg = shift;
@@ -168,6 +193,43 @@ my @devhelp_links;
# seen files.
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;
+ }
+}
+if ($valid_empty == 0) {
+ foreach 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;
+ }
+ # 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;
+ }
+ }
+ tag 'empty-binary-package' if ($valid_empty);
+}
+
# Read package contents...
foreach my $file (sort keys %{$info->index}) {
next if $file eq "";
diff --git a/checks/files.desc b/checks/files.desc
index 634268f..ad65645 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -1132,3 +1132,12 @@ Info: This package contains a directory under <tt>/lib</tt> or
binary package's architecture. This is very likely to be a mistake
when indicating the underlying build system where the files should be
installed.
+
+Tag: empty-binary-package
+Severity: serious
+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.
+ .
+ You should check if package is deliberately empty, and then state
+ so in package description, or fix it to provide missing files.
Reply to: