This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository licensecheck.

commit 6bafd0e8cc81ae83887bb09b306daa86ef117575
Author: Jonas Smedegaard <d...@jones.dk>
Date:   Mon Nov 21 18:27:18 2016 +0100

    Add trait pattern license_prefix.
---
 lib/App/Licensecheck.pm             | 40 ++++++++++++++++++-------------------
 lib/Regexp/Pattern/License.pm       |  8 ++++++++
 lib/Regexp/Pattern/License/Parts.pm |  7 +++++++
 3 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/lib/App/Licensecheck.pm b/lib/App/Licensecheck.pm
index 1ce8b36..20c9709 100755
--- a/lib/App/Licensecheck.pm
+++ b/lib/App/Licensecheck.pm
@@ -75,8 +75,6 @@ my %SPDX = (
        'zlib-acknowledgement' => 'zlib/libpng with Acknowledgement',
 );
 
-my $ver_prefix_re = qr/(?:version |v\.? ?)?/i;
-
 my $default_check_regex = q!
        /[\w-]+$ # executable scripts or README like file
        |\.( # search for file suffix
@@ -470,15 +468,15 @@ sub parse_license
                        $gplver      = " (v$1)";
                        @spdx_gplver = ($1)
                }
-               when ( /GNU (?:Affero |Lesser |Library )?General Public License 
(?:as )?published by the Free Software Foundation[;,] 
$ver_prefix_re($L{re}{version_number})[.,]? /i ) {
+               when ( /GNU (?:Affero |Lesser |Library )?General Public License 
(?:as )?published by the Free Software Foundation[;,] 
$L{re}{version_prefix}?($L{re}{version_number})[.,]? /i ) {
                        $gplver      = " (v$1)";
                        @spdx_gplver = ($1);
                }
-               when ( /GNU (?:Affero |Lesser |Library )?General Public License 
?(?:[(),AGPL]+) ?$ver_prefix_re($L{re}{version_number})[ \.]/i ) {
+               when ( /GNU (?:Affero |Lesser |Library )?General Public License 
?(?:[(),AGPL]+) ?$L{re}{version_prefix}?($L{re}{version_number})[ \.]/i ) {
                        $gplver      = " (v$1)";
                        @spdx_gplver = ($1);
                }
-               when ( /either $ver_prefix_re($L{re}{version_number})(?: of the 
License)?, or (?:\(at your option\) )?any later version/ ) {
+               when ( /either 
$L{re}{version_prefix}?($L{re}{version_number})(?: of the License)?, or (?:\(at 
your option\) )?any later version/ ) {
                        $gplver      = " (v$1 or later)";
                        @spdx_gplver = ( $1 . '+' );
                }
@@ -521,7 +519,7 @@ sub parse_license
                        push @spdx_license, $gen_spdx->('LGPL');
                }
                # For Perl modules handled by Dist::Zilla
-               when ( /this is free software,? licensed under:? (?:the 
)?(?:GNU (?:Library |Lesser )General Public License|LGPL),? 
$ver_prefix_re($L{re}{version_number})/i ) {
+               when ( /this is free software,? licensed under:? (?:the 
)?(?:GNU (?:Library |Lesser )General Public License|LGPL),? 
$L{re}{version_prefix}?($L{re}{version_number})/i ) {
                        $gen_license->( 'LGPL', $1 );
                }
        }
@@ -540,7 +538,7 @@ sub parse_license
                when ( /means either [^.]+, the GNU Affero General Public 
License/i ) {
                        break;
                }
-               when ( /AFFERO GENERAL PUBLIC LICENSE(?:,? 
$ver_prefix_re($L{re}{version_number})(,? or(?: any)? (?:later|newer))?)?/i ) {
+               when ( /AFFERO GENERAL PUBLIC LICENSE(?:,? 
$L{re}{version_prefix}?($L{re}{version_number})(,? or(?: any)? 
(?:later|newer))?)?/i ) {
                        $gen_license->( 'AGPL', $1, $2 );
                }
        }
@@ -573,7 +571,7 @@ sub parse_license
                                $license = "$L{caption}{$id} (v$1 or v$2) 
$license";
                                push @spdx_license, "$L{name}{$id}-$1 or 
$L{name}{$id}-$1";
                        }
-                       when ( /$L{re}{$id}(?: 
$ver_prefix_re($L{re}{version_number})?)(?: License)?( (?:and|or)(?: \(at your 
option\))? any later(?: version)|[,.] Later versions are permitted)?(?:,? 
(?:and|or)(?: the)?(?:GNU)? (AGPL|GPL|LGPL)(?:-?($L{re}{version_number})( or 
later)?)?)?/i ) {
+                       when ( /$L{re}{$id}(?: 
$L{re}{version_prefix}?($L{re}{version_number})?)(?: License)?( (?:and|or)(?: 
\(at your option\))? any later(?: version)|[,.] Later versions are 
permitted)?(?:,? (?:and|or)(?: the)?(?:GNU)? 
(AGPL|GPL|LGPL)(?:-?($L{re}{version_number})( or later)?)?)?/i ) {
                                $gen_license->( $id, $1, $2, $3, $4 );
                        }
                }
@@ -667,10 +665,10 @@ sub parse_license
 
        # MPL
        given ($licensetext) {
-               when ( /Mozilla Public License,? 
$ver_prefix_re($L{re}{version_number})/ ) {
+               when ( /Mozilla Public License,? 
$L{re}{version_prefix}?($L{re}{version_number})/ ) {
                        $gen_license->( 'MPL', $1 );
                }
-               when ( /Mozilla Public License,? 
\($ver_prefix_re($L{re}{version_number})\)/ ) {
+               when ( /Mozilla Public License,? 
\($L{re}{version_prefix}?($L{re}{version_number})\)/ ) {
                        $gen_license->( 'MPL', $1 );
                }
        }
@@ -736,19 +734,19 @@ sub parse_license
 
        # Apache
        given ($licensetext) {
-               when ( /Apache(?: Software)? License(?:,? 
$ver_prefix_re($L{re}{version_number})( or(?: any)? (?:later|newer))?)?(?:(?: 
or)? [^ ,]*?apache[^ ,]*| \([^(),]+\))*,? or(?: the)?(?:(?: GNU)? General 
Public License(?: \(GPL\))?|GPL)(?: $ver_prefix_re($L{re}{version_number})( 
or(?: any)? (?:later|newer))?)?/i ) {
+               when ( /Apache(?: Software)? License(?:,? 
$L{re}{version_prefix}?($L{re}{version_number})( or(?: any)? 
(?:later|newer))?)?(?:(?: or)? [^ ,]*?apache[^ ,]*| \([^(),]+\))*,? or(?: 
the)?(?:(?: GNU)? General Public License(?: \(GPL\))?|GPL)(?: 
$L{re}{version_prefix}?($L{re}{version_number})( or(?: any)? 
(?:later|newer))?)?/i ) {
                        $gen_license->( 'Apache', $1, $2, 'GPL', $3, $4 );
                }
-               when ( /Apache(?: Software)? License(?:,? 
$ver_prefix_re($L{re}{version_number})( or(?: any)? (?:later|newer))?)?(?:(?: 
or)? [^ ,]*?apache[^ ,]*| \([^(),]\))*,? or(?: the)? bsd(?:[ 
-](\d)-clause)?\b/i ) {
+               when ( /Apache(?: Software)? License(?:,? 
$L{re}{version_prefix}?($L{re}{version_number})( or(?: any)? 
(?:later|newer))?)?(?:(?: or)? [^ ,]*?apache[^ ,]*| \([^(),]\))*,? or(?: the)? 
bsd(?:[ -](\d)-clause)?\b/i ) {
                        $gen_license->( 'Apache', $1, $2, "bsd_${3}_clause" );
                }
-               when ( /Apache(?: Software)? License(?:,? 
$ver_prefix_re($L{re}{version_number})( or(?: any)? (?:later|newer))?)?(?:(?: 
or)? [^ ,]*?apache[^ ,]*| \([^(),]\))*,? or $L{re}{mit_new}\b/i ) {
+               when ( /Apache(?: Software)? License(?:,? 
$L{re}{version_prefix}?($L{re}{version_number})( or(?: any)? 
(?:later|newer))?)?(?:(?: or)? [^ ,]*?apache[^ ,]*| \([^(),]\))*,? or 
$L{re}{mit_new}\b/i ) {
                        $gen_license->( 'Apache', $1, $2, 'mit_new', $3, $4 );
                }
-               when ( /Apache(?: Software)? License(?:,? 
$ver_prefix_re($L{re}{version_number})( or(?: any)? (?:later|newer))?)?(?:(?: 
or)? [^ ,]*?apache[^ ,]*| \([^(),]\))*,? or $L{re}{mit}\b/i ) {
+               when ( /Apache(?: Software)? License(?:,? 
$L{re}{version_prefix}?($L{re}{version_number})( or(?: any)? 
(?:later|newer))?)?(?:(?: or)? [^ ,]*?apache[^ ,]*| \([^(),]\))*,? or 
$L{re}{mit}\b/i ) {
                        $gen_license->( 'Apache', $1, $2, 'mit', $3, $4 );
                }
-               when ( /Apache(?: Software)? License(?:,? 
$ver_prefix_re($L{re}{version_number})(,? or(?: any)? (?:later|newer))?)?/i ) {
+               when ( /Apache(?: Software)? License(?:,? 
$L{re}{version_prefix}?($L{re}{version_number})(,? or(?: any)? 
(?:later|newer))?)?/i ) {
                        $gen_license->( 'Apache', $1, $2 );
                }
                when ( 
m<https?www.apache.org/licenses(?:/LICENSE-($L{re}{version_number}))?>i ) {
@@ -839,7 +837,7 @@ sub parse_license
 
        # CDDL
        given ($licensetext) {
-               when ( /terms of the Common Development and Distribution 
License(?:,? $ver_prefix_re($L{re}{version_number}))?/ ) {
+               when ( /terms of the Common Development and Distribution 
License(?:,? $L{re}{version_prefix}?($L{re}{version_number}))?/ ) {
                        $gen_license->( 'CDDL', $1 );
                }
        }
@@ -853,14 +851,14 @@ sub parse_license
 
        # AFL
        given ($licensetext) {
-               when ( /Licensed under the Academic Free License(?: 
$ver_prefix_re($L{re}{version_number}))?/ ) {
+               when ( /Licensed under the Academic Free License(?: 
$L{re}{version_prefix}?($L{re}{version_number}))?/ ) {
                        $gen_license->( 'AFL', $1 );
                }
        }
 
        # EPL
        given ($licensetext) {
-               when ( /This program and the accompanying materials are made 
available under the terms of the Eclipse Public License(?:[ 
,-]+$ver_prefix_re($L{re}{version_number}))?/ ) {
+               when ( /This program and the accompanying materials are made 
available under the terms of the Eclipse Public License(?:[ 
,-]+$L{re}{version_prefix}?($L{re}{version_number}))?/ ) {
                        $gen_license->( 'EPL', $1 );
                }
        }
@@ -870,7 +868,7 @@ sub parse_license
                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\)/ ) {
                        $gen_license->('BSL');
                }
-               when ( /Boost Software License(?:[ ,-]+ 
$ver_prefix_re($L{re}{version_number}))?/i ) {
+               when ( /Boost Software License(?:[ ,-]+ 
$L{re}{version_prefix}?($L{re}{version_number}))?/i ) {
                        $gen_license->( 'BSL', $1, $2 );
                }
        }
@@ -884,7 +882,7 @@ sub parse_license
 
        # Python
        given ($licensetext) {
-               when ( /PYTHON SOFTWARE FOUNDATION LICENSE(?:,? 
$ver_prefix_re($L{re}{version_number}))?/i ) {
+               when ( /PYTHON SOFTWARE FOUNDATION LICENSE(?:,? 
$L{re}{version_prefix}?($L{re}{version_number}))?/i ) {
                        $gen_license->( 'Python', $1, $2 );
                }
        }
@@ -931,7 +929,7 @@ sub parse_license
 
        # WTFPL
        given ($licensetext) {
-               when ( /Do What The Fuck You Want To Public License,? 
$ver_prefix_re($L{re}{version_number})/i ) {
+               when ( /Do What The Fuck You Want To Public License,? 
$L{re}{version_prefix}?($L{re}{version_number})/i ) {
                        $gen_license->( 'WTFPL', $1 );
                }
        }
diff --git a/lib/Regexp/Pattern/License.pm b/lib/Regexp/Pattern/License.pm
index 95f9515..7106fbd 100644
--- a/lib/Regexp/Pattern/License.pm
+++ b/lib/Regexp/Pattern/License.pm
@@ -268,6 +268,8 @@ Patterns each covering a single trait occuring in licenses.
 
 =item * version_number
 
+=item * version_prefix
+
 =back
 
 =cut
@@ -313,6 +315,12 @@ $RE{'version_number'} = {
        pat     => qr/$P{version_number}/,
 };
 
+$RE{'version_prefix'} = {
+       caption => 'version prefix',
+       tags    => ['trait'],
+       pat     => qr/$P{version_prefix}/,
+};
+
 =head2 Multiple licenses
 
 Patterns each covering multiple licenses.
diff --git a/lib/Regexp/Pattern/License/Parts.pm 
b/lib/Regexp/Pattern/License/Parts.pm
index 4247045..842771f 100644
--- a/lib/Regexp/Pattern/License/Parts.pm
+++ b/lib/Regexp/Pattern/License/Parts.pm
@@ -65,6 +65,8 @@ Patterns each covering a single part, e.g. a clause or a 
disclaimer phrase.
 
 =item * version_number
 
+=item * version_prefix
+
 =back
 
 =cut
@@ -253,6 +255,11 @@ our %RE = (
                tags    => ['component'],
                pat     => qr/\d(?:\.\d+)*/,
        },
+       version_prefix => {
+               caption => 'version prefix',
+               tags    => ['component'],
+               pat     => qr/[Vv](?:ersion |ERSION |\.? ?)/,
+       },
 );
 
 =encoding UTF-8

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/licensecheck.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to