summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornbarth@chromium.org <nbarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-25 00:39:47 +0000
committernbarth@chromium.org <nbarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-25 00:39:47 +0000
commite2ee6039bcc2a55717e688fff42eeb93e973093d (patch)
tree967801d773f680ea695d720f60dd56131babafe5
parent9d72a177ce7713c277f095966b05f2627560213d (diff)
downloadchromium_src-e2ee6039bcc2a55717e688fff42eeb93e973093d.zip
chromium_src-e2ee6039bcc2a55717e688fff42eeb93e973093d.tar.gz
chromium_src-e2ee6039bcc2a55717e688fff42eeb93e973093d.tar.bz2
Fix comma and LGPL bugs in licensecheck.pl
This fixes some comma bugs: * removes trailing comma in version number, * converts comma as decimal point to period. ...and fixes a bug where LGPL is also detected as GPL (unversioned), which simplifies the license list. The following files have LGPL, hence got mis-detected as LGPL + GPL (unversioned), which is fixed by this CL. third_party/WebKit/Source/wtf/DateMath.cpp third_party/WebKit/Source/core/platform/text/UnicodeRange.h third_party/WebKit/Source/core/platform/text/UnicodeRange.cpp third_party/WebKit/Source/core/platform/Arena.cpp third_party/WebKit/Source/core/platform/Arena.h third_party/WebKit/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp third_party/WebKit/Source/core/platform/image-decoders/jpeg/JPEGImageDecoder.cpp third_party/WebKit/Source/core/rendering/ScrollBehavior.h third_party/WebKit/Source/core/rendering/RenderArena.cpp third_party/WebKit/Source/core/rendering/RenderMarquee.h third_party/WebKit/Source/core/rendering/ScrollBehavior.cpp third_party/WebKit/Source/core/rendering/RenderLayer.cpp third_party/WebKit/Source/core/rendering/RenderLayer.h third_party/WebKit/Source/core/rendering/RenderMarquee.cpp third_party/WebKit/Source/core/rendering/RenderArena.h third_party/WebKit/Source/core/html/HTMLDocument.cpp Review URL: https://chromiumcodereview.appspot.com/16331008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208325 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xthird_party/devscripts/licensecheck.pl45
-rwxr-xr-xtools/checklicenses/checklicenses.py26
2 files changed, 41 insertions, 30 deletions
diff --git a/third_party/devscripts/licensecheck.pl b/third_party/devscripts/licensecheck.pl
index 3166030..ee8b6f1 100755
--- a/third_party/devscripts/licensecheck.pl
+++ b/third_party/devscripts/licensecheck.pl
@@ -171,8 +171,9 @@ my $default_check_regex = '\.(c(c|pp|xx)?|h(h|pp|xx)?|f(77|90)?|p(l|m)|xs|sh|php
my $modified_conf_msg;
-my ($opt_verbose, $opt_lines, $opt_noconf, $opt_ignore_regex, $opt_check_regex)
- = ('', '', '', '', '');
+my ($opt_verbose, $opt_lines, $opt_noconf) = ('', '', '');
+my $opt_ignore_regex = $default_ignore_regex;
+my $opt_check_regex = $default_check_regex;
my $opt_recursive = 0;
my $opt_copyright = 0;
my $opt_machine = 0;
@@ -238,8 +239,6 @@ GetOptions("help|h" => \$opt_help,
or die "Usage: $progname [options] filelist\nRun $progname --help for more details\n";
$opt_lines = $def_lines if $opt_lines !~ /^[1-9][0-9]*$/;
-$opt_ignore_regex = $default_ignore_regex if ! length $opt_ignore_regex;
-$opt_check_regex = $default_check_regex if ! length $opt_check_regex;
if ($opt_noconf) {
fatal "--no-conf is only acceptable as the first command-line option!";
@@ -432,19 +431,24 @@ sub parselicense($) {
my ($licensetext) = @_;
my $gplver = "";
+ my $lgplver = "";
my $extrainfo = "";
my $license = "";
- if ($licensetext =~ /version ([^, ]+?)[.,]? (?:\(?only\)?.? )?(?:of the GNU (Affero )?(Lesser |Library )?General Public License )?(as )?published by the Free Software Foundation/i or
- $licensetext =~ /GNU (?:Affero )?(?:Lesser |Library )?General Public License (?:as )?published by the Free Software Foundation; version ([^, ]+?)[.,]? /i) {
-
- $gplver = " (v$1)";
- } elsif ($licensetext =~ /GNU (?:Affero )?(?:Lesser |Library )?General Public License, version (\d+(?:\.\d+)?)[ \.]/) {
+ if ($licensetext =~ /version ([^, ]+?)[.,]? (?:\(?only\)?.? )?(?:of the GNU (Affero )?General Public License )?(as )?published by the Free Software Foundation/i or
+ $licensetext =~ /GNU (?:Affero )?General Public License (?:as )?published by the Free Software Foundation; version ([^, ]+?)[.,]? /i or
+ $licensetext =~ /GNU (?:Affero )?General Public License,? [Vv]ersion (\d+(?:\.\d+)?)[ \.]/) {
$gplver = " (v$1)";
} elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(at your option\) any later version/) {
$gplver = " (v$1 or later)";
}
+ if ($licensetext =~ /version ([^, ]+?)[.,]? (?:or later|or any later version) (?:of the GNU (?:Lesser |Library )General Public License )(as )?published by the Free Software Foundation/i or
+ $licensetext =~ /GNU (?:Lesser |Library )General Public License (?:(?:as )?published by the Free Software Foundation;)?,? (?:either )?[Vv]ersion ([^, ]+?)(?: of the license)?[.,]? (?:or later|or (?:\(at your option\) )?any later version)/i or
+ $licensetext =~ /GNU (?:Lesser |Library )General Public License(?: \(LGPL\))?,? [Vv]ersion (\d+(?:\.\d+)?)[ \.]/) {
+ $lgplver = " (v$1 or later)";
+ }
+
if ($licensetext =~ /permission (?:is (also granted|given))? to link (the code of )?this program with (any edition of )?(Qt|the Qt library)/i) {
$extrainfo = " (with Qt exception)$extrainfo"
}
@@ -453,17 +457,26 @@ sub parselicense($) {
$license = "GENERATED FILE";
}
- if ($licensetext =~ /is (free software.? you can redistribute it and\/or modify it|licensed) under the terms of (version [^ ]+ of )?the (GNU (Library |Lesser )General Public License|LGPL)/i) {
- $license = "LGPL$gplver$extrainfo $license";
+ if ($licensetext =~ /is (free software.? you can redistribute it and\/or modify it|licensed) under the terms of (version [^ ]+ of )?the (GNU (Library |Lesser )General Public License|LGPL)/i or
+ $licensetext =~ /(is distributed|may be used).*terms.*LGPL/) {
+ if ($lgplver) {
+ $license = "LGPL$lgplver$extrainfo $license";
+ } else {
+ $license = "LGPL (unversioned/unknown version) $license";
+ }
}
if ($licensetext =~ /is free software.? you (can|may) redistribute it and\/or modify it under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU General Public License/i) {
$license = "GPL$gplver$extrainfo $license";
} elsif ($licensetext =~ /is distributed under the terms of the GNU General Public License,/
- and length $gplver) {
+ and $gplver) {
$license = "GPL$gplver$extrainfo $license";
- } elsif ($licensetext =~ /is distributed.*terms.*GPL/) {
- $license = "GPL (unversioned/unknown version) $license";
+ } elsif ($licensetext =~ /is distributed.*terms.*[^L]GPL/) {
+ if ($gplver) {
+ $license = "GPL$gplver$extrainfo $license";
+ } else {
+ $license = "GPL (unversioned/unknown version) $license";
+ }
}
if ($licensetext =~ /This file is part of the .*Qt GUI Toolkit. This file may be distributed under the terms of the Q Public License as defined/) {
@@ -512,7 +525,7 @@ sub parselicense($) {
$license = "BSD-like $license";
}
- if ($licensetext =~ /Mozilla Public License( Version|, v.) ([^ ]+[^. ])/) {
+ if ($licensetext =~ /Mozilla Public License( Version|, v.) ([^ ]+[^., ]),?/) {
$license = "MPL (v$2) $license";
}
@@ -609,7 +622,7 @@ sub parselicense($) {
$license = $license . "Khronos Group";
}
- $license = "UNKNOWN" if (!length($license));
+ $license = "UNKNOWN" unless $license;
# Remove trailing spaces.
$license =~ s/\s+$//;
diff --git a/tools/checklicenses/checklicenses.py b/tools/checklicenses/checklicenses.py
index 9de6712..98bb71b 100755
--- a/tools/checklicenses/checklicenses.py
+++ b/tools/checklicenses/checklicenses.py
@@ -52,35 +52,33 @@ WHITELISTED_LICENSES = [
'BSD-like MIT/X11 (BSD like)',
'BSL (v1.0)',
+ 'GPL (v2) LGPL (v2.1 or later)',
'GPL (v2 or later) with Bison parser exception',
'GPL (v2 or later) with libtool exception',
'GPL (v3 or later) with Bison parser exception',
'GPL with Bison parser exception',
'ISC',
- 'LGPL',
+ 'LGPL (unversioned/unknown version)',
'LGPL (v2)',
'LGPL (v2 or later)',
'LGPL (v2.1)',
- 'LGPL (v3 or later)',
-
- # TODO(phajdan.jr): Make licensecheck convert that comma to a dot.
- 'LGPL (v2,1 or later)',
-
'LGPL (v2.1 or later)',
+ 'LGPL (v3 or later)',
+ 'MIT/X11 (BSD like)',
'MPL (v1.0) LGPL (v2 or later)',
'MPL (v1.1)',
+ 'MPL (v1.1) BSD (3 clause) GPL (v2) LGPL (v2.1 or later)',
+ 'MPL (v1.1) BSD (3 clause) LGPL (v2.1 or later)',
'MPL (v1.1) BSD-like',
'MPL (v1.1) BSD-like GPL (unversioned/unknown version)',
- 'MPL (v1.1,) BSD (3 clause) GPL (unversioned/unknown version) '
- 'LGPL (v2.1 or later)',
+ 'MPL (v1.1) BSD-like GPL (v2) LGPL (v2.1 or later)',
+ 'MPL (v1.1) GPL (v2)',
+ 'MPL (v1.1) GPL (v2) LGPL (v2 or later)',
+ 'MPL (v1.1) GPL (v2) LGPL (v2.1 or later)',
'MPL (v1.1) GPL (unversioned/unknown version)',
+ 'MPL (v1.1) LGPL (v2 or later)',
+ 'MPL (v1.1) LGPL (v2.1 or later)',
'MPL (v2.0)',
-
- # TODO(phajdan.jr): Make licensecheck not print the comma after 1.1.
- 'MPL (v1.1,) GPL (unversioned/unknown version) LGPL (v2 or later)',
- 'MPL (v1.1,) GPL (unversioned/unknown version) LGPL (v2.1 or later)',
-
- 'MIT/X11 (BSD like)',
'Ms-PL',
'Public domain',
'Public domain BSD',