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 7e73f5142f5e73520e0a478d172571d529b918c1
Author: Dominique Dumont <d...@debian.org>
Date:   Fri Feb 12 19:11:22 2016 +0100

    preserve comments during copyright upgrades
---
 lib/Config/Model/Dpkg/Copyright.pm                            |  7 +++++--
 .../debian/fix.scanned.copyright                              |  2 +-
 t/model_tests.d/dpkg-examples/rakudo-star/debian/copyright    |  7 +++++++
 t/model_tests.d/dpkg-test-conf.pl                             | 11 ++++++-----
 4 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/lib/Config/Model/Dpkg/Copyright.pm 
b/lib/Config/Model/Dpkg/Copyright.pm
index 9ca8765..9310111 100644
--- a/lib/Config/Model/Dpkg/Copyright.pm
+++ b/lib/Config/Model/Dpkg/Copyright.pm
@@ -84,14 +84,14 @@ sub update ($self, %args) {
 
     # explode new data and merge with existing entries
     my %new_split_files;
-    my @data = (''); # id 0 is reserved for entries without info
+    my @data = (undef);# id 0 is reserved for entries without info
     my %data_keys;
     foreach my $path ( sort keys $files->%* ) {
         my $id = $files->{$path};
         next if $id == 0 and not defined $copyrights_by_id->[$id];
         my ($c, $l) = $copyrights_by_id->[$id]->@*;
 
-        my $new_data = dclone (delete $old_split_files{$path} || {} );
+        my $new_data = _get_old_data(\%old_split_files, \%old_split_dirs, 
$path);
         my $old_cop = $new_data->{Copyright};
         my $old_lic = $new_data->{License}{short_name};
         # $self->_say( "load '$path' with '$c' ('$l') old '$old_cop' 
('$old_lic')");
@@ -174,6 +174,9 @@ sub update ($self, %args) {
     # load new data in config tree
     foreach my $p (@packed) {
         my ($id, @paths) = $p->@*;
+
+        next if $id == 0; # skip entries without info
+
         my $datum = dclone($data[$id]);
 
         # ditch old data when copyright data directory is found in source files
diff --git 
a/t/model_tests.d/dpkg-examples/pan-copyright-upgrade-update-more/debian/fix.scanned.copyright
 
b/t/model_tests.d/dpkg-examples/pan-copyright-upgrade-update-more/debian/fix.scanned.copyright
index 3be6a26..27b08b2 100644
--- 
a/t/model_tests.d/dpkg-examples/pan-copyright-upgrade-update-more/debian/fix.scanned.copyright
+++ 
b/t/model_tests.d/dpkg-examples/pan-copyright-upgrade-update-more/debian/fix.scanned.copyright
@@ -1,3 +1,3 @@
 ! copyright Files:"pan/general/map-vector.h" 
Copyright=~"s/\n.*Addison-Wesley//"
 ! copyright Files:~pan/gui/e-charset.c Copyright=~"s/\s\(.*\)//"
-! copyright Files:"uulib/*" Copyright=~"s/\s+The.*//"
+! copyright Files:"*" Copyright=~"s/\s+The.*//"
diff --git a/t/model_tests.d/dpkg-examples/rakudo-star/debian/copyright 
b/t/model_tests.d/dpkg-examples/rakudo-star/debian/copyright
index a095eb6..a9940be 100644
--- a/t/model_tests.d/dpkg-examples/rakudo-star/debian/copyright
+++ b/t/model_tests.d/dpkg-examples/rakudo-star/debian/copyright
@@ -10,6 +10,9 @@ Files: debian/*
 Copyright:
  2015 Dominique Dumont <d...@debian.org>
 License: Artistic-2.0
+Comment:
+ comments should be preserved by cme update.
+ Need to check that
 
 Files: modules/*
 Copyright: 2010, 2012-2015, Tadeusz SoĊ›nierz
@@ -18,6 +21,10 @@ License: Expat
 Files: modules/DBIish/*
 Copyright: 2009-2012, the DBIish contributors
 License: BSD-2-clause
+Comment:
+ comments should be preserved by cme update.
+ Need to check that
+
 
 Files: modules/Perl6-MIME-Base64/*
 Copyright: Adrian White
diff --git a/t/model_tests.d/dpkg-test-conf.pl 
b/t/model_tests.d/dpkg-test-conf.pl
index f547e51..284b9d9 100644
--- a/t/model_tests.d/dpkg-test-conf.pl
+++ b/t/model_tests.d/dpkg-test-conf.pl
@@ -87,7 +87,7 @@ my $del_home = sub {
             => '2002, Martin Holzherr (holzh...@infobrain.com).',
             'copyright Files:pan/general/sorted-vector.h License short_name' 
=> 'public-domain',
             # entry "uulib/fptools.c\n uulib/fptools.h"is packed by update
-            qq'copyright Files:"uulib/*" Copyright' => '1994-2001, Frank 
Pilhofer.',
+            qq'copyright Files:"*" Copyright' => '1994-2001, Frank Pilhofer.',
             'copyright Files:pan/gui/xface.c Copyright' => qr/^James/,
         },
         wr_check => {
@@ -112,13 +112,13 @@ my $del_home = sub {
             'copyright Files:pan/general/sorted-vector.h Copyright'
             => '2002, Martin Holzherr (holzh...@infobrain.com).',
             'copyright Files:pan/general/sorted-vector.h License short_name' 
=> 'public-domain',
-            qq'copyright Files:"uulib/*" Copyright' => '1994-2001, Frank 
Pilhofer.',
+            qq'copyright Files:"*" Copyright' => '1994-2001, Frank Pilhofer.',
         },
         has_key => {
-            'copyright Files' => ['*','uulib/*'],
+            'copyright Files' => ['*'],
         },
         has_not_key => {
-            'copyright Files' => 'pan/data/*',
+            'copyright Files' => ['pan/data/*','uulib/*'],
         },
         wr_check => {
             "copyright License:GPL-2 text" => {value => undef, mode => 
'custom'},
@@ -178,7 +178,8 @@ my $del_home = sub {
         update => { in => path('t/scanner/examples/rakudo-star.in'), quiet => 
1 },
         no_warnings => 1,
         check => {
-          'copyright Files:"modules/Perl6-MIME-Base64/*" Copyright' => 'Adrian 
White'
+            'copyright Files:"modules/Perl6-MIME-Base64/*" Copyright' => 
'Adrian White',
+            'copyright Files:"modules/DBIish/*" Comment' => qr/should be 
preserved by cme update/,
         },
         file_check_sub => $del_home,
     },

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to