[licensecheck] 44/112: Relax detection of license GPL.

Jonas Smedegaard dr at jones.dk
Fri Nov 25 22:01:48 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository licensecheck.

commit d9e34afa7d10334803614826d730be414d20dd3b
Author: Jonas Smedegaard <dr at jones.dk>
Date:   Wed Nov 23 19:42:31 2016 +0100

    Relax detection of license GPL.
---
 lib/App/Licensecheck.pm | 27 ++++++++++++++++++---------
 t/Software-License.t    |  6 +++---
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/lib/App/Licensecheck.pm b/lib/App/Licensecheck.pm
index 48390a5..3af47a6 100755
--- a/lib/App/Licensecheck.pm
+++ b/lib/App/Licensecheck.pm
@@ -549,19 +549,28 @@ sub parse_license
 
 	# GPL
 	given ($licensetext) {
-		when ( /(is free software.? )?you (can|may) redistribute (it|them) and[ \/]or modify (it|them) under the terms of (?:version \S+ (?:\(?only\)? )?of )?the GNU General Public License/i ) {
-			$license = "GPL$gplver$extrainfo $license";
-			push @spdx_license, $gen_spdx->('GPL');
+		# exclude AGPL-3 license
+		when ( /GNU Affero General Public License/ ) {
+			break;
+		}
+		# exclude Perl combo license
+		when ( /Terms of the Perl programming language system itself/ ) {
+			break;
+		}
+		if ( $gplver or $extrainfo ) {
+			when ( /under (?:the terms of )?(?:version \S+ (?:\(?only\)? )?of )?(?:the )?(?:GNU General Public License|(?: GNU)?GPL)/i ) {
+				$license = "GPL$gplver$extrainfo $license";
+				push @spdx_license, $gen_spdx->('GPL');
+			}
+		}
+		when ( /under (?:the terms of )?(?:version \S+ (?:\(?only\)? )?of )?(?:the )?(?:GNU General Public License|(?: GNU)?GPL)(?:,? $L{re}{version}{-keep}(,? $L{re}{version_later_postfix})?)?/i ) {
+			$gen_license->( 'GPL', $1, $2 );
 		}
-	}
-	if ( $licensetext =~ /is distributed under the terms of the GNU General Public License,/ and length $gplver ) {
-		$license = "GPL$gplver$extrainfo $license";
-		push @spdx_license, $gen_spdx->('GPL');
 	}
 
-	# LGPL/GPL unversioned
+	# LGPL unversioned
 	given ($licensetext) {
-		when ( /(?:is|may be) (?:(?:distributed|used).*?terms|being released).*?\b(L?GPL)\b/ ) {
+		when ( /(?:is|may be) (?:(?:distributed|used).*?terms|being released).*?\b(LGPL)\b/ ) {
 			my $v = $gplver || ' (unversioned/unknown version)';
 			$license = "$1$v $license";
 			push @spdx_license, $gen_spdx->($1);
diff --git a/t/Software-License.t b/t/Software-License.t
index c33c9c1..33573c4 100644
--- a/t/Software-License.t
+++ b/t/Software-License.t
@@ -10,9 +10,9 @@ use Test::Script;
 my %LICENSES = (
 	Apache_2_0   => 'Apache (v2.0)',
 	FreeBSD      => 'BSD (2 clause)',
-	GPL_1        => 'UNKNOWN',
-	GPL_2        => 'UNKNOWN',
-	GPL_3        => 'UNKNOWN',
+	GPL_1        => 'GPL (v1)',
+	GPL_2        => 'GPL (v2)',
+	GPL_3        => 'GPL (v3)',
 	LGPL_2       => 'LGPL (v2)',
 	LGPL_2_1     => 'LGPL (v2.1)',
 	LGPL_3_0     => 'LGPL (v3)',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/licensecheck.git



More information about the Pkg-perl-cvs-commits mailing list