X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=tools%2Flicense-count;h=a45d9003cb1dd0b5df4e7e4f208c5d52e48df865;hb=a34ae3cf97b43e0d200ff4e25b10fd6fad9494ad;hp=b8f14f27ee54c5535c250237048d7ab4cac05a60;hpb=130528714828dd7ed6f170983c666570041a6392;p=debian%2Fdebian-policy.git diff --git a/tools/license-count b/tools/license-count index b8f14f2..a45d900 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,18 +29,29 @@ 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-1.0, => 'CC-BY 1.0'], + [qr,(?m)^License:.*CC-BY-SA-1.0, => 'CC-BY-SA 1.0'], + [qr,(?m)^License:.*CC-BY-2.0, => 'CC-BY 2.0'], + [qr,(?m)^License:.*CC-BY-SA-2.0, => 'CC-BY-SA 2.0'], + [qr,(?m)^License:.*CC-BY-2.5, => 'CC-BY 2.5'], + [qr,(?m)^License:.*CC-BY-SA-2.5, => 'CC-BY-SA 2.5'], [qr,(?m)^License:.*CC-BY-3.0, => 'CC-BY 3.0'], [qr,(?m)^License:.*CC-BY-SA-3.0, => 'CC-BY-SA 3.0'], + [qr,(?m)^License:.*CC-BY-4.0, => 'CC-BY 4.0'], + [qr,(?m)^License:.*CC-BY-SA-4.0, => 'CC-BY-SA 4.0'], [qr,(?m)^License:.*CDDL, => 'CDDL'], [qr,(?m)^License:.*GPL-1, => 'GPL 1'], [qr,(?m)^License:.*LPPL, => 'LaTeX PPL'], [qr,(?m)^License:.*MPL-1\.1, => 'MPL 1.1'], + [qr,(?m)^License:.*MPL-2\.0, => 'MPL 2.0'], [qr,(?m)^License:.*Perl, => 'Artistic'], [qr,(?m)^License:.*Perl, => 'GPL 1'], - [qr,The Artistic License 2\.0, => 'Artistic 2.0'], + [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'], [qr,CeCILL FREE SOFTWARE LICENSE AGREEMENT, => 'CeCILL'], @@ -46,28 +59,37 @@ our @RULES = ( [qr,CeCILL-B FREE SOFTWARE LICENSE AGREEMENT, => 'CeCILL-B'], [qr,CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL-C, => 'CeCILL-C'], [qr,CeCILL-C FREE SOFTWARE LICENSE AGREEMENT, => 'CeCILL-C'], + [qr,(?i)creative\s+commons\s+attribution\s+1\.0, => 'CC-BY 1.0'], + [qr,(?i)creative\s+commons\s+attribution[-\s]+share\s*alike\s+1\.0, => 'CC-BY-SA 1.0'], + [qr,(?i)creative\s+commons\s+attribution\s+2\.0, => 'CC-BY 2.0'], + [qr,(?i)creative\s+commons\s+attribution[-\s]+share\s*alike\s+2\.0, => 'CC-BY-SA 2.0'], + [qr,(?i)creative\s+commons\s+attribution\s+2\.5, => 'CC-BY 2.5'], + [qr,(?i)creative\s+commons\s+attribution[-\s]+share\s*alike\s+2\.5, => 'CC-BY-SA 2.5'], [qr,(?i)creative\s+commons\s+attribution\s+3\.0, => 'CC-BY 3.0'], [qr,(?i)creative\s+commons\s+attribution[-\s]+share\s*alike\s+3\.0, => 'CC-BY-SA 3.0'], + [qr,(?i)creative\s+commons\s+attribution\s+4\.0, => 'CC-BY 4.0'], + [qr,(?i)creative\s+commons\s+attribution[-\s]+share\s*alike\s+4\.0, => 'CC-BY-SA 4.0'], [qr,GNU GENERAL PUBLIC LICENSE\s+Version 1, => 'GPL 1'], - [qr,LPPL Version 1.3c, => 'LaTeX PPL 1.3c'], + [qr,LPPL Version, => 'LaTeX PPL (any)'], + [qr,LPPL Version 1\.3a, => 'LaTeX PPL 1.3a'], + [qr,LPPL Version 1\.3c, => 'LaTeX PPL 1.3c'], [qr,MOZILLA PUBLIC LICENSE\s+Version 1\.1, => 'MPL 1.1'], + [qr,Mozilla Public License Version 2\.0, => 'MPL 2.0'], [qr,SIL OPEN FONT LICENSE Version 1\.1, => 'SIL OFL 1.1'], [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; @@ -79,7 +101,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) {