[libconfig-model-dpkg-perl] 05/23: no longer use licensecheck --check option..

dod at debian.org dod at debian.org
Mon Feb 13 12:29:38 UTC 2017


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 94cbdd63a4bf06548ce671e0bf75f5ca45c58f52
Author: Dominique Dumont <dod at debian.org>
Date:   Tue Jan 24 13:07:11 2017 +0100

    no longer use licensecheck --check option..
    
    and reduce the processing. There's no need to run twice licensecheck.
    
    Now the stractegy is to run licensecheck (once) on all files but the
    ignored ones. Only the ignore option is passed to licensecheck.
    
    Since licensecheck --check option is borken (ignored), this commit does
    not change the behavior.
---
 lib/Dpkg/Copyright/Scanner.pm | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/lib/Dpkg/Copyright/Scanner.pm b/lib/Dpkg/Copyright/Scanner.pm
index 6f19b44..82a08bb 100644
--- a/lib/Dpkg/Copyright/Scanner.pm
+++ b/lib/Dpkg/Copyright/Scanner.pm
@@ -157,6 +157,7 @@ sub scan_files ( %args ) {
 
     my $current_dir = $args{from_dir} || path('.');
 
+    my %regexps = %default; # default is needed during tests 
     my @lines ;
     if (my $file = $ENV{COPYRIGHT_SCANNER_INPUT}) {
         @lines = path($file)->lines_utf8 ; # for tests
@@ -165,32 +166,36 @@ sub scan_files ( %args ) {
         @lines = $args{in}->lines_utf8; # for other tests
     }
     else {
-        my @runs = (['--skipped'], [qw!-c (?i:readme|license|copying).*!]);
-
+        my $scan_data = {};
         my $debian = $current_dir->child('debian');
         my $scan_patterns = $debian->child("copyright-scan-patterns.yml");
 
         if ($debian->is_dir and $scan_patterns->is_file) {
             my $yaml = $scan_patterns->slurp_utf8;
             # { check => { suffixes => [ js pl ], pattern => '[A-Z]*'}, ignore => { suffixes => [ jpg png ], pattern => 'foo.*'} }
-            my $scan_data = Load $yaml;
-            my @opts = ();
-            foreach my $what (qw/check ignore/) {
-                my $data = $scan_data->{$what} or next;
-                my $reg = join( '|' , (map { '\.'.$_.'$'} @{$data->{suffixes} || []}), @{ $data->{pattern} || []}, $default{$what});
-                push @opts, '--skipped', "--$what=$reg";
-            }
-            @runs = \@opts ;
+            $scan_data = Load $yaml;
         }
 
-        foreach my $opts ( @runs ) {
-            my $pipe = IO::Pipe->new();
-            my @cmd = (qw/licensecheck --encoding utf8 --copyright --machine --recursive/,  @$opts, '.');
-            $pipe->reader(@cmd);
-            binmode($pipe, ":encoding(UTF-8)");
-            push @lines, $pipe->getlines;
-            $pipe->close;
+        # licensecheck --check is broken ( #842368 ), so --skipped option is useless.
+        # let's scan everything and skip later
+        foreach my $what (qw/check ignore/) {
+            my $data = $scan_data->{$what} or next;
+            my $reg = join(
+                '|' ,
+                (map { '\.'.$_.'$'} @{$data->{suffixes} || []}),
+                @{ $data->{pattern} || []},
+                $default{$what}
+            );
+            $regexps{$what} = qr/$reg/;
         }
+
+        my $pipe = IO::Pipe->new();
+        my @cmd = (qw/licensecheck --encoding utf8 --copyright --machine --recursive/,
+                   '--ignore='.$regexps{ignore}, '.');
+        $pipe->reader(@cmd);
+        binmode($pipe, ":encoding(UTF-8)");
+        @lines = $pipe->getlines;
+        $pipe->close;
     }
 
     my $fill_blank_data = __load_fill_blank_data($current_dir);

-- 
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