[devscripts] 01/04: licensecheck: separate content cleanup in 2 parts...
dod at debian.org
dod at debian.org
Sun Jun 21 10:34:40 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 e3930204f31e0e4c49cf3d27e8eaa8a12212277a
Author: Dominique Dumont <dod at debian.org>
Date: Fri Jun 19 07:39:03 2015 +0200
licensecheck: separate content cleanup in 2 parts...
to enable better handling of copyright extraction.
The cleanup is divided in 2 parts:
- cleanup comment (to extract © and license info)
- cleanup spaces and other cruft like \n " and others...
(to extract license info)
Gbp-Dch: Ignore
---
scripts/licensecheck.pl | 12 ++++++++++--
test/test_licensecheck | 1 +
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl
index 6eb100f..eb1cad1 100755
--- a/scripts/licensecheck.pl
+++ b/scripts/licensecheck.pl
@@ -349,7 +349,7 @@ while (@files) {
print qq(----- $file header -----\n$content----- end header -----\n\n)
if $OPT{'verbose'};
- $license = parselicense(clean_comments($content));
+ $license = parselicense(clean_cruft_and_spaces(clean_comments($content)));
if ($OPT{'machine'}) {
print "$file\t$license";
@@ -406,10 +406,18 @@ sub clean_comments {
# Remove Fortran comments
s/^[cC] //gm;
- tr/\t\r\n/ /;
# Remove C / C++ comments
s#(\*/|/[/*])##g;
+
+ return $_;
+}
+
+sub clean_cruft_and_spaces {
+ local $_ = shift or return q{};
+
+ tr/\t\r\n/ /;
+
# this also removes quotes
tr% A-Za-z.,@;0-9\(\)/-%%cd;
tr/ //s;
diff --git a/test/test_licensecheck b/test/test_licensecheck
index 2928552..1dc26c3 100755
--- a/test/test_licensecheck
+++ b/test/test_licensecheck
@@ -55,6 +55,7 @@ testBSD() {
license "bsd-1-clause-1.c" "BSD"
license "bsd-3-clause.cpp" "BSD (3 clause)"
license "bsd-3-clause-authorsany.c" "BSD (3 clause)"
+ license2 "-m --copyright" "bsd-regents.c" "BSD (3 clause) 1987, 1993, 1994 The Regents of the University of California. All rights reserved."
}
testLGPL() {
--
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