[libconfig-model-dpkg-perl] 04/09: Improve (c) scanner (and tests) to cope with owner 'f00' (Closes: #783932)
dod at debian.org
dod at debian.org
Fri May 8 08:51:41 UTC 2015
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 70444781be8d88c7ab505470fbe15be800a8b7df
Author: Dominique Dumont <dod at debian.org>
Date: Tue May 5 19:59:49 2015 +0200
Improve (c) scanner (and tests) to cope with owner 'f00' (Closes: #783932)
---
lib/Dpkg/Copyright/Scanner.pm | 16 ++++++++++------
t/scanner/examples/moarvm.out | 19 +++++++------------
t/scanner/examples/pan.out | 8 +++-----
t/scanner/examples/sdl2.out | 11 +++--------
t/scanner/examples/test-783932.in | 1 +
t/scanner/examples/test-783932.out | 5 +++++
t/scanner/pack_copyright.t | 4 ++++
t/scanner/scan-copyright.t | 2 +-
t/scanner/squash_copyright_years.t | 20 ++++++++++----------
9 files changed, 44 insertions(+), 42 deletions(-)
diff --git a/lib/Dpkg/Copyright/Scanner.pm b/lib/Dpkg/Copyright/Scanner.pm
index 305bcef..e9d492b 100644
--- a/lib/Dpkg/Copyright/Scanner.pm
+++ b/lib/Dpkg/Copyright/Scanner.pm
@@ -124,9 +124,10 @@ sub scan_files ( %args ) {
$c =~ s/\s+by\s+//g;
$c =~ s/all\s+rights?\s+reserved[\s\.]*//gi;
$c = 'no-info-found' if $c =~ /^\*No/;
- $c =~ s/^\s+|\s+$//g;
+ $c =~ s/\(r\)//g;
+ $c =~ s!^[\s,/*]|[\s,/*-]+$!!g;
- $c = __pack_copyright($c);
+ $c = __pack_copyright($c);
$files->{$f} = $copyrights{$c}{$l} //= $id++;
}
@@ -151,10 +152,12 @@ sub scan_files ( %args ) {
}
sub __split_copyright ($c) {
- my @data = split /(?<=\d)[,\s]+/, $c;
- my $owner = pop @data;
- return undef unless defined $owner;
- $owner =~ s/^\s+|\s+$//g;
+ my ($years,$owner) = $c =~ /([\s,\d-]+)(.*)/;
+ # say "undef year in $c" unless defined $years;
+ return unless defined $years;
+ my @data = split /(?<=\d)[,\s]+/, $years;
+ return unless defined $owner;
+ $owner =~ s/^[\s.,-]+|[\s,*-]+$//g;
return ($owner, at data);
}
@@ -243,6 +246,7 @@ sub __squash_copyrights_years ($copyrights_by_id) {
my @years ;
foreach my $line (split(/\n\s+/,$c)) {
my ($owner, @year) = __split_copyright($line);
+ next unless defined $owner;
push @owners, $owner;
push @years, join(',', at year);
}
diff --git a/t/scanner/examples/moarvm.out b/t/scanner/examples/moarvm.out
index 00ef481..0bc2e38 100644
--- a/t/scanner/examples/moarvm.out
+++ b/t/scanner/examples/moarvm.out
@@ -123,7 +123,7 @@ Copyright: 2003-2011, Hewlett-Packard Development Company, L.P
License: Expat
Files: 3rdparty/libuv/*
-Copyright: , Joyent, Inc. and other Node contributors.
+Copyright: Joyent, Inc. and other Node contributors.
License: Expat
Files: 3rdparty/libuv/autogen.sh
@@ -132,7 +132,7 @@ Copyright: 2013, Ben Noordhuis <info at bnoordhuis.nl>
License: ISC
Files: 3rdparty/libuv/include/android-ifaddrs.h
-Copyright: 1995, 1999
+Copyright: 1995, 1999,
License: BSD-2-clause
Files: 3rdparty/libuv/include/pthread-fixes.h
@@ -149,11 +149,11 @@ Copyright: 2002, Niels Provos <provos at citi.umich.edu>
License: BSD-2-clause
Files: 3rdparty/libuv/samples/*
-Copyright: , StrongLoop, Inc.
+Copyright: StrongLoop, Inc.
License: Expat
Files: 3rdparty/libuv/samples/socks5-proxy/getopt.c
-Copyright: 1987, 1993, 1994
+Copyright: 1987, 1993, 1994,
License: BSD-3-clause
Files: 3rdparty/libuv/src/heap-inl.h
@@ -196,20 +196,15 @@ Copyright: 2011, Mutsuo Saito, Makoto Matsumoto
License: UNKNOWN
Files: 3rdparty/uthash.h
-Copyright: 2003-2014, Troy D. Hanson http://troydhanson.github.com/uthash/
+Copyright: 2003-2014, Troy D. Hanson http://troydhanson.github.com/uthash
License: BSD-2-clause
Files: src/gc/debug.h
-Copyright: , >= (char *)tc->nursery_fromspace && \
- , < (char *)tc->nursery_fromspace + MVM_NURSERY_SIZE) \
+Copyright: >= (char *)tc->nursery_fromspace && \ / < (char *)tc->nursery_fromspace + MVM_NURSERY_SIZE) \
License: UNKNOWN
Files: src/io/dirops.c
-Copyright: , )
- , ( == L\\ || == L
- , ( ==
- , ( != L\\ && != L
- , ( !=
+Copyright: ( == L\\ || == L/) / ( == /) / ( != L\\ && != L/) / ( != /)
License: UNKNOWN
Files: src/strings/unicode_db.c
diff --git a/t/scanner/examples/pan.out b/t/scanner/examples/pan.out
index 7d38630..cc7d5f9 100644
--- a/t/scanner/examples/pan.out
+++ b/t/scanner/examples/pan.out
@@ -26,7 +26,7 @@ License: LGPL-2+
Files: pan/general/map-vector.h
Copyright: 2001, Andrei Alexandrescu
- , 2001. Addison-Wesley
+ 2001, Addison-Wesley
License: UNKNOWN
Files: pan/general/sorted-vector.h
@@ -51,13 +51,11 @@ Copyright: 2001, Ximian, Inc
License: GPL-2
Files: pan/gui/license.h
-Copyright: 1989, 1991, Free Software Foundation, Inc.\n\
- , the software, and\n\
+Copyright: the software, and\n\ / 1989, 1991 Free Software Foundation, Inc.\n\
License: UNKNOWN
Files: pan/gui/xface.c
-Copyright: , messages are not removed, and no monies are exchanged
- , James Ashton - Sydney University - June 1990
+Copyright: messages are not removed, and no monies are exchanged / James Ashton - Sydney University - June 1990
License: UNKNOWN
Files: pan/tasks/decoder.cc
diff --git a/t/scanner/examples/sdl2.out b/t/scanner/examples/sdl2.out
index 6ea4f0c..d3423c7 100644
--- a/t/scanner/examples/sdl2.out
+++ b/t/scanner/examples/sdl2.out
@@ -1,5 +1,5 @@
Files: build-scripts/ltmain.sh
-Copyright: 1996-2001, 2003-2005, 2006
+Copyright: 1996-2001, 2003-2006,
License: GPL-2+
Files: include/*
@@ -47,8 +47,7 @@ Copyright: 1997-2014, Sam Lantinga <slouken at libsdl.org>
License: Zlib
Files: src/render/software/SDL_rotate.c
-Copyright: 2001-2011, Andreas Schiffler
- , follows:
+Copyright: follows: / 2001-2011, Andreas Schiffler
License: Zlib
Files: src/stdlib/SDL_qsort.c
@@ -61,7 +60,7 @@ License: Zlib
Files: src/test/SDL_test_md5.c
Copyright: 1997-2014, Sam Lantinga <slouken at libsdl.org>
- 1990, RSA Data Security, Inc. **
+ 1990, RSA Data Security, Inc.
License: Zlib
Files: src/video/x11/edid-parse.c
@@ -77,10 +76,6 @@ Files: test/*
Copyright: 1997-2014, Sam Lantinga <slouken at libsdl.org>
License: UNKNOWN
-Files: test/testgles2.c
-Copyright: (r) 1997-2014, Sam Lantinga <slouken at libsdl.org>
-License: UNKNOWN
-
Files: test/testhaptic.c
Copyright: 2008, Edgar Simo Serra
1997-2014, Sam Lantinga <slouken at libsdl.org>
diff --git a/t/scanner/examples/test-783932.in b/t/scanner/examples/test-783932.in
new file mode 100644
index 0000000..c8743e4
--- /dev/null
+++ b/t/scanner/examples/test-783932.in
@@ -0,0 +1 @@
+./main.h GPL (v2 or later) 2004-2015 Oliva 'f00' Oberto * / 2001-2010 Paul 'bar' Stevenson *
diff --git a/t/scanner/examples/test-783932.out b/t/scanner/examples/test-783932.out
new file mode 100644
index 0000000..d873478
--- /dev/null
+++ b/t/scanner/examples/test-783932.out
@@ -0,0 +1,5 @@
+Files: *
+Copyright: 2004-2015, Oliva f00 Oberto
+ 2001-2010, Paul bar Stevenson
+License: GPL-2+
+
diff --git a/t/scanner/pack_copyright.t b/t/scanner/pack_copyright.t
index 4415523..3eb0853 100644
--- a/t/scanner/pack_copyright.t
+++ b/t/scanner/pack_copyright.t
@@ -21,6 +21,10 @@ my @tests = (
[
'2002-2006 Charles Kerr <charles at rebelbase.com> / 2002, 2003, 2004, 2005, 2007, 2008, 2010 Free Software / 2011 Heinrich Muller <henmull at src.gnome.org> / 2002 vjt (irssi project)',
"2011, Heinrich Muller <henmull\@src.gnome.org>\n 2002-2006, Charles Kerr <charles\@rebelbase.com>\n 2002-2005, 2007, 2008, 2010, Free Software\n 2002, vjt (irssi project)"
+ ],
+ [
+ q!2004-2015, Oliva f00 Oberto / 2001-2010, Paul bar Stevenson !,
+ "2004-2015, Oliva f00 Oberto\n 2001-2010, Paul bar Stevenson"
]
);
diff --git a/t/scanner/scan-copyright.t b/t/scanner/scan-copyright.t
index 13b8649..16f5fd5 100644
--- a/t/scanner/scan-copyright.t
+++ b/t/scanner/scan-copyright.t
@@ -20,7 +20,7 @@ foreach my $in ($dir->children(qr/\.in$/)) {
my $out = $dir->child($out_name);
print_copyright( in => $in, out => $temp );
- files_eq_or_diff($temp, $out, "check $test_name copyright");
+ files_eq_or_diff($out, $temp, "check $test_name copyright");
}
diff --git a/t/scanner/squash_copyright_years.t b/t/scanner/squash_copyright_years.t
index ca6c9da..0811d49 100644
--- a/t/scanner/squash_copyright_years.t
+++ b/t/scanner/squash_copyright_years.t
@@ -38,16 +38,16 @@ pan:
);
my @copyright_by_id = (
- [ 'GPL', '2002, foo'],
- [ 'GPL', '2003, bar1'],
- [ 'GPL', '2003, bar2'],
- [ 'GPL', '2003, bar3'],
- [ 'GPL', '2003, bar4'],
- [ 'GPL', '2003, bar5'],
- [ 'GPL', '2003, bar5'],
- [ 'GPL', '2003, bar7'],
- [ 'GPL', '2003, bar8'],
- [ 'GPL', '2003, bar9']
+ [ '2002, foo' , 'GPL' ],
+ [ '2003, bar1', 'GPL' ],
+ [ '2003, bar2', 'GPL' ],
+ [ '2003, bar3', 'GPL' ],
+ [ '2003, bar4', 'GPL' ],
+ [ '2003, bar5', 'GPL' ],
+ [ '2003, bar5', 'GPL' ],
+ [ '2003, bar7', 'GPL' ],
+ [ '2003, bar8', 'GPL' ],
+ [ '2003, bar9', 'GPL' ]
);
--
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