[libconfig-model-dpkg-perl] 04/11: Dpkg::Copyright: improved handling of fix.scanned.copyright file

dod at debian.org dod at debian.org
Fri Mar 20 16:25:53 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 8634674260c5708a3ce88aede176c42a679e467b
Author: Dominique Dumont <dod at debian.org>
Date:   Mon Mar 16 19:10:16 2015 +0100

    Dpkg::Copyright: improved handling of fix.scanned.copyright file
---
 lib/Config/Model/Dpkg/Copyright.pm | 40 +++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/lib/Config/Model/Dpkg/Copyright.pm b/lib/Config/Model/Dpkg/Copyright.pm
index d789aed..8d8b466 100644
--- a/lib/Config/Model/Dpkg/Copyright.pm
+++ b/lib/Config/Model/Dpkg/Copyright.pm
@@ -116,15 +116,17 @@ sub update ($self, %args) {
        }
     }
 
-    # read a debian/fix.copyright file to patch scanned data
-    my $fix = path('debian')->child('fix-scanned-copyright');
-    if ($fix->exists) {
-        foreach my $l ( $fix->lines) {
-            $self->load( $l );
-        }
+    # read a debian/fix.scanned.copyright file to patch scanned data
+    my $current_dir = $args{from_dir} || path('.');
+    my @fixes = $current_dir->child('debian')->children(qr/fix\.scanned\.copyright$/);
+    say "Found @fixes files for copyright fixes";
+    foreach my $fix ( @fixes) {
+        my @l = grep { /[^\s]/ } grep { ! m!^(#|//)!  } $fix->lines_utf8;
+        chomp @l;
+        say "loading: @l";
+        $self->load( "@l" );
     }
 
-
     return ''; # improve returned message ?
 }
 
@@ -190,7 +192,9 @@ Note: this command is experimental.
 Since the extraction of copyright information from source file is
 based on comments, the result is sometimes lackluster. Your may
 specify instruction to alter or set specific copyright entries in
-C<debian/fix.copyright> file. Each line of this file will be handled
+C<debian/fix.scanned.copyright> file
+(or C<< debian/<source-package>.fix.scanned.copyright>>).
+Each line of this file will be handled
 by L<Config::Model::Loader> to modify copyright information.
 
 =head2 Example
@@ -203,12 +207,30 @@ If the extracted copyright contains:
 
 You may add this line in C<debian/fix.copyright> file:
 
- Files:'*' Copyright=~s/\s*".*//
+ ! Files:'*' Copyright=~s/\s*".*//
 
 This way, the copyright information will be updated from the file
 content but the extra C<"foobar> will always be removed during
 updates.
 
+Comment are accepted in Perl and C++ style from the beginning of the line.
+Lines breaks are ignored.
+
+Here's another more complex example:
+
+ // added a global license, MIT license text is filled by Config::Model
+ ! copyright License:MIT
+
+ # don't forget '!' to go back to tree root
+ ! copyright Files:"pan/general/map-vector.h" Copyright="2001,Andrei Alexandrescu"
+   License short_name=MIT
+ # delete license text since short_name points to global  MIT license
+   full_license~
+
+ # use a loop there vvvvvv to clean up that vvvvvvvvvvvvvvvvvvvvvvv in all copyrights
+ ! copyright   Files:~/.*/     Copyright=~s/all\s*rights\s*reserved//i
+
+
 =head1 AUTHOR
 
 Dominique Dumont <dod at debian.org>

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