X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=tools%2Flicense-count;h=f895da95dfaf6f211e5802871402b516af4c225d;hb=6d5f4e0d2c088969b86863cdd0033c917054c207;hp=97cde792187dcf2b5aaaaae3871a1366dd4f6c15;hpb=267aa3f464a4198466da5c54de7827fd8bd5c199;p=debian%2Fdebian-policy.git diff --git a/tools/license-count b/tools/license-count index 97cde79..f895da9 100755 --- a/tools/license-count +++ b/tools/license-count @@ -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'], @@ -27,6 +29,7 @@ our @RULES = ( [qr,/usr/share/common-licenses/GPL, => 'GPL (any)'], [qr,/usr/share/common-licenses/LGPL, => 'LGPL (any)'], + [qr,(?m)^License:.*AGPL-3, => 'AGPL 3'], [qr,(?m)^License:.*Artistic(?!-), => 'Artistic'], [qr,(?m)^License:.*Artistic-2, => 'Artistic 2.0'], [qr,(?m)^License:.*CC-BY-3.0, => 'CC-BY 3.0'], @@ -38,6 +41,7 @@ our @RULES = ( [qr,(?m)^License:.*Perl, => 'Artistic'], [qr,(?m)^License:.*Perl, => 'GPL 1'], + [qr,GNU AFFERO GENERAL PUBLIC LICENSE\s+Version 3, => 'AGPL 3'], [qr,(?i)The Artistic License 2\.0, => 'Artistic 2.0'], [qr,COMMON DEVELOPMENT AND DISTRIBUTION LICENSE \(CDDL\), => 'CDDL'], [qr,CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL(?!-), => 'CeCILL'], @@ -57,19 +61,17 @@ our @RULES = ( [qr,SIL OPEN FONT LICENSE Version 1\.0, => 'SIL OFL 1.0'], ); -unless (@ARGV == 1) { - die "Usage: license-count \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 = ; close COPYRIGHT; my %seen; @@ -81,7 +83,12 @@ while (defined ($package = readdir LAB)) { } } } -closedir LAB; + +unless (@ARGV == 1) { + die "Usage: license-count \n"; +} +my $lab = $ARGV[0]; +find (\&check_package, "$lab/pool"); my $length = 0; for my $name (keys %counts) { if (length ($name) > $length) {