[devscripts] 14/16: licensecheck: fix BSL parser (Closes: #690375)

dod at debian.org dod at debian.org
Thu May 14 16:34:27 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 3f3867c0712e849165d9ecbf40ba977a60ffec46
Author: Dominique Dumont <dod at debian.org>
Date:   Thu May 14 18:25:50 2015 +0200

    licensecheck: fix BSL parser (Closes: #690375)
---
 scripts/licensecheck.pl   |  8 ++++++--
 test/licensecheck/boost.h | 34 ++++++++++++++++++++++++++++++++++
 test/test_licensecheck    |  5 +++++
 3 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl
index bb5f976..2c4c05c 100755
--- a/scripts/licensecheck.pl
+++ b/scripts/licensecheck.pl
@@ -409,6 +409,7 @@ sub clean_comments {
 
     # Remove C / C++ comments
     s#(\*/|/[/*])##g;
+    # this also removes quotes
     tr% A-Za-z.,@;0-9\(\)/-%%cd;
     tr/ //s;
 
@@ -486,7 +487,9 @@ sub parselicense {
 	$extrainfo = " (with Qt exception)$extrainfo"
     }
 
-    if ($licensetext =~ /(All changes made in this file will be lost|DO NOT (EDIT|delete this file)|Generated (automatically|by|from)|generated.*file)/i) {
+    # exclude blurb found in boost license text
+    if ($licensetext =~ /(All changes made in this file will be lost|DO NOT (EDIT|delete this file)|Generated (automatically|by|from)|generated.*file)/i
+        and $licensetext !~  /unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor/) {
 	$license = "GENERATED FILE";
     }
 
@@ -594,7 +597,8 @@ sub parselicense {
         $license = "Ms-PL $license";
     }
 
-    if ($licensetext =~ /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\"\)/ or
+    # quotes were removed by clean_comments function
+    if ($licensetext =~ /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\)/ or
 	$licensetext =~ /Boost Software License([ ,-]+Version ([^ ]+)?(\.))/i) {
 	$license = "BSL " . ($1 ? "(v$2) " : '') . $license;
     }
diff --git a/test/licensecheck/boost.h b/test/licensecheck/boost.h
new file mode 100644
index 0000000..82b13f5
--- /dev/null
+++ b/test/licensecheck/boost.h
@@ -0,0 +1,34 @@
+// Copyright 2006 Nemanja Trifunovic
+
+/*
+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") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+*/
+
+
+#ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
+#define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731
+
+#include "utf8/checked.h"
+#include "utf8/unchecked.h"
+
+#endif // header guard
diff --git a/test/test_licensecheck b/test/test_licensecheck
index 028c444..708e31a 100755
--- a/test/test_licensecheck
+++ b/test/test_licensecheck
@@ -39,6 +39,11 @@ testBeerware() {
     license "beerware.cpp" "Beerware"
 }
 
+testBoost() {
+    license "boost.h" "BSL"
+}
+
+
 testBSD() {
     license "bsd-3-clause.cpp" "BSD (3 clause)"
     license "bsd-3-clause-authorsany.c" "BSD (3 clause)"

-- 
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