[licensecheck] 06/112: Tidy license regexes: Add and adjust comments.

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

    Tidy license regexes: Add and adjust comments.
---
 lib/App/Licensecheck.pm | 67 +++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 62 insertions(+), 5 deletions(-)

diff --git a/lib/App/Licensecheck.pm b/lib/App/Licensecheck.pm
index d7ed902..47baea9 100755
--- a/lib/App/Licensecheck.pm
+++ b/lib/App/Licensecheck.pm
@@ -376,6 +376,8 @@ sub parse_license
 	};
 
 	#<<<  do not let perltidy touch this (keep long regex on one line)
+
+	# version of AGPL/GPL/LGPL
 	given ($licensetext) {
 		when ( /version (\d(?:\.\d+)*)(?: of the License)?,? or(?: \(at your option\))? version (\d+(?:\.\d+)*)/ ) {
 			$gplver = " (v$1 or v$2)";
@@ -402,11 +404,15 @@ sub parse_license
 			@spdx_gplver = ($1)
 		}
 	}
+
+	# address in AGPL/GPL/LGPL
 	given ($licensetext) {
 		when ( /(?:675 Mass Ave|59 Temple Place|51 Franklin Steet|02139|02111-1307)/i ) {
 			$extrainfo = " (with incorrect FSF address)$extrainfo";
 		}
 	}
+
+	# exception for AGPL/GPL/LGPL
 	given ($licensetext) {
 		when ( /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";
@@ -414,8 +420,9 @@ sub parse_license
 		}
 	}
 
-	# exclude blurb found in boost license text
+	# generated file
 	given ($licensetext) {
+		# exclude blurb found in boost license text
 		when ( /unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor/ ) {
 			break;
 		}
@@ -423,6 +430,8 @@ sub parse_license
 			$license = "GENERATED FILE";
 		}
 	}
+
+	# 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 ) {
 			$license = "LGPL$gplver$extrainfo $license";
@@ -434,12 +443,16 @@ sub parse_license
 			push @spdx_license, "LGPL-$1";
 		}
 	}
+
+	# 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 ) {
 			$license = "AGPL$gplver$extrainfo $license";
 			push @spdx_license, $gen_spdx->('AGPL');
 		}
 	}
+
+	# 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 ) {
 			$license = "GPL$gplver$extrainfo $license";
@@ -450,6 +463,8 @@ sub parse_license
 		$license = "GPL$gplver$extrainfo $license";
 		push @spdx_license, $gen_spdx->('GPL');
 	}
+
+	# LGPL/GPL unversioned
 	given ($licensetext) {
 		when ( /(?:is|may be)\s(?:(?:distributed|used).*?terms|being\s+released).*?\b(L?GPL)\b/ ) {
 			my $v = $gplver || ' (unversioned/unknown version)';
@@ -457,12 +472,16 @@ sub parse_license
 			push @spdx_license, $gen_spdx->($1);
 		}
 	}
+
+	# LLGPL
 	given ($licensetext) {
 		when ( /the rights to distribute and use this software as governed by the terms of the Lisp Lesser General Public License|\bLLGPL\b/ ) {
 			$license = "LLGPL $license";
 			push @spdx_license, 'LLGPL';
 		}
 	}
+
+	# QPL
 	given ($licensetext) {
 		when ( /This file is part of the .*Qt GUI Toolkit. This file may be distributed under the terms of the Q Public License as defined/ ) {
 			$license = "QPL (part of Qt) $license";
@@ -472,6 +491,8 @@ sub parse_license
 			push @spdx_license, 'QPL';
 		}
 	}
+
+	# MIT
 	given ($licensetext) {
 		when ( /opensource\.org\/licenses\/mit-license\.php/ ) {
 			$license = "MIT/X11 (BSD like) $license";
@@ -486,12 +507,16 @@ sub parse_license
 			push @spdx_license, 'Expat';
 		}
 	}
+
+	# ISC
 	given ($licensetext) {
 		when ( /Permission to use, copy, modify, and(\/or)? distribute this software for any purpose with or without fee is hereby granted, provided.*copyright notice.*permission notice.*all copies/ ) {
 		$license = "ISC $license";
 			push @spdx_license, 'ISC';
 		}
 	}
+
+	# BSD
 	if ( $licensetext =~ /THIS SOFTWARE IS PROVIDED .*AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY/ ) {
 		given ($licensetext) {
 			when ( /All advertising materials mentioning features or use of this software must display the following acknowledge?ment.*This product includes software developed by/i ) {
@@ -522,6 +547,8 @@ sub parse_license
 			push @spdx_license, "BSD";
 		}
 	}
+
+	# MPL
 	given ($licensetext) {
 		when ( /Mozilla Public License,? (?:(?:Version|v\.)\s+)?(\d+(?:\.\d+)?)/ ) {
 			$license = "MPL (v$1) $license";
@@ -533,10 +560,10 @@ sub parse_license
 		}
 	}
 
-# match when either:
-# - the text *begins* with "The Artistic license v2.0" which is (hopefully) the actual artistic license v2.0 text.
-# - a license grant is found. i.e something like "this is free software, licensed under the artistic license v2.0"
+	# Artistic
 	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)/ ) {
 			$license = "Artistic (v$1) $license";
 			push @spdx_license, "Artistic-$1";
@@ -548,36 +575,48 @@ sub parse_license
 			push @spdx_license, 'Artistic';
 		}
 	}
+
+	# Artistic or GPL
 	given ($licensetext) {
 		when ( /This (program )?is free software; you can redistribute it and\/or modify it under the same terms as (the )?Perl( ?5)? (programming |language |system )*itself/ ) {
 			$license = "Perl $license";
 			push @spdx_license, 'Artistic or GPL';
 		}
 	}
+
+	# Apache
 	given ($licensetext) {
 		when ( /under the Apache License, Version ([^ ]+)/ ) {
 			$license = "Apache (v$1) $license";
 			push @spdx_license, "Apache-$1";
 		}
 	}
+
+	# Beerware
 	given ($licensetext) {
 		when ( /(THE BEER-WARE LICENSE)/i ) {
 			$license = "Beerware $license";
 			push @spdx_license, 'Beerware';
 		}
 	}
+
+	# FTL
 	given ($licensetext) {
 		when ( /distributed under the terms of the FreeType project/i )	{
 			$license = "FreeType $license";
 			push @spdx_license, 'FTL';
 		}
 	}
+
+	# PHP
 	given ($licensetext) {
 		when ( /This source file is subject to version ([^ ]+) of the PHP license/ ) {
 			$license = "PHP (v$1) $license";
 			push @spdx_license, "PHP-$1";
 		}
 	}
+
+	# CECILL
 	given ($licensetext) {
 		when ( /under the terms of the CeCILL-([^ ]+) / ) {
 			$license = "CeCILL-$1 $license";
@@ -588,36 +627,48 @@ sub parse_license
 			push @spdx_license, 'CECILL';
 		}
 	}
+
+	# SGI-B
 	given ($licensetext) {
 		when ( /under the SGI Free Software License B/ ) {
 			$license = "SGI Free Software License B $license";
 			push @spdx_license, 'SGI-B';
 		}
 	}
+
+	# public-domain
 	given ($licensetext) {
 		when ( /is in the public domain/i ) {
 			$license = "Public domain $license";
 			push @spdx_license, 'public-domain';    # not listed by SPDX
 		}
 	}
+
+	# CDDL
 	given ($licensetext) {
 		when ( /terms of the Common Development and Distribution License(, Version ([^(]+))? \(the License\)/ ) {
 			$license = "CDDL " . ( $1 ? "(v$2) " : '' ) . $license;
 			push @spdx_license, 'CDDL' . ( $1 ? "-$2" : '' );
 		}
 	}
+
+	# MS-PL
 	given ($licensetext) {
 		when ( /Microsoft Permissive License \(Ms-PL\)/ ) {
 			$license = "Ms-PL $license";
 			push @spdx_license, 'MS-PL';
 		}
 	}
+
+	# AFL
 	given ($licensetext) {
 		when ( /Licensed under the Academic Free License version ([\d.]+)/ ) {
 			$license = $1 ? "AFL-$1" : "AFL";
 			push @spdx_license, 'AFL' . ( $1 ? "-$1" : '' );
 		}
 	}
+
+	# EPL
 	given ($licensetext) {
 		when ( /This program and the accompanying materials are made available under the terms of the Eclipse Public License v?([\d.]+)/ ) {
 			$license = $1 ? "EPL-$1" : "EPL";
@@ -625,7 +676,7 @@ sub parse_license
 		}
 	}
 
-	# quotes were removed by clean_comments function
+	# BSL
 	given ($licensetext) {
 		when ( /Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license \(the Software\)/ ) {
 			$license = "BSL " . ( $1 ? "(v$2) " : '' ) . $license;
@@ -636,12 +687,16 @@ sub parse_license
 			push @spdx_license, 'BSL' . ( $1 ? "-$2" : '' );
 		}
 	}
+
+	# Python
 	given ($licensetext) {
 		when ( /PYTHON SOFTWARE FOUNDATION LICENSE (VERSION ([^ ]+))/i ) {
 			$license = "PSF " . ( $1 ? "(v$2) " : '' ) . $license;
 			push @spdx_license, 'Python' . ( $1 ? "-$2" : '' );
 		}
 	}
+
+	# Zlib/Libpng
 	given ($licensetext) {
 		when ( /The origin of this software must not be misrepresented.*Altered source versions must be plainly marked as such.*This notice may not be removed or altered from any source distribution/ ) {
 			$license = "zlib/libpng $license";
@@ -656,6 +711,8 @@ sub parse_license
 			push @spdx_license, 'Libpng';
 		}
 	}
+
+	# WTFPL
 	given ($licensetext) {
 		when ( /Do What The Fuck You Want To Public License, Version ([^, ]+)/i ) {
 			$license = "WTFPL (v$1) $license";

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