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

Reply via email to