[SCM] Git repository for devscripts branch, master, updated. v2.12.4-201-g66c6044

James McCoy jamessan at debian.org
Sat Apr 27 01:00:13 UTC 2013


The following commit has been merged in the master branch:
commit 66c6044fc64db2ab8f518f2e60ae8cc43075d5d1
Author: James McCoy <jamessan at debian.org>
Date:   Fri Apr 26 20:59:29 2013 -0400

    licensecheck: Fix invalid regular expression syntax.
    
    Closes: #706232
    Signed-off-by: James McCoy <jamessan at debian.org>

diff --git a/debian/changelog b/debian/changelog
index 629d00e..ab23504 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ devscripts (2.13.2) UNRELEASED; urgency=low
   * uscan: Define local replacements for die/warn instead of setting
     $SIG{__DIE__}/$SIG{__WARN__} to prevent breaking die/warn in other
     modules.  (Closes: #669942)
+  * licensecheck: Fix invalid regular expression syntax.  (Closes: #706232)
 
   [ Christoph Berg ]
   * dget: "--all pkg" will download all binaries for source package pkg.
diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl
index a771a09..0317015 100755
--- a/scripts/licensecheck.pl
+++ b/scripts/licensecheck.pl
@@ -353,18 +353,14 @@ 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(($first_match)=m{ ^\s*
-                           ([^a-zA-Z0-9\s]{1,3})
-                           \s\w
-                       }xmg)
-    ){
-	my $comment_length=length($first_match);
-	my $comment_re=qr{\s*  [\Q$1\E]{${comment_length}}  \s*}x;
+    my @matches = m/^\s*([^a-zA-Z0-9\s]{1,3})\s\w/mg;
+    if (@matches >= 4) {
+	my $comment_length = length($matches[0]);
+	my $comment_re = qr/\s*[\Q$matches[0]\E]{${comment_length}}\s*/;
 	s/^$comment_re//mg;
     }
 
diff --git a/test/licensecheck/comments-detection.txt b/test/licensecheck/comments-detection.txt
new file mode 100644
index 0000000..bdc0155
--- /dev/null
+++ b/test/licensecheck/comments-detection.txt
@@ -0,0 +1,6 @@
+# kitchen is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+.. seealso
diff --git a/test/test_licensecheck b/test/test_licensecheck
index f6b4c4e..93657c5 100755
--- a/test/test_licensecheck
+++ b/test/test_licensecheck
@@ -69,9 +69,9 @@ testDual() {
 }
 
 testMPL() {
-	license "mpl-1.1.sh" "MPL (v1.1)"
-	license "mpl-2.0.sh" "MPL (v2.0)"
-	license "mpl-2.0-comma.sh" "MPL (v2.0)"
+    license "mpl-1.1.sh" "MPL (v1.1)"
+    license "mpl-2.0.sh" "MPL (v2.0)"
+    license "mpl-2.0-comma.sh" "MPL (v2.0)"
 }
 
 testMachine() {
@@ -86,6 +86,7 @@ testFortranComments() {
 
 testCommentsDetection() {
     license "comments-detection.h" "GPL (v3 or later)"
+    license "comments-detection.txt" "*No copyright* LGPL (v2.1 or later)"
 }
 
 . shunit2

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list