[SCM] Debian package checker branch, master, updated. 2.1.3-32-g3d10ca7

2008-12-30 Thread Russ Allbery
The following commit has been merged in the master branch:
commit 2dc2e0bc9f146c696c2f36aa17154d5c683be8ee
Author: Russ Allbery r...@debian.org
Date:   Tue Dec 30 10:33:03 2008 -0800

Require debhelper tokens in maintainer scripts with dh

* checks/debhelper{,.desc}:
  + [RA] If dh is used, require debhelper tokens in maintainer scripts.

diff --git a/checks/debhelper b/checks/debhelper
index 3d6a959..811a56e 100644
--- a/checks/debhelper
+++ b/checks/debhelper
@@ -101,6 +101,7 @@ while (RULES) {
 } elsif (m,^\s+dh\s+,) {
$seencommand = 1;
$needbuilddepends = 1;
+   $needtomodifyscripts = 1;
$needmiscdepends = 1;
push (@versioncheck, 'dh');
 } elsif (m,^include\s+/usr/share/cdbs/1/rules/debhelper.mk,) {
diff --git a/debian/changelog b/debian/changelog
index c7b0f3e..86b23da 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,6 +24,7 @@ lintian (2.1.4) UNRELEASED; urgency=low
 + [RA] Check for use of shell brace expansion in debhelper config
   files that list filenames, which is not supported.  Based on a patch
   from Raphael Geissert.  (Closes: #480939)
++ [RA] If dh is used, require debhelper tokens in maintainer scripts.
   * checks/menu-format{,.desc}:
 + [RA] If a *.desktop file contains a MimeType key, check that the
   postinst calls update-desktop-database.  (Closes: #488832)
diff --git a/t/tests/6000_debhelper-script-token-unneeded.desc 
b/t/tests/6000_debhelper-script-token-unneeded.desc
new file mode 100644
index 000..8e37818
--- /dev/null
+++ b/t/tests/6000_debhelper-script-token-unneeded.desc
@@ -0,0 +1,4 @@
+Testname: debhelper-script-token-unneeded
+Version: 1.0
+Description: Check unnecessary debhelper script token
+Test-Against: maintainer-script-lacks-debhelper-token
diff --git a/t/tests/6000_debhelper-script-token.desc 
b/t/tests/6000_debhelper-script-token.desc
new file mode 100644
index 000..9ea703f
--- /dev/null
+++ b/t/tests/6000_debhelper-script-token.desc
@@ -0,0 +1,4 @@
+Testname: debhelper-script-token
+Version: 1.0
+Description: Check debhelper script token with rule minimization
+Test-For: maintainer-script-lacks-debhelper-token
diff --git a/t/tests/debhelper-script-token-unneeded/debian/debian/postinst 
b/t/tests/debhelper-script-token-unneeded/debian/debian/postinst
new file mode 100644
index 000..185dc3a
--- /dev/null
+++ b/t/tests/debhelper-script-token-unneeded/debian/debian/postinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+run something
+
+# We should have a debhelper token.
+exit 0
diff --git a/t/tests/debhelper-script-token-unneeded/debian/debian/rules 
b/t/tests/debhelper-script-token-unneeded/debian/debian/rules
new file mode 100755
index 000..bbd9fb3
--- /dev/null
+++ b/t/tests/debhelper-script-token-unneeded/debian/debian/rules
@@ -0,0 +1,34 @@
+#!/usr/bin/make -f
+#
+# Use an alternate rules file that doesn't call dh to test not warning
+# about debhelper script tokens if we call no programs that care about
+# them.
+
+pkg = $(shell dh_listpackages)
+
+build:
+
+clean:
+   dh_testdir
+   dh_testroot
+   dh_clean
+
+binary: binary-indep binary-arch
+binary-arch:
+binary-indep:
+   dh_testdir
+   dh_testroot
+   dh_prep
+   dh_install
+   dh_installchangelogs
+   # dh_installdocs may modify maintainer scripts
+   install -m 644 debian/copyright debian/$(pkg)/usr/share/doc/$(pkg)
+   dh_link
+   dh_compress
+   dh_fixperms
+   dh_installdeb
+   dh_gencontrol
+   dh_md5sums
+   dh_builddeb
+
+.PHONY: binary binary-arch binary-indep build clean
diff --git a/t/tests/basic-non-native/tags 
b/t/tests/debhelper-script-token-unneeded/tags
similarity index 100%
copy from t/tests/basic-non-native/tags
copy to t/tests/debhelper-script-token-unneeded/tags
diff --git a/t/tests/debhelper-script-token/debian/debian/postinst 
b/t/tests/debhelper-script-token/debian/debian/postinst
new file mode 100644
index 000..185dc3a
--- /dev/null
+++ b/t/tests/debhelper-script-token/debian/debian/postinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+run something
+
+# We should have a debhelper token.
+exit 0
diff --git a/t/tests/debhelper-script-token/tags 
b/t/tests/debhelper-script-token/tags
new file mode 100644
index 000..25d0b74
--- /dev/null
+++ b/t/tests/debhelper-script-token/tags
@@ -0,0 +1 @@
+W: debhelper-script-token source: maintainer-script-lacks-debhelper-token 
debian/postinst
diff --git a/t/tests/menu-format-desktop-mimetype/tags 
b/t/tests/menu-format-desktop-mimetype/tags
index f49d105..1f554cd 100644
--- a/t/tests/menu-format-desktop-mimetype/tags
+++ b/t/tests/menu-format-desktop-mimetype/tags
@@ -1 +1,2 @@
+W: menu-format-desktop-mimetype source: 
maintainer-script-lacks-debhelper-token debian/postinst
 W: menu-format-desktop-mimetype: desktop-mimetype-without-update-call 
/usr/share/applications/foo.desktop
diff --git 

[SCM] Debian package checker branch, master, updated. 2.1.3-32-g3d10ca7

2008-12-30 Thread Russ Allbery
The following commit has been merged in the master branch:
commit 218e2645bd4d4f8f5ee3480a905a794eda85cb9f
Author: Russ Allbery r...@debian.org
Date:   Tue Dec 30 13:11:42 2008 -0800

Move static data out of the run functions

Static data doesn't need to be initialized each time a check is run.
Move those variables outside the run function and remove some variables
in checks/shared-libs that just hold names of files in the Lintian lab
that aren't going to change.

diff --git a/checks/control-files b/checks/control-files
index d12ce36..85d433d 100644
--- a/checks/control-files
+++ b/checks/control-files
@@ -23,40 +23,36 @@ use strict;
 use Tags;
 use Util;
 
+my %ctrl_deb =
+(clilibs   = 0644,
+ config= 0755,
+ control   = 0644,
+ conffiles = 0644,
+ md5sums   = 0644,
+ postinst  = 0755,
+ preinst   = 0755,
+ postrm= 0755,
+ prerm = 0755,
+ shlibs= 0644,
+ symbols   = 0644,
+ templates = 0644,
+ triggers  = 0644);
+
+my %ctrl_udeb =
+(config= 0755,
+ control   = 0644,
+ isinstallable = 0755,
+ menutest  = 0755,
+ postinst  = 0755,
+ shlibs= 0644,
+ symbols   = 0644,
+ templates = 0644);
+
 sub run {
 
 my $pkg = shift;
 my $type = shift;
 
-my %ctrl_deb =
-(
- 'clilibs', 0644,
- 'config', 0755,
- 'control', 0644,
- 'conffiles', 0644,
- 'md5sums', 0644,
- 'postinst', 0755,
- 'preinst', 0755,
- 'postrm', 0755,
- 'prerm', 0755,
- 'shlibs', 0644,
- 'symbols', 0644,
- 'templates', 0644,
- 'triggers', 0644,
-);
-
-my %ctrl_udeb =
-(
- 'config', 0755,
- 'control', 0644,
- 'isinstallable', 0755,
- 'menutest', 0755,
- 'postinst', 0755,
- 'shlibs', 0644,
- 'symbols', 0644,
- 'templates', 0644,
-);
-
 my %ctrl = $type eq 'udeb' ? %ctrl_udeb : %ctrl_deb;
 my %ctrl_alt = $type eq 'udeb' ? %ctrl_deb : %ctrl_udeb;
 
diff --git a/checks/debconf b/checks/debconf
index cfab7b7..6a12574 100644
--- a/checks/debconf
+++ b/checks/debconf
@@ -25,37 +25,28 @@ use Tags;
 use Dep;
 use Util;
 
-sub run {
-
-my $pkg = shift;
-my $type = shift;
-my $info = shift;
-
 # From debconf-devel(7), section 'THE TEMPLATES FILE', up to date with debconf
-# version 1.3.22.  Added indices for cdebconf (indicates sort order for
+# version 1.5.24.  Added indices for cdebconf (indicates sort order for
 # choices); debconf doesn't support it, but it ignores it, which is safe
 # behavior.
-my %template_fields;
-map { $template_fields{$_}=1 }
+my %template_fields = map { $_ = 1 }
 qw(template type choices indices default description);
 
 # From debconf-devel(7), section 'THE TEMPLATES FILE', up to date with debconf
-# version 1.3.22
-my %valid_types;
-map { $valid_types{$_}=1 } qw(
-   string
-   password
-   boolean
-   select
-   multiselect
-   note
-   text
-   title
-   error
-   );
+# version 1.5.24.
+my %valid_types = map { $_ = 1 }
+qw(string
+   password
+   boolean
+   select
+   multiselect
+   note
+   error
+   title
+   text);
 
 # From debconf-devel(7), section 'THE DEBCONF PROTOCOL' under 'INPUT', up to
-# date with debconf version 1.5.3.
+# date with debconf version 1.5.24.
 my %valid_priorities = map { $_ = 1 }
 qw(low medium high critical);
 
@@ -64,6 +55,12 @@ my %valid_priorities = map { $_ = 1 }
 my @debconfs = qw(debconf debconf-2.0 cdebconf cdebconf-udeb libdebconfclient0
   libdebconfclient0-udeb);
 
+sub run {
+
+my $pkg = shift;
+my $type = shift;
+my $info = shift;
+
 my $seenconfig='';
 my $seentemplates='';
 my $usespreinst='';
@@ -103,7 +100,7 @@ if ($type eq 'source') {
 
 if (open(PREINST, '', control/preinst)) {
 while (PREINST) {
-   s/#.*//;# Not perfect for Perl, but should be OK
+   s/\#.*//;# Not perfect for Perl, but should be OK
if (m,/usr/share/debconf/confmodule, or
m/(?:Debconf|Debian::DebConf)::Client::ConfModule/) {
$usespreinst=1;
diff --git a/checks/huge-usr-share b/checks/huge-usr-share
index 9f48baf..b318a7e 100644
--- a/checks/huge-usr-share
+++ b/checks/huge-usr-share
@@ -22,18 +22,18 @@ package Lintian::huge_usr_share;
 use strict;
 use Tags;
 
+# Threshold in kB of /usr/share to trigger this warning.  Consider that the
+# changelog alone can be quite big, and cannot be moved away.
+my $THRESHOLD_SIZE_SOFT = 1024;
+my $THRESHOLD_SIZE_HARD = 2048;
+my $THRESHOLD_PERC = 50;
+
 sub run {
 
 my $pkg = shift;
 my $type = shift;
 my $info = shift;
 
-# Threshold in kB of /usr/share to trigger this warning
-# Consider that the changelog alone can be quite big, and cannot be moved away
-my $THRESHOLD_SIZE_SOFT = 1024;
-my $THRESHOLD_SIZE_HARD = 2048;
-my $THRESHOLD_PERC = 50;
-
 my $arch;
 
 # read architecture
diff --git a/checks/shared-libs b/checks/shared-libs
index 4e2b3ae..b710a62 100644
--- 

[SCM] Debian package checker branch, master, updated. 2.1.3-32-g3d10ca7

2008-12-30 Thread Russ Allbery
The following commit has been merged in the master branch:
commit f014760b1e971622ca78b59ea0912fca66057c91
Author: Russ Allbery r...@debian.org
Date:   Tue Dec 30 13:28:25 2008 -0800

Clean up /usr/share/doc checks and avoid global $info

* checks/copyright-file{,.desc}:
  + [RA] Clean up checks of a symlinked /usr/share/doc directory and
avoid making package info global.

diff --git a/checks/copyright-file b/checks/copyright-file
index 571dcd8..9389031 100644
--- a/checks/copyright-file
+++ b/checks/copyright-file
@@ -20,6 +20,10 @@
 
 package Lintian::copyright_file;
 use strict;
+
+use lib $ENV{'LINTIAN_ROOT'}/checks/;
+use common_data;
+
 use Dep;
 use Spelling;
 use Tags;
@@ -27,23 +31,17 @@ use Util;
 
 use Encode qw(decode);
 
-# Used in depends_on()
-my $info;
-
 sub run {
 
 my $pkg = shift;
 my $type = shift;
-$info = shift;
+my $info = shift;
 
 my $ppkg = quotemeta($pkg);
 
 my $found = 0;
 my $linked = 0;
 
-use lib $ENV{'LINTIAN_ROOT'}/checks/;
-use common_data;
-
 # Read package contents...
 foreach (sort keys %{$info-index}) {
 my $index_info = $info-index-{$_};
@@ -86,27 +84,23 @@ foreach (sort keys %{$info-index}) {
last;
}
 
-   # link might point to a subdirectory of another /usr/share/doc
-   # directory
+   # The symlink may point to a subdirectory of another /usr/share/doc
+   # directory.  This is allowed if this package depends on link and both
+   # packages come from the same source package.
+   #
+   # Policy requires that packages be built from the same source if
+   # they're going to do this, which by my (rra's) reading means that we
+   # should have a strict version dependency.  However, in practice the
+   # copyright file doesn't change a lot and strict version dependencies
+   # cause other problems (such as with arch: any / arch: all package
+   # combinations and binNMUs).
+   #
+   # We therefore just require the dependency for now and don't worry
+   # about the version number.
$link =~ s,/.*,,;
-
-   # this case is allowed, if this package depends on link
-   # and both packages come from the same source package
-
-   if (not defined $info-field('version')) {
-   fail(Can't open fields/version: $!);
-   } else {
-   my $our_version = $info-field('version');
-
-   # depend on $link pkg?
-   if ((not depends_on($link, $our_version)) 
-not (exists($known_essential{$link}) 
-defined($known_essential{$link}))) {
-   # no, it does not.
-
-   tag usr-share-doc-symlink-without-dependency, $link;
-   last;
-   }
+   if (not depends_on($info, $link)) {
+   tag 'usr-share-doc-symlink-without-dependency', $link;
+   last;
}
 
# We can only check if both packages come from the same source
@@ -285,7 +279,6 @@ if ($gpl || m,/usr/share/common-licenses/GPL,) {
if (defined $info-field('pre-depends')) {
push @depends, split (/\s*,\s*/, scalar 
$info-field('pre-depends'));
}
-   close DEP;
if (grep { /^libssl[0-9.]+(\s|\z)/  !/\|/ } @depends) {
tag 'possible-gpl-code-linked-with-openssl';
}
@@ -296,22 +289,17 @@ if ($gpl || m,/usr/share/common-licenses/GPL,) {
 
 # ---
 
-# returns true, if $foo depends on $bar
+# Returns true if the package whose information is in $info depends $package
+# or if $package is essential.
 sub depends_on {
-my ($package, $version) = @_;
-
-my ($deps, $predeps) = (, );
-
-if (defined $info-field('depends')) {
-   $deps = $info-field('depends');
-}
-
-if (defined $info-field('pre-depends')) {
-   $predeps = $info-field('pre-depends');
+my ($info, $package) = @_;
+return 1 if $known_essential{$package};
+my $deps = $info-field('pre-depends') || '';
+if ($info-field('depends')) {
+   $deps .= ', ' if $deps;
+   $deps .= $info-field('depends');
 }
 return 1 if Dep::implies(Dep::parse($deps), Dep::parse($package));
-return 1 if Dep::implies(Dep::parse($predeps), Dep::parse($package));
-
 return 0;
 }
 
diff --git a/debian/changelog b/debian/changelog
index 5ed297c..a57321f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,8 @@ lintian (2.1.4) UNRELEASED; urgency=low
 + [RA] Warn (severity: wishlist) about the old dh_make packaging
   copyright, which used (C) without the word or symbol.  Based on a
   patch by Raphael Geissert.  (Closes: #497347)
++ [RA] Clean up checks of a symlinked /usr/share/doc directory and
+  avoid making package info global.
   * checks/debhelper{,.desc}:
 + [RA] Check for use of shell brace expansion in debhelper config
   files that list filenames, which is not supported.  Based on a patch
diff --git a/t/tests/6000_copyright-file-doc-symlink.desc 

[SCM] Debian package checker branch, master, updated. 2.1.3-32-g3d10ca7

2008-12-30 Thread Russ Allbery
The following commit has been merged in the master branch:
commit 81ea18d7e31d4c283788a5d37c026403af56ea5f
Author: Russ Allbery r...@debian.org
Date:   Tue Dec 30 13:32:38 2008 -0800

Clean up $info handling in checks/files

Keep $info local to run() in checks/files and pass it to dir_counts().
Also clean up handling of directory counts for games package checks to
be (hopefully) more readable.

diff --git a/checks/files b/checks/files
index e536df6..76c5b21 100644
--- a/checks/files
+++ b/checks/files
@@ -24,14 +24,11 @@ use Dep;
 use Tags;
 use Util;
 
-# used by dir_counts()
-my $info;
-
 sub run {
 
 my $pkg = shift;
 my $type = shift;
-$info = shift;
+my $info = shift;
 
 my $file;
 my $source_pkg = ;
@@ -955,17 +952,14 @@ foreach my $file (sort keys %{$info-index}) {
 }
 }
 
-#check for sect: games but nothing in /usr/games. Check for any binary to
-#save ourselves from game-data false positives:
-if ($pkg_section =~ m,games$,
-and ((dir_counts(usr/games/) || 0) == 0)
-and ((dir_counts(bin/) || 0) + (dir_counts(usr/bin/) || 0))  0) {
+# Check for section games but nothing in /usr/games.  Check for any binary to
+# save ourselves from game-data false positives:
+my $games = dir_counts($info, usr/games/);
+my $other = dir_counts($info, bin/) + dir_counts($info, usr/bin/);
+if ($pkg_section =~ m,games$, and $games == 0 and $other  0) {
 tag package-section-games-but-contains-no-game;
 }
-
-if ($pkg_section =~ m,games$,
-and ((dir_counts(usr/games/) || 0) 0)
-and ((dir_counts(bin/) || 0) + (dir_counts(usr/bin/) || 0))  0) {
+if ($pkg_section =~ m,games$, and $games  0 and $other  0) {
 tag package-section-games-but-has-usr-bin;
 }
 
@@ -983,7 +977,7 @@ foreach my $dir (sort keys %{$info-index}) {
 next if $dir eq  or $info-index-{$dir}-{type} ne 'd';
 next if ($dir =~ m{^var/} or $dir =~ m{^etc/});
 next if $pkg eq 'base-files';
-if (dir_counts($dir) == 0) {
+if (dir_counts($info, $dir) == 0) {
if ($dir ne 'usr/lib/perl5/'
and $dir ne 'usr/share/perl5/'
and $dir !~ m;^usr/share/python-support/;) {
@@ -1014,7 +1008,7 @@ for my $file (@devhelp) {
 }
 
 sub dir_counts {
-my $dir = shift;
+my ($info, $dir) = @_;
 
 if (defined $info-index-{$dir}) {
return $info-index-{$dir}-{count} || 0;

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] Debian package checker branch, master, updated. 2.1.3-32-g3d10ca7

2008-12-30 Thread Russ Allbery
The following commit has been merged in the master branch:
commit 1ff7173ee5841432b35e123225a1c1116beada31
Author: Russ Allbery r...@debian.org
Date:   Tue Dec 30 13:31:11 2008 -0800

Keep per-package data local to run() in checks/cruft

* checks/cruft:
  + [RA] Keep the hash of files for which warnings were already issued
local to each package, reducing memory consumption and false
negatives for archive-wide runs.

Also keep $pkg and $info local to the run function and pass them as needed
to other functions.

diff --git a/checks/cruft b/checks/cruft
index ede0506..5b3c127 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -72,22 +72,14 @@ my @file_checks =
  [ qr,((^|/)\.[^/]+\.swp|~)$, = 'editor-backup-file',  1 ],
 );
 
-# Records files warned about in the diff so that we don't warn about them
-# again in the source checks.
-my %warned;
-
 my $dir;
 my $atdinbd;
 
-# Used in the find function.
-my $pkg;
-my $info;
-
 sub run {
 
-$pkg = shift;
+my $pkg = shift;
 my $type = shift;
-$info = shift;
+my $info = shift;
 
 if (-e debfiles/files and not -z debfiles/files) {
 tag 'debian-files-list-in-source';
@@ -122,18 +114,23 @@ if (defined $info-field('build-depends')) {
 $atdinbd = 1 if Dep::implies(Dep::parse($bd), Dep::parse($autotools_pkgs));
 }
 
-check_diffstat(diffstat);
-find(\find_cruft, 'unpacked');
+# Create a closure so that we can pass our lexical variables into the find
+# wanted function.  We don't want to make them global because we'll then leak
+# that data across packages in a large Lintian run.
+my %warned;
+check_diffstat(diffstat, \%warned);
+my $wanted = sub { find_cruft($pkg, $info, \%warned, $atdinbd) };
+find($wanted, 'unpacked');
 
 } # /run
 
 # ---
 
-# Check the diff for problems.  Record any files we warn about in %warned so
+# Check the diff for problems.  Record any files we warn about in $warned so
 # that we don't warn again when checking the full unpacked source.  Takes the
 # name of a file containing diffstat output.
 sub check_diffstat {
-my ($diffstat) = @_;
+my ($diffstat, $warned) = @_;
 open(STAT, '', $diffstat) or fail(cannot open $diffstat: $!);
 local $_;
 while (STAT) {
@@ -150,11 +147,11 @@ sub check_diffstat {
 # diffstat output contains only files, but we consider the directory
 # checks to trigger if the diff adds any files in those directories.
 my ($directory) = ($file =~ m,^(.*)/[^/]+$,);
-if ($directory and not $warned{$directory}) {
+if ($directory and not $warned-{$directory}) {
 for my $rule (@directory_checks) {
 if ($directory =~ /$rule-[0]/) {
 tag diff-contains-$rule-[1], $directory;
-$warned{$directory} = 1;
+$warned-{$directory} = 1;
 }
 }
 }
@@ -163,7 +160,7 @@ sub check_diffstat {
 for my $rule (@file_checks) {
 if ($file =~ /$rule-[0]/) {
 tag diff-contains-$rule-[1], $file;
-$warned{$file} = 1;
+$warned-{$file} = 1;
 }
 }
 
@@ -185,11 +182,12 @@ sub check_diffstat {
 #
 # Exclude the lintian test suites from these checks.
 sub find_cruft {
+my ($pkg, $info, $warned, $atdinbd) = @_;
 (my $name = $File::Find::name) =~ s,^(\./)?unpacked/,,;
 return if $name =~ m,^t(?:estset)?/, and $pkg eq 'lintian';
 
 my $prefix = ($info-native ? diff-contains : source-contains);
-if (-d and not $warned{$name}) {
+if (-d and not $warned-{$name}) {
 for my $rule (@directory_checks) {
 if ($name =~ /$rule-[0]/) {
 tag ${prefix}-$rule-[1], $name;
@@ -198,7 +196,7 @@ sub find_cruft {
 }
 -f or return; # we just need normal files for the rest
 
-unless ($warned{$name}) {
+unless ($warned-{$name}) {
 for my $rule (@file_checks) {
 next if ($rule-[2] and not $info-native);
 if ($name =~ /$rule-[0]/) {
@@ -230,7 +228,7 @@ sub find_cruft {
 my $b = basename $name;
 open (F, '', $b) or die can't open $name: $!;
 while (F) {
-if (/^VERSION=[']?(1\.(\d)\.(\d+)(?:-(\d))?)/) {
+if (/^VERSION=[\\']?(1\.(\d)\.(\d+)(?:-(\d))?)/) {
 my ($version, $major, $minor, $debian) = ($1, $2, $3, $4);
 if ($major  5 or ($major == 5 and $minor  2)) {
 tag ancient-libtool, $name, $version;
@@ -246,6 +244,7 @@ sub find_cruft {
 close F;
 }
 }
+
 1;
 
 # Local Variables:
diff --git a/debian/changelog b/debian/changelog
index a57321f..8804fef 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -22,6 +22,10 @@ lintian (2.1.4) UNRELEASED; urgency=low
   patch by Raphael Geissert.  (Closes: #497347)
 + [RA] Clean up checks of a symlinked /usr/share/doc directory and
   avoid making package info 

[SCM] Debian package checker branch, master, updated. 2.1.3-32-g3d10ca7

2008-12-30 Thread Russ Allbery
The following commit has been merged in the master branch:
commit 3d10ca7ff8eb5bc7bb3f89e6afca5861df44f4cf
Author: Russ Allbery r...@debian.org
Date:   Tue Dec 30 13:39:37 2008 -0800

Keep per-package data local to run() in checks/menus

* checks/menus:
  + [RA] Keep the hash of files and symlinks local to each package,
reducing memory consumption and false negatives for archive-wide
runs.

diff --git a/checks/menus b/checks/menus
index 9d4cb7c..5bd69ec 100644
--- a/checks/menus
+++ b/checks/menus
@@ -31,11 +31,6 @@ use Spelling;
 use Tags;
 use Util;
 
-my $pkg;
-my $info;
-my %all_files = ();
-my %all_links = ();
-
 # Known fields for doc-base files.  The value is 1 for required fields and 0
 # for optional fields.
 my %known_docbase_main_fields = (
@@ -53,9 +48,12 @@ my %known_docbase_format_fields = (
 
 sub run {
 
-$pkg = shift;
+my $pkg = shift;
 my $type = shift;
-$info = shift;
+my $info = shift;
+
+my %all_files = ();
+my %all_links = ();
 
 my %preinst;
 my %postinst;
@@ -67,35 +65,24 @@ my $menu_file;
 my $menumethod_file;
 my $anymenu_file;
 
-# check preinst script
-if ( -f control/preinst ) {
-# parse script...
-check_script(preinst,\%preinst);
+if (-f 'control/preinst') {
+check_script($pkg, 'preinst', \%preinst);
 }
-
-# check postinst script
-if ( -f control/postinst ) {
-# parse script...
-check_script(postinst,\%postinst);
+if (-f 'control/postinst') {
+check_script($pkg, 'postinst', \%postinst);
 }
-
-# check prerm script
-if ( -f control/prerm ) {
-# parse script...
-check_script(prerm,\%prerm);
+if (-f 'control/prerm') {
+check_script($pkg, 'prerm', \%prerm);
 }
-
-# check postrm script
-if ( -f control/postrm ) {
-# parse script...
-check_script(postrm,\%postrm);
+if (-f 'control/postrm') {
+check_script($pkg, 'postrm', \%postrm);
 }
 
 # read package contents
 for my $file (sort keys %{$info-index}) {
 next if $file eq ;
 
-add_file_link_info ($file);
+add_file_link_info ($info, $file, \%all_files, \%all_links);
 my $index_info = $info-index-{$file};
 my $operm = $index_info-{operm};
 
@@ -193,7 +180,7 @@ if ($docbase_file) {# postinst has to call 
install-docs
 while (defined ($dbfile = readdir DOCBASEDIR)) {
# don't try to parse executables, plus we already warned about it
next if -x doc-base/$dbfile;
-   check_doc_base_file($dbfile, $pkg, $type);
+   check_doc_base_file($dbfile, $pkg, $type, \%all_files, \%all_links);
 }
 closedir DOCBASEDIR;
 } else {
@@ -230,7 +217,7 @@ if ($anymenu_file) {
 # ---
 
 sub check_doc_base_file {
-my ($dbfile, $pkg, $type) = @_;
+my ($dbfile, $pkg, $type, $all_files, $all_links) = @_;
 
 my $line = file_is_encoded_in_non_utf8(doc-base/$dbfile, $type, $pkg);
 if ($line) {
@@ -253,8 +240,9 @@ sub check_doc_base_file {
 if (/^(\S+)\s*:\s*(.*)$/) {
 my (@new) = ($1, $2);
 if ($field) {
-check_doc_base_field($dbfile, $line, $field, \...@vals,
- \%sawfields, \%sawformats, $knownfields);
+   check_doc_base_field($pkg, $dbfile, $line, $field, \...@vals,
+\%sawfields, \%sawformats, $knownfields,
+$all_files, $all_links);
 }
 $field = lc $new[0];
 @vals  = ($new[1]);
@@ -275,8 +263,9 @@ sub check_doc_base_file {
 next unless $field; # skip successive empty lines
 
 # Check previously defined field and section.
-check_doc_base_field($dbfile, $line, $field, \...@vals, 
\%sawfields,
- \%sawformats, $knownfields);
+   check_doc_base_field($pkg, $dbfile, $line, $field, \...@vals,
+\%sawfields, \%sawformats, $knownfields,
+$all_files, $all_links);
 check_doc_base_file_section($dbfile, $line + 1, \%sawfields,
 \%sawformats, $knownfields);
 
@@ -297,8 +286,9 @@ sub check_doc_base_file {
 
 # Check the last field/section of the control file.
 if ($field) {
-check_doc_base_field($dbfile, $line, $field, \...@vals, \%sawfields,
- \%sawformats, $knownfields);
+   check_doc_base_field($pkg, $dbfile, $line, $field, \...@vals, 
\%sawfields,
+\%sawformats, $knownfields, $all_files,
+$all_links);
 check_doc_base_file_section($dbfile, $line, \%sawfields, \%sawformats,
 $knownfields);
 }
@@ -312,8 +302,8 @@ sub check_doc_base_file {
 # Checks one field of a doc-base control file.  $vals is array ref containing
 # all lines of the field.  Modifies $sawfields and $sawformats.
 sub check_doc_base_field {
-my ($dbfile, $line, $field, $vals, 

[SCM] Debian package checker branch, master, updated. 2.1.3-32-g3d10ca7

2008-12-30 Thread Russ Allbery
The following commit has been merged in the master branch:
commit 797c9235190b82a11f611ae0e15adda465388ef2
Author: Russ Allbery r...@debian.org
Date:   Tue Dec 30 13:35:00 2008 -0800

Use Lintian::Collect data properly in checks/menu-format

* checks/menu-format{,.desc}:
  + [RA] Stop keeping a separate hash of all files in the package and
use Lintian::Collect information.  The hash was being reused across
packages, possibly leading to excessive memory consumption and false
negatives for archive-wide runs.

diff --git a/checks/menu-format b/checks/menu-format
index 5c71249..b5e2842 100644
--- a/checks/menu-format
+++ b/checks/menu-format
@@ -367,20 +367,15 @@ my %reserved_categories = map { $_ = 1 }
Shell
   );
 
-# Path in which to search for binaries referenced in menu entries.
-my @path = qw(/usr/local/bin/ /usr/bin/ /bin/ /usr/X11R6/bin/ /usr/games/);
+# Path in which to search for binaries referenced in menu entries.  These must
+# not have leading slashes.
+my @path = qw(usr/local/bin/ usr/bin/ bin/ usr/X11R6/bin/ usr/games/);
 
 my %known_tags_hash = map { $_ = 1 } @known_tags;
 my %needs_tag_vals_hash = map { $_ = 1 } @needs_tag_vals;
 my %root_sections_hash = map { $_ = 1 } @root_sections;
 my %sections_hash = map { $_ = 1 } @sections;
 
-# Holds a hash of all files in the package, used for checking for executables.
-my %file_index;
-
-# Whether the postinst script calls update-desktop-database.
-my $postinst_calls_update;
-
 # ---
 
 sub run {
@@ -389,6 +384,9 @@ my $pkg = shift;
 my $type = shift;
 my $info = shift;
 
+# Whether the postinst script calls update-desktop-database.
+my $postinst_calls_update;
+
 my @menufiles;
 opendir (MENUDIR, menu/lib) or fail(cannot read menu/lib file directory.);
 push @menufiles, map { menu/lib/$_ } readdir(MENUDIR);
@@ -397,24 +395,19 @@ opendir (MENUDIR, menu/share) or fail(cannot read 
menu/share file directory.
 push @menufiles, map { menu/share/$_ } readdir(MENUDIR);
 closedir MENUDIR;
 
-# Find the desktop files in the package for verification and also build a hash
-# of every file in the package to use to verify that the command referenced by
-# a menu item or desktop entry is there.
+# Find the desktop files in the package for verification.
 my @desktop_files;
 foreach my $file (sort keys %{$info-index}) {
 my $index_info = $info-index-{$file};
 my $operm = $index_info-{operm};
 
-$file = '/' . $file;
-$file_index{$file} = 1;
-
-tag 'deprecated-kdelnk-file', $file if ($file =~ m,\.kdelnk$,);
+tag 'deprecated-kdelnk-file', /$file if ($file =~ m,\.kdelnk$,);
 
 if ($index_info-{type} =~ m/[-h]/ 
-   $file =~ m,/usr/share/applications/.*\.desktop$,) {
+   $file =~ m,usr/share/applications/.*\.desktop$,) {
 
if ($operm  0100 or $operm  010 or $operm  01) {
-   tag executable-desktop-file, sprintf($file %04o,$operm);
+   tag executable-desktop-file, sprintf(/$file %04o,$operm);
}
 unless ($file =~ m,template,) {
 push (@desktop_files, $file);
@@ -438,7 +431,8 @@ if (@desktop_files) {
 
 # Verify all the desktop files.
 for my $desktop_file (@desktop_files) {
-VerifyDesktopFile ($desktop_file, $desktop_file, $pkg);
+VerifyDesktopFile($desktop_file, $desktop_file, $pkg, $info,
+ $postinst_calls_update);
 }
 
 # Now all the menu files.
@@ -490,11 +484,11 @@ foreach my $menufile (@menufiles) {
# Note that I allow whitespace after the continuation character.
# This is caught by VerifyLine().
if (! ($menufile_line =~ m/\\\s*?$/)) {
-   VerifyLine($pkg,$type,$menufile,$fullname,$line,$lc);
+   VerifyLine($pkg, $info, $type, $menufile, $fullname, $line, $lc);
$line=;
}
 } while ($menufile_line = IN);
-VerifyLine($pkg,$type,$menufile,$fullname,$line,$lc);
+VerifyLine($pkg, $info, $type, $menufile, $fullname, $line, $lc);
 
 close IN;
 }
@@ -506,7 +500,7 @@ foreach my $menufile (@menufiles) {
 # Pass this a line of a menu file, it sanitizes it and
 # verifies that it is correct.
 sub VerifyLine {
-my ( $pkg, $type, $menufile, $fullname, $line, $linecount ) = @_;
+my ($pkg, $info, $type, $menufile, $fullname, $line, $linecount) = @_;
 
 my %vals;
 
@@ -637,7 +631,8 @@ sub VerifyLine {
 $section =~ s:/$::;# remove trailing slash.
 
 # Be sure the command is provided by the package.
-my ($okay, $command) = VerifyCmd ($fullname, $linecount, $vals{'command'}, 
$pkg);
+my ($okay, $command) = VerifyCmd ($fullname, $linecount, $vals{'command'},
+ $pkg, $info);
 tag menu-command-not-in-package, $fullname:$linecount $command
 unless ($okay
 or not $command
@@ -759,7 +754,7 @@ parse_error:
 
 # Syntax-checks a .desktop file.
 sub VerifyDesktopFile {
-my ($desktopfile, $file, $pkg) = @_;
+my