[libconfig-model-dpkg-perl] 06/23: scanner: skip files which are not in check list

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 a58c6fb092f9d5ddaa06aafbb6b254a619b22f6f
Author: Dominique Dumont <dod at debian.org>
Date:   Tue Jan 24 13:10:59 2017 +0100

    scanner: skip files which are not in check list
    
    Skipped files are the file scanned by licencecheck but not part of the
    check regexp. This regexp is made of default check plus the ones
    specified by the user.
    
    The default check list now includes scripts and README.* AUTHORS,
    COPYING files...
    
    COPYING files in removed from pan.in to fix tests, otherwise the bogus
    copyright becomes the main copyright of pan. Removing this line emulates
    the fact that COPYING would be added in ignore list for pan.
---
 lib/Dpkg/Copyright/Scanner.pm | 18 +++++++++++++++++-
 t/scanner/examples/pan.in     |  1 -
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lib/Dpkg/Copyright/Scanner.pm b/lib/Dpkg/Copyright/Scanner.pm
index 82a08bb..88182b6 100644
--- a/lib/Dpkg/Copyright/Scanner.pm
+++ b/lib/Dpkg/Copyright/Scanner.pm
@@ -110,7 +110,8 @@ EOR
 
 # also from licensecheck
 $default{check} = << 'EOR2' ;
-    ^(?i:readme|license|copying)
+    (^|/)\w+$                 # scripts, AUTHORS files
+    |^README                   # README.* files
     |\.(                          # search for file suffix
         c(c|pp|xx)?              # c and c++
        |h(h|pp|xx)?              # header files for c and c++
@@ -204,6 +205,7 @@ sub scan_files ( %args ) {
     my $files = {};
     my $id = 1;
     my @no_info_list;
+    my @skipped;
 
     foreach my $line (sort @lines) {
         chomp $line;
@@ -212,6 +214,10 @@ sub scan_files ( %args ) {
         $f =~ s!\./!!;
         next if $f =~ m!debian/(copyright|changelog)$!; # too confusing
         next if $files->{$f}; # file already parsed
+        if ($regexps{check} and $f !~ $regexps{check}) {
+            push @skipped, $f if $regexps{ignore} and $f !~ $regexps{ignore};
+            next;
+        }
 
         $l =~ s/([*?\\])/\\$1/g;
         $l =~ s/\s*\(unversioned\/unknown version\)//g;
@@ -282,6 +288,16 @@ sub scan_files ( %args ) {
         # say "Storing '$f' : '$c' '$l' has_info: $has_info id ".$files->{$f};
     }
 
+    if (@skipped) {
+        my $msg= "The following files were skipped:\n";
+        map {
+             $msg .= "- $_\n";
+         } @skipped;
+        $msg .= "You may want to add a line in debian/copyright-scan-patterns.yml\n"
+            ."or ask the author to add more default patterns to scan\n\n";
+        _warn $msg;
+    }
+
     if (@no_info_list) {
         my $msg= "The following paths are missing information:\n";
         map {my ($p, at i) = $_->@*;
diff --git a/t/scanner/examples/pan.in b/t/scanner/examples/pan.in
index 68a515d..aa6089f 100644
--- a/t/scanner/examples/pan.in
+++ b/t/scanner/examples/pan.in
@@ -233,5 +233,4 @@
 ./README.mingw	UNKNOWN	*No copyright*
 ./README.windows	UNKNOWN	*No copyright*
 ./pan/gui/license.h	UNKNOWN	the software, and\n\ / 1989, 1991 Free Software Foundation, Inc.\n\
-./COPYING	UNKNOWN	the software, and / 1989, 1991 Free Software Foundation, Inc
 ./README	UNKNOWN	*No copyright*

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