[libconfig-model-dpkg-perl] 10/14: Improved license cleanup (Closes: #815756)
dod at debian.org
dod at debian.org
Sat Feb 27 18:35:51 UTC 2016
This is an automated email from the git hooks/post-receive script.
dod pushed a commit to branch master
in repository libconfig-model-dpkg-perl.
commit a98d547aedc514bee28c02ed086bb51f2e45e767
Author: Dominique Dumont <dod at debian.org>
Date: Sat Feb 27 17:22:16 2016 +0100
Improved license cleanup (Closes: #815756)
---
lib/Dpkg/Copyright/Scanner.pm | 30 ++++++++++++++++--------------
t/scanner/examples/sdl2.out | 2 +-
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/lib/Dpkg/Copyright/Scanner.pm b/lib/Dpkg/Copyright/Scanner.pm
index 2bf6233..f7521fc 100644
--- a/lib/Dpkg/Copyright/Scanner.pm
+++ b/lib/Dpkg/Copyright/Scanner.pm
@@ -209,20 +209,22 @@ sub scan_files ( %args ) {
next if $files->{$f}; # file already parsed
$l =~ s/([*?\\])/\\$1/g;
- $l =~ s/\s*\(unversioned\/unknown version\)//;
- $l =~ s/\s*\(with incorrect FSF address\)//;
- $l =~ s/(\w+)\s+\(v([^)]+) or v([^)]+)\)/uc($1)."-$2 or ".uc($1)."-$3"/e;
- $l =~ s/\s+\(v([^)]+) or later\)/-$1+/;
- $l =~ s/\s+\(v([^)]+)\)/-$1/;
- $l =~ s/^\s*(GENERATED FILE)/UNKNOWN/;
- $l =~ s/\s+(GENERATED FILE)//;
- $l =~ s/\bzlib\/libpng\b/Zlib/;
- $l =~ s/\bMIT\/X11 \(BSD like\)/Expat/;
- $l =~ s/\bBSD \((\d) clause\)/BSD-$1-clause/;
- $l =~ s/\bpublic domain\b/public-domain/i;
-
- # this is very fragile. may need to change license-check to output license keyword
- $l =~ s/ / or /g unless $l =~ /\bor\b/;
+ $l =~ s/\s*\(unversioned\/unknown version\)//g;
+ $l =~ s/\s*\(with incorrect FSF address\)//g;
+ $l =~ s/(\w+)\s+\(v([^)]+) or v([^)]+)\)/uc($1)."-$2 or ".uc($1)."-$3"/eg;
+ $l =~ s/\s+\(v([^)]+) or later\)/-$1+/g;
+ $l =~ s/\s+\(v([^)]+)\)/-$1/g;
+ $l =~ s/^\s*(GENERATED FILE)/UNKNOWN/g;
+ $l =~ s/\s+(GENERATED FILE)//g;
+ $l =~ s/\bzlib\/libpng\b/Zlib/g;
+ $l =~ s/\bMIT\/X11 \(BSD like\)/Expat/g;
+ $l =~ s/\bBSD \((\d) clause\)/BSD-$1-clause/g;
+ $l =~ s/\bpublic domain\b/public-domain/ig;
+
+ # deduplicate license keywords and add 'or' keyword where missing
+ # this is fragile. may need to change license-check to output license keyword
+ my %tmp_l = map { ( $_ => 1) ;} grep { $_ ne 'or' } split(/ /,$l);
+ $l = join(' or ', sort keys %tmp_l) ;
$c =~ s/'//g;
$c =~ s/^©\s*//;
diff --git a/t/scanner/examples/sdl2.out b/t/scanner/examples/sdl2.out
index ab9e2d9..fc034cf 100644
--- a/t/scanner/examples/sdl2.out
+++ b/t/scanner/examples/sdl2.out
@@ -10,7 +10,7 @@ Files: include/SDL_egl.h
include/SDL_opengles2.h
Copyright: 2008, 2009, The Khronos Group Inc
1997-2014, Sam Lantinga <slouken at libsdl.org>
-License: Zlib or Expat
+License: Expat or Zlib
Files: src/libm/*
Copyright: 1993, Sun Microsystems, Inc.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git
More information about the Pkg-perl-cvs-commits
mailing list