This is an automated email from the git hooks/post-receive script. dod pushed a commit to branch master in repository devscripts.
commit 6570360a5953344247a54ceb634db41dab899054 Author: Dominique Dumont <[email protected]> Date: Wed Nov 18 21:14:21 2015 +0100 licensecheck: added --encoding option --- debian/changelog | 2 ++ scripts/licensecheck.pl | 15 +++++++++++++-- test/test_licensecheck | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index a339970..f6d8f7f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,6 +27,8 @@ devscripts (2.15.10) UNRELEASED; urgency=medium extension instead of mime types provided by "file" command. The list of file extensions is more boring to maintain but also more predictable. (Closes: #803724) + + added --encoding option. By default, input files are handled as utf-8 + Information is printed on STDOUT as utf-8. * --text option is deprecated [ Osamu Aoki ] diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl index 881807b..aaf5982 100755 --- a/scripts/licensecheck.pl +++ b/scripts/licensecheck.pl @@ -30,7 +30,7 @@ B<licensecheck> B<--help>|B<--version> B<licensecheck> [B<--no-conf>] [B<--verbose>] [B<--copyright>] [B<-l>|B<--lines=>I<N>] [B<-i>|B<--ignore=>I<regex>] [B<-c>|B<--check=>I<regex>] -[B<-m>|B<--machine>] [B<-r>|B<--recursive>] +[B<-m>|B<--machine>] [B<-r>|B<--recursive>] [B<-e>|B<--encoding=>I<...>] I<list of files and directories to check> =head1 DESCRIPTION @@ -80,6 +80,13 @@ The default includes common source files. Also display copyright text found within the file +=item B<-e> B<--encoding> + +Specifies input encoding of source files. By default, input files are +not decoded. When encoding is specified, license and copyright +information are printed on STDOUT as utf8, or garbage if you got the +encoding wrong. + =item B<-m>, B<--machine> Display the information in a machine readable way, i.e. in the form @@ -261,6 +268,7 @@ GetOptions(\%OPT, "help|h", "check|c=s", "copyright", + "encoding|e=s", "ignore|i=s", "lines|l=i", "machine|m", @@ -326,7 +334,10 @@ while (@files) { my $copyright = ''; my $license = ''; - open (my $F, '<' ,$file) or die "Unable to access $file\n"; + my $enc = $OPT{encoding} ; + my $mode = $enc ? "<:encoding($enc)" : '<'; + # need to use "<" when encoding is unknown otherwise we break compatibility + open (my $F, $mode ,$file) or die "Unable to access $file\n"; while ( <$F>) { last if ($. > $OPT{'lines'}); diff --git a/test/test_licensecheck b/test/test_licensecheck index 9c8fb33..5225b0f 100755 --- a/test/test_licensecheck +++ b/test/test_licensecheck @@ -134,7 +134,7 @@ testRegexpKiller() { } testEncoding () { - license2 "-m --copyright" "copr-iso8859.h" "GPL (v2) (with incorrect FSF address) 2011 Heinrich Müller <[email protected]>" - license2 "-m --copyright" "copr-utf8.h" "GPL (v2 or later) 2004-2015 Oliva 'f00' Oberto / 2001-2010 Paul 'bar' Stevénsön" + license2 "-m --copyright --encoding iso-8859-1" "copr-iso8859.h" "GPL (v2) (with incorrect FSF address) 2011 Heinrich Müller <[email protected]>" + license2 "-m --copyright --encoding utf8" "copr-utf8.h" "GPL (v2 or later) 2004-2015 Oliva 'f00' Oberto / 2001-2010 Paul 'bar' Stevénsön" } . shunit2 -- 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
