[licensecheck] 22/112: Use generalized license string composition at more places.

Jonas Smedegaard dr at jones.dk
Fri Nov 25 22:01:45 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 99274841cc0b7792c9e2084ac4219392a28a7a26
Author: Jonas Smedegaard <dr at jones.dk>
Date:   Thu Sep 22 13:33:11 2016 +0200

    Use generalized license string composition at more places.
---
 lib/App/Licensecheck.pm | 97 +++++++++++++++++++++----------------------------
 1 file changed, 42 insertions(+), 55 deletions(-)

diff --git a/lib/App/Licensecheck.pm b/lib/App/Licensecheck.pm
index 82e449e..a8a5c60 100755
--- a/lib/App/Licensecheck.pm
+++ b/lib/App/Licensecheck.pm
@@ -55,19 +55,28 @@ See the script for casual usage.
 
 # legacy descriptive names different from SPDX shortnames
 my %SPDX = (
-	'Artistic or GPL' => 'Perl',
-	'BSD-2-clause'    => 'BSD (2 clause)',
-	'BSD-3-clause'    => 'BSD (3 clause)',
-	'BSD-4-clause'    => 'BSD (4 clause)',
-	'CC-BY-SA'        => 'CC by-sa',
-	FTL               => 'Freetype',
-	Expat             => 'MIT/X11 (BSD like)',
-	Libpng            => 'libpng',
-	'MS-PL'           => 'Ms-PL',
-	'public-domain'   => 'Public domain',
-	'Python'          => 'PSF',
-	'SGI-B'           => 'SGI Free Software License B',
-	Zlib              => 'zlib/libpng',
+	'Adobe-Glyph'          => 'Adobe Glyph List',
+	'Adobe-2006'           => 'Adobe',
+	'APAFML'               => 'Adobe Postscript AFM',
+	'Artistic or GPL'      => 'Perl',
+	'BSD-2-clause'         => 'BSD (2 clause)',
+	'BSD-3-clause'         => 'BSD (3 clause)',
+	'BSD-4-clause'         => 'BSD (4 clause)',
+	'CC-BY-SA'             => 'CC by-sa',
+	FSFAP                  => 'FSF All Permissive',
+	FSFUL                  => 'FSF Unlimited',
+	FSFULR                 => 'FSF Unlimited (with Retention)',
+	FTL                    => 'Freetype',
+	Expat                  => 'MIT/X11 (BSD like)',
+	Libpng                 => 'libpng',
+	'MS-PL'                => 'Ms-PL',
+	'public-domain'        => 'Public domain',
+	'Python'               => 'PSF',
+	'SGI-B'                => 'SGI Free Software License B',
+	'Unicode-strict'       => 'Unicode strict',
+	'Unicode-TOU'          => 'Unicode Terms Of Use',
+	Zlib                   => 'zlib/libpng',
+	'zlib-acknowledgement' => 'zlib/libpng with Acknowledgement',
 );
 
 my $ver_prefix_re = qr/(?:version |v\.? ?)?/i;
@@ -603,12 +612,7 @@ sub parse_license
 		}
 	}
 	elsif ( $licensetext =~ /licen[sc]ebsd(?:-(\d)-clause)?/i ) {
-		if ($1) {
-			$gen_license->("BSD-$1-clause");
-		}
-		else {
-			$gen_license->('BSD');
-		}
+		$gen_license->("BSD-$1-clause");
 	}
 
 	# MPL
@@ -624,44 +628,38 @@ sub parse_license
 	# APAFML
 	given ($licensetext) {
 		when ( /AFM files it accompanies may be used|that the AFM files are not distributed/ ) {
-			$license = "Adobe Postscript AFM License $license";
-			push @spdx_license, "APAFML";
+			$gen_license->('APAFML');
 		}
 	}
 
 	# Adobe-Glyph
 	given ($licensetext) {
 		when ( /and to permit others to do the same, provided that the derived work is not represented as being a copy/ ) {
-			$license = "Adobe Glyph List License $license";
-			push @spdx_license, "Adobe-Glyph";
+			$gen_license->('Adobe-Glyph');
 		}
 	}
 
 	# Adobe-2006
 	given ($licensetext) {
 		when ( /You agree to indemnify, hold harmless and defend/ ) {
-			$license = "Adobe $license";
-			push @spdx_license, "Adobe-2006";
+			$gen_license->('Adobe-2006');
 		}
 	}
 
 	# Aladdin
 	given ($licensetext) {
 		when ( /This License is not the same as any of the GNU Licenses/ ) {
-			$license = "Aladdin Free Public License $license";
-			push @spdx_license, "Aladdin";
+			$gen_license->('Aladdin');
 		}
 		when ( /under the terms of the Aladdin Free Public License/ ) {
-			$license = "Aladdin $license";
-			push @spdx_license, "Aladdin";
+			$gen_license->('Aladdin');
 		}
 	}
 
 	# GPL or Aladdin
 	given ($licensetext) {
 		when ( /under the GNU License and Aladdin Free Public License/ ) {
-			$license = "GPL or Aladdin $license";
-			push @spdx_license, "GPL or Aladdin";
+			$gen_license->( 'GPL', 0, 0, 'Aladdin' );
 		}
 	}
 
