This is an automated email from the git hooks/post-receive script. dod pushed a commit to branch master in repository devscripts.
commit cc640250c61a8c8be9bb828d1e77dc959ac73e47 Author: Dominique Dumont <[email protected]> Date: Tue Aug 18 14:07:53 2015 +0200 licensecheck: store only first copyright block Some files put © info in comment and then the same info in a variable. In this case licensecheck provides duplicated information. Once we assume © information is specified in a single block, i.e. all © stanza are grouped and not separated by more than 5 lines without © information, the second block can be detected and discarded. The number of lines between 2 blocks (5) is rather arbitrary and can be changed if proven wrong. --- debian/changelog | 1 + scripts/licensecheck.pl | 6 +++++ test/licensecheck/duplicated-copyright.rb | 43 +++++++++++++++++++++++++++++++ test/test_licensecheck | 4 +++ 4 files changed, 54 insertions(+) diff --git a/debian/changelog b/debian/changelog index 555a441..e7e302f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,7 @@ devscripts (2.15.9) UNRELEASED; urgency=medium * use 'file' command to decide whether to scan a file or not (instead of testing file suffix) * remove trailing '#' from © information + * store only first © block to avoid duplicated information -- Joachim Breitner <[email protected]> Tue, 11 Aug 2015 21:12:03 +0200 diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl index 2e25aa7..07b1a7c 100755 --- a/scripts/licensecheck.pl +++ b/scripts/licensecheck.pl @@ -385,6 +385,7 @@ sub extract_copyright { my @c = split /\n/, clean_comments($content); my %copyrights; + my $lines_after_copyright_block = 0; while (@c) { my $line = shift @c ; @@ -397,6 +398,11 @@ sub extract_copyright { $copyright_match =~ s/\s+/ /g; $copyrights{lc("$copyright_match")} = "$copyright_match"; } + elsif (scalar keys %copyrights) { + # skip remaining lines if a copyright blocks was found more than 5 lines ago. + # so a copyright block may contain up to 5 blank lines, but no more + last if $lines_after_copyright_block++ > 5; + } } return %copyrights; } diff --git a/test/licensecheck/duplicated-copyright.rb b/test/licensecheck/duplicated-copyright.rb new file mode 100644 index 0000000..b7fef8a --- /dev/null +++ b/test/licensecheck/duplicated-copyright.rb @@ -0,0 +1,43 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require 'cli_helper' + +begin + require 'opennebula' +rescue Exception => e + puts "Error: "+e.message.to_s + exit(-1) +end + +include OpenNebula + +module OpenNebulaHelper + ONE_VERSION=<<-EOT +OpenNebula #{OpenNebula::VERSION} +Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs + +Licensed under the Apache License, Version 2.0 (the "License"); you may +not use this file except in compliance with the License. You may obtain +a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +EOT + + if ONE_LOCATION + TABLE_CONF_PATH=ONE_LOCATION+"/etc/cli" + else + TABLE_CONF_PATH="/etc/one/cli" + end + diff --git a/test/test_licensecheck b/test/test_licensecheck index 0b22d57..9c8fb33 100755 --- a/test/test_licensecheck +++ b/test/test_licensecheck @@ -64,6 +64,10 @@ testMultiLineDeclaration() { license2 "-m --copyright" "texinfo.tex" "GPL (v3 or later) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc." } +testDuplicatedCopyright() { + license2 "-m --copyright" "duplicated-copyright.rb" "Apache (v2.0) 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs" +} + testLGPL() { license "lgpl-2.1.c" "LGPL (v2.1)" license "lgpl-2.1.h" "LGPL (v2.1)" -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git _______________________________________________ devscripts-devel mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel
