]> git.donarmstrong.com Git - debian/debian-policy.git/commitdiff
Update tools/license-count to work with the new Lintian lab layout
authorRuss Allbery <rra@debian.org>
Sat, 18 Feb 2012 20:07:41 +0000 (12:07 -0800)
committerRuss Allbery <rra@debian.org>
Sat, 18 Feb 2012 20:08:07 +0000 (12:08 -0800)
This is still a quite-ugly hack, but at least it works.

debian/changelog
tools/license-count

index 7d5649708f1f009750b93c656200ad22935e5b8d..0da63e17f01f88c78038ec92b988c747cc581a4a 100644 (file)
@@ -75,6 +75,7 @@ debian-policy (3.9.3.0) UNRELEASED; urgency=low
     when eventually published somewhere, other Debian web sites can link
     to specific entries.  Patch from Charles Plessy.
   * Add AGPL-3 to tools/license-count.
+  * Update tools/license-count to work with the new Lintian lab layout.
   * Add build-arch and build-indep targets to debian/rules.
 
   [ Bill Allombert ]
index 4be092b71e3b3c1a8ac66cd14e0f0e1c28b21692..f895da95dfaf6f211e5802871402b516af4c225d 100755 (executable)
@@ -7,6 +7,8 @@
 #
 # It expects one argument, which should be the root of the Lintian laboratory.
 
+use File::Find qw(find);
+
 our @RULES = (
     [qr,/usr/share/common-licenses/Apache-2.0,     => 'Apache 2.0'],
     [qr,/usr/share/common-licenses/Artistic,       => 'Artistic'],
@@ -59,19 +61,17 @@ our @RULES = (
     [qr,SIL OPEN FONT LICENSE Version 1\.0,        => 'SIL OFL 1.0'],
 );
 
-unless (@ARGV == 1) {
-    die "Usage: license-count <path-to-lintian-lab>\n";
-}
-my $lab = $ARGV[0];
-opendir (LAB, "$lab/binary") or die "$0: cannot open $lab/binary: $!\n";
 my ($package, %counts);
 my $n = 0;
-while (defined ($package = readdir LAB)) {
-    next if ($package =~ /^\./);
+
+sub check_package {
+    return unless (-d $_ && /_binary$/);
+    $File::Find::prune = 1;
+    return if (-d $_ && /_(source|udeb)$/);
     $n++;
     print "Checked $n packages\n" if (($n % 100) == 0);
     local $/;
-    open (COPYRIGHT, '<', "$lab/binary/$package/copyright") or next;
+    open (COPYRIGHT, '<', "$_/copyright") or return;
     my $copyright = <COPYRIGHT>;
     close COPYRIGHT;
     my %seen;
@@ -83,7 +83,12 @@ while (defined ($package = readdir LAB)) {
         }
     }
 }
-closedir LAB;
+
+unless (@ARGV == 1) {
+    die "Usage: license-count <path-to-lintian-lab>\n";
+}
+my $lab = $ARGV[0];
+find (\&check_package, "$lab/pool");
 my $length = 0;
 for my $name (keys %counts) {
     if (length ($name) > $length) {