@@ -722,19 +720,17 @@ sub parse_license
 	# FSFAP
 	given ($licensetext) {
 		when ( /Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved/i ) {
-			$license = "FSF All Permissive License $license";
-			push @spdx_license, 'FSFAP';
+			$gen_license->('FSFAP');
 		}
 	}
 
 	# FSFUL
 	given ($licensetext) {
 		when ( /This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it\./i ) {
-			$license = "FSF Unlimited License $license";
-			push @spdx_license, 'FSFUL';
+			$gen_license->('FSFUL');
 		}
 		when ( /This (\w+)(?: (?:file|script))? is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it\./i ) {
-			$license = "FSF Unlimited License ($1 derivation) $license";
+			$license = "FSF Unlimited ($1 derivation) $license";
 			push @spdx_license, "FSFUL~$1";
 		}
 	}
@@ -742,11 +738,10 @@ sub parse_license
 	# FSFULLR
 	given ($licensetext) {
 		when ( /This file is free software; the Free Software Foundation gives unlimited permission to copy and\/or distribute it, with or without modifications, as long as this notice is preserved/i ) {
-			$license = "FSF Unlimited License (with License Retention, $1 derivation) $license";
-			push @spdx_license, 'FSFULLR';
+			$gen_license->('FSFUL');
 		}
 		when ( /This (\w+)(?: (?:file|script))?  is free software; the Free Software Foundation gives unlimited permission to copy and\/or distribute it, with or without modifications, as long as this notice is preserved/i ) {
-			$license = "FSF Unlimited License (with License Retention, $1 derivation) $license";
+			$license = "FSF Unlimited (with Retention, $1 derivation) $license";
 			push @spdx_license, "FSFULLR~$1";
 		}
 	}
@@ -754,8 +749,7 @@ sub parse_license
 	# JSON
 	given ($licensetext) {
 		when ( /The Software shall be used for Good, not Evil/ ) {
-			$license = "JSON License $license";
-			push @spdx_license, "JSON";
+			$gen_license->('JSON');
 		}
 	}
 
@@ -793,8 +787,7 @@ sub parse_license
 	# CDDL
 	given ($licensetext) {
 		when ( /terms of the Common Development and Distribution License(?:,? $ver_prefix_re($ver_re))?/ ) {
-			$license = "CDDL " . ( $1 ? "(v$1) " : '' ) . $license;
-			push @spdx_license, 'CDDL' . ( $1 ? "-$1" : '' );
+			$gen_license->( 'CDDL', $1 );
 		}
 	}
 
@@ -832,8 +825,7 @@ sub parse_license
 	# PostgreSQL
 	given ($licensetext) {
 		when ( /Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies/i ) {
-			$license = "PostgreSQL $license";
-			push @spdx_license, 'PostgreSQL';
+			$gen_license->('PostgreSQL');
 		}
 	}
 
@@ -847,36 +839,31 @@ sub parse_license
 	# SIL
 	given ($licensetext) {
 		when ( /must be distributed using this license/i ) {
-			$license = "SIL (v1.0) $license";
-			push @spdx_license, 'SIL-1.0';
+			$gen_license->( 'SIL', '1.0' );
 		}
 		when ( /must be distributed entirely under this license/i ) {
-			$license = "SIL (v1.1) $license";
-			push @spdx_license, 'SIL-1.1';
+			$gen_license->( 'SIL', '1.1' );
 		}
 	}
 
 	# Unicode-strict
 	given ($licensetext) {
 		when ( /Unicode, Inc\. hereby grants the right to freely use the information supplied in this file in the creation of products supporting the Unicode Standard, and to make copies of this file in any form for internal or external distribution as long as this notice remains attached/i ) {
-			$license = "Unicode strict $license";
-			push @spdx_license, 'Unicode-strict';
+			$gen_license->('Unicode-strict');
 		}
 	}
 
 	# Unicode-TOU
 	given ($licensetext) {
 		when ( /Any person is hereby authorized, without fee, to view, use, reproduce, and distribute all documents and files solely for informational purposes in the creation of products supporting the Unicode Standard, subject to the Terms and Conditions herein/i ) {
-			$license = "Unicode Terms of Use $license";
-			push @spdx_license, 'Unicode-TOU';
+			$gen_license->('Unicode-TOU');
 		}
 	}
 
 	# Zlib/Libpng
 	given ($licensetext) {
 		when ( /acknowledgment .* in the product documentation is required/ ) {
-			$license = "zlib/libpng License with Acknowledgement $license";
-			push @spdx_license, 'zlib-acknowledgement';
+			$gen_license->('zlib-acknowledgement');
 		}
 		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/ ) {
 			$gen_license->('Zlib');

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