[devscripts] 01/01: licensecheck: handle REM style comments (Closes: #748611)

dod at debian.org dod at debian.org
Sat May 16 08:09:57 UTC 2015


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

dod pushed a commit to branch master
in repository devscripts.

commit 4274f77b97768992a21b5e37d7931c4cf44d6020
Author: Dominique Dumont <dod at debian.org>
Date:   Sat May 16 10:09:39 2015 +0200

    licensecheck: handle REM style comments (Closes: #748611)
---
 debian/changelog                              |  1 +
 scripts/licensecheck.pl                       |  5 +++--
 test/licensecheck/gpl-3+-with-rem-comment.xml | 18 ++++++++++++++++++
 test/test_licensecheck                        |  1 +
 4 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 44b9c0d..24e4e33 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -35,6 +35,7 @@ devscripts (2.15.5) UNRELEASED; urgency=medium
     * allow © owner to mention "and others"
     * support eclipse public license (Closes: #587892)
     * handle LGPL as written by IBM (Closes: #587970)
+    * handle REM style comments (Closes: #748611)
 
  -- Cyril Brulebois <kibi at debian.org>  Tue, 28 Apr 2015 16:58:36 +0200
 
diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl
index 1536f80..c25fd7a 100755
--- a/scripts/licensecheck.pl
+++ b/scripts/licensecheck.pl
@@ -1,4 +1,5 @@
 #!/usr/bin/perl
+# -*- tab-width: 8; indent-tabs-mode: t; cperl-indent-level: 4 -*-
 # This script was originally based on the script of the same name from
 # the KDE SDK (by dfaure at kde.org)
 #
@@ -397,7 +398,7 @@ sub clean_comments {
     # 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.
-    my @matches = m/^\s*([^a-zA-Z0-9\s]{1,3})\s\w/mg;
+    my @matches = m/^\s*((?:[^a-zA-Z0-9\s]{1,3}|\bREM\b))\s\w/mg;
     if (@matches >= 4) {
 	my $comment_re = qr/\s*[\Q$matches[0]\E]{1,3}\s*/;
 	s/^$comment_re//mg;
@@ -471,7 +472,7 @@ sub parselicense {
 	$gplver = " (v$1)";
     } elsif ($licensetext =~ /GNU (?:Affero )?(?:Lesser |Library )?General Public License\s*(?:[(),GPL]+)\s*version (\d+(?:\.\d+)?)[ \.]/i) {
 	$gplver = " (v$1)";
-    } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(at your option\) any later version/) {
+    } 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)";
diff --git a/test/licensecheck/gpl-3+-with-rem-comment.xml b/test/licensecheck/gpl-3+-with-rem-comment.xml
new file mode 100644
index 0000000..ad27b2f
--- /dev/null
+++ b/test/licensecheck/gpl-3+-with-rem-comment.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="AktenAnlMod1" script:language="StarBasic">REM                        *****  BASIC  *****
+REM                           ***** Canzeley *****
+REM              Copyright (C) 2008, 2009 Dr. Michael Stehmann
+REM                  info at rechtsanwalt-stehmann.de
+REM This program is free software: you can redistribute it and/or modify it
+REM under the terms of the GNU General Public License as published by the
+REM Free Software Foundation, either version 3 of the License, or any later version.
+REM This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+REM without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+REM See the GNU General Public License for more details.
+REM You should have received a copy of the GNU General Public License along with this program.
+REM If not, see <http://www.gnu.org/licenses/>.
+REM                      *** Version 0.2.0 ***
+
+REM **** Kanzleiprogramm - AktenAnlMod1 ****
+
diff --git a/test/test_licensecheck b/test/test_licensecheck
index 8ea1a25..5e372dd 100755
--- a/test/test_licensecheck
+++ b/test/test_licensecheck
@@ -76,6 +76,7 @@ testGPL() {
     license "gpl-2-incorrect-address" "GPL (v2) (with incorrect FSF address)"
     license "gpl-3.sh" "GPL (v3)"
     license "gpl-3+" "GPL (v3 or later)"
+    license "gpl-3+-with-rem-comment.xml" "GPL (v3 or later)"
     license "gpl-3-only.c" "GPL (v3)"
     license "gpl-variation.c" "GPL (v3 or later)"
     license "gpl-3+.el" "GPL (v3 or later)"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list