[licensecheck] 07/112: Tighten regexes: Simplify space matching (string already normalized).

Jonas Smedegaard dr at jones.dk
Fri Nov 25 22:01:35 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 dfd2928ea5c596c54a6f801cd6921dd4e6f192e4
Author: Jonas Smedegaard <dr at jones.dk>
Date:   Mon Sep 19 19:33:58 2016 +0200

    Tighten regexes: Simplify space matching (string already normalized).
---
 lib/App/Licensecheck.pm | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/App/Licensecheck.pm b/lib/App/Licensecheck.pm
index 47baea9..b9a3990 100755
--- a/lib/App/Licensecheck.pm
+++ b/lib/App/Licensecheck.pm
@@ -391,7 +391,7 @@ sub parse_license
 			$gplver      = " (v$1)";
 			@spdx_gplver = ($1);
 		}
-		when ( /GNU (?:Affero )?(?:Lesser |Library )?General Public License\s*(?:[(),GPL]+)\s*version (\d+(?:\.\d+)*)[ \.]/i ) {
+		when ( /GNU (?:Affero )?(?:Lesser |Library )?General Public License ?(?:[(),GPL]+) ?version (\d+(?:\.\d+)*)[ \.]/i ) {
 			$gplver      = " (v$1)";
 			@spdx_gplver = ($1);
 		}
@@ -399,7 +399,7 @@ sub parse_license
 			$gplver      = " (v$1 or later)";
 			@spdx_gplver = ( $1 . '+' );
 		}
-		when ( /GPL\sas\spublished\sby\sthe\sFree\sSoftware\sFoundation,\sversion\s(\d+(?:\.\d+)*)/i ) {
+		when ( /GPL as published by the Free Software Foundation, version (\d+(?:\.\d+)*)/i ) {
 			$gplver      = " (v$1)";
 			@spdx_gplver = ($1)
 		}
@@ -433,7 +433,7 @@ sub parse_license
 
 	# LGPL
 	given ($licensetext) {
-		when ( /(are made available|(is free software.? )?you can redistribute (it|them) and(?:\/|\s+)or modify (it|them)|is licensed) under the terms of (version [^ ]+ of )?the (GNU (Library |Lesser )General Public License|LGPL)/i ) {
+		when ( /(are made available|(is free software.? )?you can redistribute (it|them) and[ \/]or modify (it|them)|is licensed) under the terms of (version [^ ]+ of )?the (GNU (Library |Lesser )General Public License|LGPL)/i ) {
 			$license = "LGPL$gplver$extrainfo $license";
 			push @spdx_license, $gen_spdx->('LGPL');
 		}
@@ -446,7 +446,7 @@ sub parse_license
 
 	# AGPL
 	given ($licensetext) {
-		when ( /is free software.? you can redistribute (it|them) and(?:\/|\s+)or modify (it|them) under the terms of the (GNU Affero General Public License|AGPL)/i ) {
+		when ( /is free software.? you can redistribute (it|them) and[ \/]or modify (it|them) under the terms of the (GNU Affero General Public License|AGPL)/i ) {
 			$license = "AGPL$gplver$extrainfo $license";
 			push @spdx_license, $gen_spdx->('AGPL');
 		}
@@ -454,7 +454,7 @@ sub parse_license
 
 	# GPL
 	given ($licensetext) {
-		when ( /(is free software.? )?you (can|may) redistribute (it|them) and(?:\/|\s+)or modify (it|them) under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU General Public License/i ) {
+		when ( /(is free software.? )?you (can|may) redistribute (it|them) and[ \/]or modify (it|them) under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU General Public License/i ) {
 			$license = "GPL$gplver$extrainfo $license";
 			push @spdx_license, $gen_spdx->('GPL');
 		}
@@ -466,7 +466,7 @@ sub parse_license
 
 	# LGPL/GPL unversioned
 	given ($licensetext) {
-		when ( /(?:is|may be)\s(?:(?:distributed|used).*?terms|being\s+released).*?\b(L?GPL)\b/ ) {
+		when ( /(?:is|may be) (?:(?:distributed|used).*?terms|being released).*?\b(L?GPL)\b/ ) {
 			my $v = $gplver || ' (unversioned/unknown version)';
 			$license = "$1$v $license";
 			push @spdx_license, $gen_spdx->($1);
@@ -550,7 +550,7 @@ sub parse_license
 
 	# MPL
 	given ($licensetext) {
-		when ( /Mozilla Public License,? (?:(?:Version|v\.)\s+)?(\d+(?:\.\d+)?)/ ) {
+		when ( /Mozilla Public License,? (?:(?:Version|v\.) )?(\d+(?:\.\d+)?)/ ) {
 			$license = "MPL (v$1) $license";
 			push @spdx_license, "MPL-$1";
 		}
@@ -564,7 +564,7 @@ sub parse_license
 	given ($licensetext) {
 		# either *begins* with "The Artistic license v2.0" (hopefully the actual license)
 		# or some license grant,
-		when ( /(?:^\s*|(?:This is free software, licensed|Released|be used|use and modify this (?:module|software)) under (?:the terms of )?)[Tt]he Artistic License ([v\d.]*\d)/ ) {
+		when ( /(?:^ ?|(?:This is free software, licensed|Released|be used|use and modify this (?:module|software)) under (?:the terms of )?)[Tt]he Artistic License ([v\d.]*\d)/ ) {
 			$license = "Artistic (v$1) $license";
 			push @spdx_license, "Artistic-$1";
 		}

-- 
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