My two patches to licensecheck are already merged upstream.

The patches are in the future version 2.13.1, not yet released.
This commit is contained in:
Laurent Rineau
2013-02-20 14:03:05 +01:00
parent 9cb1aabee4
commit 6316551b4f
3 changed files with 1 additions and 75 deletions
+1 -1
View File
@@ -411,7 +411,7 @@ EOF
sub version {
print <<"EOF";
This is $progname, from the Debian devscripts package, version 2.13.0
This is $progname, from the Debian devscripts package, version (2.13.1) UNRELEASED
Copyright (C) 2007, 2008 by Adam D. Barratt <adam\@adam-barratt.org.uk>; based
on a script of the same name from the KDE SDK by <dfaure\@kde.org>.
@@ -1,38 +0,0 @@
From fb51184791246022e6d81e0bb97831a0f4ec3516 Mon Sep 17 00:00:00 2001
From: Laurent Rineau <laurent.rineau@cgal.org>
Date: Tue, 19 Feb 2013 15:08:17 +0100
Subject: [PATCH 1/2] Fix clean_comments()
The detection of the comments pattern was using the last match of the
regular expression. That is better to use the first one.
---
scripts/licensecheck.pl | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl
index 8d31626..ba9a2f2 100755
--- a/scripts/licensecheck.pl
+++ b/scripts/licensecheck.pl
@@ -353,16 +353,17 @@ sub parse_copyright {
sub clean_comments {
local $_ = shift or return q{};
+ my $first_match;
# Remove generic comments: look for 4 or more lines beginning with
# regular comment pattern and trim it. Fall back to old algorithm
# if no such pattern found.
- if( 4 <= scalar(()=m{ ^\s*
+ if( 4 <= scalar(($first_match)=m{ ^\s*
([^a-zA-Z0-9\s]{1,3})
\s\w
}xmg)
){
- my $comment_length=length($1);
+ my $comment_length=length($first_match);
my $comment_re=qr{\s* [$1]{${comment_length}} \s*}x;
s/^$comment_re//mg;
}
--
1.7.7.6
@@ -1,36 +0,0 @@
From 625ee7156102169eab89ab2e661daa6bcdf41e48 Mon Sep 17 00:00:00 2001
From: Laurent Rineau <laurent.rineau@cgal.org>
Date: Tue, 19 Feb 2013 15:14:54 +0100
Subject: [PATCH 2/2] Fix the detection of (L|A)GPL.
The wording can be about files (plural) instead of a software (singular).
---
scripts/licensecheck.pl | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl
index ba9a2f2..9331c0e 100755
--- a/scripts/licensecheck.pl
+++ b/scripts/licensecheck.pl
@@ -451,15 +451,15 @@ sub parselicense {
$license = "GENERATED FILE";
}
- if ($licensetext =~ /((is free software.? )?you can redistribute it and\/or modify it|is licensed) under the terms of (version [^ ]+ of )?the (GNU (Library |Lesser )General Public License|LGPL)/i) {
+ if ($licensetext =~ /((is free software.? )?you can redistribute (it|them) and\/or modify (it|them)|is licensed) under the terms of (version [^ ]+ of )?the (GNU (Library |Lesser )General Public License|LGPL)/i) {
$license = "LGPL$gplver$extrainfo $license";
}
- if ($licensetext =~ /is free software.? you can redistribute it and\/or modify it under the terms of the (GNU Affero General Public License|AGPL)/i) {
+ if ($licensetext =~ /is free software.? you can redistribute (it|them) and\/or modify (it|them) under the terms of the (GNU Affero General Public License|AGPL)/i) {
$license = "AGPL$gplver$extrainfo $license";
}
- if ($licensetext =~ /(is free software.? )?you (can|may) redistribute it and\/or modify it under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU General Public License/i) {
+ if ($licensetext =~ /(is free software.? )?you (can|may) redistribute (it|them) and\/or modify (it|them) under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU General Public License/i) {
$license = "GPL$gplver$extrainfo $license";
}
--
1.7.7.6