[licensecheck] 16/112: Detect license CC-BY-SA.
Jonas Smedegaard
dr at jones.dk
Fri Nov 25 22:01:44 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 9b7f5bfa4730f9494c4f40ee63b78db01452d1dd
Author: Jonas Smedegaard <dr at jones.dk>
Date: Mon Sep 19 14:11:49 2016 +0200
Detect license CC-BY-SA.
---
lib/App/Licensecheck.pm | 28 +++++++++++++++++++++++++++-
t/grant.t | 24 ++++++++++++++++++++++++
t/grant/CC-BY-SA_and_more/WMLA | 8 ++++++++
t/grant/CC-BY-SA_and_more/cewl.rb | 5 +++++
t/grant/CC-BY-SA_and_more/utilities.scad | 6 ++++++
t/grant/GPL_and_more/init.lua | 8 ++++++++
6 files changed, 78 insertions(+), 1 deletion(-)
diff --git a/lib/App/Licensecheck.pm b/lib/App/Licensecheck.pm
index 6828676..0e32a50 100755
--- a/lib/App/Licensecheck.pm
+++ b/lib/App/Licensecheck.pm
@@ -59,6 +59,7 @@ my %SPDX = (
'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',
@@ -416,6 +417,8 @@ sub parse_license
#<<< do not let perltidy touch this (keep long regex on one line)
+ my $cc_by_sa = qr/Creative Commons Attribution[ -]Share[ -]?Alike|CC[ -]BY[ -]SA/i;
+
# version of AGPL/GPL/LGPL
given ($licensetext) {
when ( /version ($ver_re)(?: of the License)?,? or(?: \(at your option\))? version ($ver_re)/ ) {
@@ -470,6 +473,12 @@ sub parse_license
}
}
+ given ($licensetext) {
+ when ( /under(?: the)?(?:GNU)? (AGPL|GPL|LGPL)-?($ver_re)( or later| (?:and|or)(?: \(at your option\))?(?: any)? later(?: version)?)?,? (?:and|or)(?: the| a)? $cc_by_sa(?: version)? ($ver_re)(?: License)?( (?:and|or)(?: \(at your option\))? any later|[,.] Later versions are permitted)?/i ) {
+ $gen_license->( 'CC-BY-SA', $3, $4, $1, $2 );
+ }
+ }
+
# LGPL
given ($licensetext) {
when ( /(are made available|(is free software.? )?you can redistribute (it|them) and[ \/]or modify (it|them)|is licensed) under the terms of (version \S+ of )?the (GNU (Library |Lesser )General Public License|LGPL)/i ) {
@@ -499,7 +508,7 @@ sub parse_license
break;
}
when ( /AFFERO GENERAL PUBLIC LICENSE(?:,? $ver_prefix_re($ver_re)(,? or(?: any)? (?:later|newer))?)?/i ) {
- $gen_license->( 'AGPL' $1, $2 );
+ $gen_license->( 'AGPL', $1, $2 );
}
}
@@ -524,6 +533,23 @@ sub parse_license
}
}
+ # CC
+ given ($licensetext) {
+ when ( /$cc_by_sa(?i: version)? ($ver_re) or ($ver_re)/ ) {
+ $license = "CC BY-SA (v$1 or v$2) $license";
+ push @spdx_license, "CC-BY-SA-$1 or CC-BY-SA-$1";
+ }
+ when ( /$cc_by_sa(?: $ver_prefix_re($ver_re)?)(?: License)?( (?:and|or)(?: \(at your option\))? any later(?: version)|[,.] Later versions are permitted)?(?:,? (?:and|or)(?: the)?(?:GNU)? (AGPL|GPL|LGPL)(?:-?($ver_re)( or later)?)?)?/i ) {
+ $gen_license->( 'CC-BY-SA', $1, $2, $3, $4 );
+ }
+ when ( m<https?creativecommons.org/licenses/by-sa/($ver_re)/( \(or any later version\))?> ) {
+ $gen_license->( 'CC-BY-SA', $1, $2 );
+ }
+ }
+ # CC or GPL
+ given ($licensetext) {
+ }
+
# 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/ ) {
diff --git a/t/grant.t b/t/grant.t
index 5a0c5e2..cfb8265 100644
--- a/t/grant.t
+++ b/t/grant.t
@@ -25,6 +25,13 @@ test "Parse corpus" => sub {
}
};
+# GPL
+run_me(
+ { license => 'CC-BY-SA',
+ corpus => 'GPL_and_more/init.lua'
+ }
+);
+
# AGPL
run_me( { license => 'AGPL-3+', corpus => 'AGPL/fastx.c' } );
run_me( { license => 'AGPL-3+', corpus => 'AGPL/fet.cpp' } );
@@ -50,6 +57,23 @@ run_me(
}
);
+# CC-BY-SA
+run_me(
+ { license => 'CC-BY-SA-3.0',
+ corpus => 'CC-BY-SA_and_more/WMLA'
+ }
+);
+run_me(
+ { license => 'CC-BY-SA-2.0 or GPL-3',
+ corpus => 'CC-BY-SA_and_more/cewl.rb'
+ }
+);
+run_me(
+ { license => 'CC-BY-SA-3.0 or LGPL-2',
+ corpus => 'CC-BY-SA_and_more/utilities.scad'
+ }
+);
+
# EPL
run_me(
{ license => 'AGPL-3+ and/or LGPL-2.1 and/or Apache-2.0+',
diff --git a/t/grant/CC-BY-SA_and_more/WMLA b/t/grant/CC-BY-SA_and_more/WMLA
new file mode 100644
index 0000000..6e7118a
--- /dev/null
+++ b/t/grant/CC-BY-SA_and_more/WMLA
@@ -0,0 +1,8 @@
+ Unless otherwise explicitly stated, all original WebMuseum materials created by Nicolas Pioch are licensed under the terms of either (at your option):
+
+ the Creative Commons Attribution-ShareAlike 3.0 License
+ or the GNU Free Documentation License, Version 1.2 (local copy, original location)
+ or (at your option) any later version published by the Free Software Foundation,
+ with no Front-Cover Texts, no Back-Cover Texts and the Invariants Sections being the GNU Free Documentation License.
+ or, for incorporation into computer software, the GNU General Public License, version 3
+ or (at your option) any later version published by the Free Software Foundation.
diff --git a/t/grant/CC-BY-SA_and_more/cewl.rb b/t/grant/CC-BY-SA_and_more/cewl.rb
new file mode 100644
index 0000000..f77497b
--- /dev/null
+++ b/t/grant/CC-BY-SA_and_more/cewl.rb
@@ -0,0 +1,5 @@
+#
+# Author:: Robin Wood (robin at digi.ninja)
+# Copyright:: Copyright (c) Robin Wood 2016
+# Licence:: CC-BY-SA 2.0 or GPL-3+
+#
diff --git a/t/grant/CC-BY-SA_and_more/utilities.scad b/t/grant/CC-BY-SA_and_more/utilities.scad
new file mode 100644
index 0000000..ba53028
--- /dev/null
+++ b/t/grant/CC-BY-SA_and_more/utilities.scad
@@ -0,0 +1,6 @@
+/*
+ * Utility functions.
+ *
+ * Originally by Hans Häggström, 2010.
+ * Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later
+ */
diff --git a/t/grant/GPL_and_more/init.lua b/t/grant/GPL_and_more/init.lua
new file mode 100644
index 0000000..177640e
--- /dev/null
+++ b/t/grant/GPL_and_more/init.lua
@@ -0,0 +1,8 @@
+--[[
+****
+More Ores
+by Calinou
+with the help of MarkTraceur, GloopMaster and Kotolegokot
+Licensed under GPLv3+ for code and CC BY-SA for textures, see: http://www.gnu.org/licenses/gpl-3.0.html
+****
+--]]
--
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