[licensecheck] 104/112: Fix detect dual licensing mit_new mit_old (and speed up partsing while at it).

Jonas Smedegaard dr at jones.dk
Fri Nov 25 22:03:01 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 96aa0d56c2b156bc5146d50f999d499c416716b5
Author: Jonas Smedegaard <dr at jones.dk>
Date:   Fri Nov 25 21:34:22 2016 +0100

    Fix detect dual licensing mit_new mit_old (and speed up partsing while at it).
---
 lib/App/Licensecheck.pm | 42 +++++-------------------------------------
 t/fedora.t              |  2 +-
 2 files changed, 6 insertions(+), 38 deletions(-)

diff --git a/lib/App/Licensecheck.pm b/lib/App/Licensecheck.pm
index beac291..69fbdff 100755
--- a/lib/App/Licensecheck.pm
+++ b/lib/App/Licensecheck.pm
@@ -627,11 +627,12 @@ sub parse_license
 
 	# MIT
 	given ($licensetext) {
-		when ( /$L{re}{'mit_oldstyle'}/) {
-			$gen_license->('mit_oldstyle');
+		foreach my $id (qw<curl icu isc mit_new mit_old mit_oldstyle mit_oldstyle_disclaimer mit_oldstyle_permission>) {
+			when ( /$L{re}{$id}/) {
+				$gen_license->($id);
+				continue;
+			}
 		}
-	}
-	given ($licensetext) {
 		when ( /$L{re}{dsdp}/) {
 			$gen_license->('dsdp');
 		}
@@ -642,39 +643,6 @@ sub parse_license
 			$gen_license->('ntp');
 		}
 	}
-	given ($licensetext) {
-		when ( /$L{re}{curl}/) {
-			$gen_license->('curl');
-		}
-	}
-	given ($licensetext) {
-		when ( /$L{re}{mit_oldstyle_disclaimer}/) {
-			$gen_license->('mit_oldstyle_disclaimer');
-		}
-	}
-	given ($licensetext) {
-		when ( /$L{re}{mit_oldstyle_permission}/) {
-			$gen_license->('mit_oldstyle_permission');
-		}
-	}
-	given ($licensetext) {
-		when ( /$L{re}{mit_new}/) {
-			$gen_license->('mit_new');
-		}
-		when ( /$L{re}{'mit_old'}/ ) {
-			$gen_license->('mit_old');
-		}
-	}
-	given ($licensetext) {
-		when ( /$L{re}{isc}/) {
-			$gen_license->('isc');
-		}
-	}
-	given ($licensetext) {
-		when ( /$L{re}{icu}/) {
-			$gen_license->('icu');
-		}
-	}
 
 	# 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/ ) {
diff --git a/t/fedora.t b/t/fedora.t
index 09df727..de66410 100644
--- a/t/fedora.t
+++ b/t/fedora.t
@@ -27,7 +27,7 @@ test "Parse corpus" => sub {
 
 run_me(
 	{   license =>
-			'MIT~oldstyle and/or DSDP and/or MIT~oldstyle~disclaimer and/or Expat and/or ICU and/or Adobe-Glyph and/or BSL and/or PostgreSQL',
+			'ICU and/or Expat and/or MIT~old and/or MIT~oldstyle and/or MIT~oldstyle~disclaimer and/or DSDP and/or Adobe-Glyph and/or BSL and/or PostgreSQL',
 		corpus => 'MIT'
 	}
 );

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