This is an automated email from the git hooks/post-receive script. dod pushed a commit to branch master in repository devscripts.
commit bfbd20a0ec1ccc5464c8d82b106d3b30923bf1a0 Author: Dominique Dumont <[email protected]> Date: Sun Jun 21 12:30:41 2015 +0200 licensecheck: fix digia © and license extraction (Closes: #789074) in Digia's case, the owner contains "or", so this keyword was removed from $copyright_disindicator_regex I've also fixed the license extraction from Digia file. This was broken in 2.15.4 and 2.15.3 (and possibly before, but I did not test) The fix consists in tweaking the regex and testing alternate versions before unique versions. --- debian/changelog | 4 +++- scripts/licensecheck.pl | 16 ++++++++-------- test/licensecheck/lgpl-digia.c | 32 ++++++++++++++++++++++++++++++++ test/test_licensecheck | 1 + 4 files changed, 44 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4edea9a..0404aa7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ devscripts (2.15.6) UNRELEASED; urgency=low - * licensecheck: extract © owner when © and owners are specified on 2 lines. + * licensecheck: + * extract © owner when © and owners are specified on 2 lines. + * fix digia © and license extraction (Closes: #789074) -- Dominique Dumont <[email protected]> Fri, 19 Jun 2015 07:42:55 +0200 diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl index b2e7250..fa8ec74 100755 --- a/scripts/licensecheck.pl +++ b/scripts/licensecheck.pl @@ -171,6 +171,7 @@ my $default_ignore_regex = qr! my $default_check_regex = '\.(c(c|pp|xx)?|h(h|pp|xx)?|f(77|90)?|go|groovy|scala|clj|p(l|m)|xs|sh|php|py(|x)|rb|java|js|vala|el|sc(i|e)|cs|pas|inc|dtd|xsl|mod|m|tex|mli?|(c|l)?hs)$'; +# also used to cleanup my $copyright_indicator_regex = qr! (?:copyright # The full word @@ -184,9 +185,9 @@ my $copyright_indicator_regex_with_capture = qr!$copyright_indicator_regex(?::\s my $copyright_disindicator_regex = qr! - \b(?:info(?:rmation)? # Discussing copyright information + \b(?:info(?:rmation)? # Discussing copyright information |(notice|statement|claim|string)s? # Discussing the notice - |or|is|in|to # Part of a sentence + |is|in|to # Part of a sentence |(holder|owner)s? # Part of a sentence |ownership # Part of a sentence )\b @@ -391,10 +392,9 @@ sub parse_copyright { #print "match against ->$data<-\n"; if ($data =~ $copyright_indicator_regex_with_capture) { $match = $1; - # Ignore lines matching "see foo for copyright information" etc. if ($match !~ $copyright_disindicator_regex) { - # De-cruft + # De-cruft $match =~ s/([,.])?\s*$//; $match =~ s/$copyright_indicator_regex//igx; $match =~ s/^\s+//; @@ -491,7 +491,9 @@ sub parselicense { my $extrainfo = ""; my $license = ""; - if ($licensetext =~ /version ([^, ]+?)[.,]? (?:\(?only\)?.? )?(?:of the GNU (Affero )?(Lesser |Library )?General Public License )?(as )?published by the Free Software Foundation/i or + if ($licensetext =~ /version ([^ ]+)(?: of the License)?,? or(?: \(at your option\))? version (\d(?:[.-]\d+)*)/) { + $gplver = " (v$1 or v$2)"; + } elsif ($licensetext =~ /version ([^, ]+?)[.,]? (?:\(?only\)?.? )?(?:of the GNU (Affero )?(Lesser |Library )?General Public License )?(as )?published by the Free Software Foundation/i or $licensetext =~ /GNU (?:Affero )?(?:Lesser |Library )?General Public License (?:as )?published by the Free Software Foundation[;,] version ([^, ]+?)[.,]? /i) { $gplver = " (v$1)"; @@ -499,8 +501,6 @@ sub parselicense { $gplver = " (v$1)"; } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or (?:\(at your option\) )?any later version/) { $gplver = " (v$1 or later)"; - } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(at your option\) version (\d(?:[\.-]\d+)*)/) { - $gplver = " (v$1 or v$2)"; } elsif ($licensetext =~ /GPL\sas\spublished\sby\sthe\sFree\sSoftware\sFoundation,\sversion\s([\d.]+)/i ) { $gplver = " (v$1)"; } @@ -537,7 +537,7 @@ sub parselicense { $license = "GPL$gplver$extrainfo $license"; } - if ($licensetext =~ /is\s(?:distributed.*?terms|being\s+released).*?\b(L?GPL)\b/) { + if ($licensetext =~ /(?:is|may be)\s(?:(?:distributed|used).*?terms|being\s+released).*?\b(L?GPL)\b/) { my $v = $gplver || ' (unversioned/unknown version)'; $license = "$1$v $license"; } diff --git a/test/licensecheck/lgpl-digia.c b/test/licensecheck/lgpl-digia.c new file mode 100644 index 0000000..fbff4e7 --- /dev/null +++ b/test/licensecheck/lgpl-digia.c @@ -0,0 +1,32 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ diff --git a/test/test_licensecheck b/test/test_licensecheck index a92d448..bc0d8d7 100755 --- a/test/test_licensecheck +++ b/test/test_licensecheck @@ -67,6 +67,7 @@ testLGPL() { license "lgpl-variation.c" "LGPL (v3 or later)" license "lgpl-no-version.h" "LGPL (unversioned/unknown version)" license2 "-m --copyright" "lgpl-big-blue.h" "LGPL (v2.1) 2000, 2010 IBM Corporation and others. All rights reserved" + license2 "-m --copyright" "lgpl-digia.c" "LGPL (v2.1 or v3) 2014 Digia Plc and/or its subsidiary(-ies)" } testGPL() { -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git _______________________________________________ devscripts-devel mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel
