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 86bd234f7781f5502a2ec6e6ee1e8fed0f984be7
Author: Dominique Dumont <d...@debian.org>
Date:   Sat Dec 26 17:52:32 2015 +0100

    CMD::Copyright: better preserve dir info during update
---
 lib/Config/Model/Dpkg/Copyright.pm | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/lib/Config/Model/Dpkg/Copyright.pm 
b/lib/Config/Model/Dpkg/Copyright.pm
index e33374b..2fc6bff 100644
--- a/lib/Config/Model/Dpkg/Copyright.pm
+++ b/lib/Config/Model/Dpkg/Copyright.pm
@@ -139,6 +139,7 @@ sub update ($self, %args) {
     # load new data in config tree
     foreach my $p (@packed) {
         my ($id, @paths) = $p->@*;
+        my $datum = dclone($data[$id]);
 
         # ditch old data when copyright data directory is found in source files
         if ($paths[0] =~ /[*.]$/) {
@@ -148,7 +149,22 @@ sub update ($self, %args) {
             my $p = $paths[0];
             $p =~ s/\.$/*/;
             my $old_data = delete $preserved_path{$p};
-            $self->_say( "old dir data for $p overridden") if $old_data;
+
+            if ($old_data) {
+                my $overridden = 1;
+                if ($datum->{Copyright} =~ /unknown|no-info-found/i) {
+                    $self->_say( "keeping copyright dir data for $p");
+                    $datum->{Copyright} = $old_data->{Copyright};
+                    $overridden = 0;
+                }
+                if ($datum->{License}{short_name} =~ /unknown|no-info-found/i) 
{
+                    $self->_say( "keeping license dir data for $p");
+                    $datum->{License}{short_name} = 
$old_data->{License}{short_name};
+                    $datum->{License}{full_license} = 
$old_data->{License}{full_license};
+                    $overridden = 0;
+                }
+                $self->_say( "old dir data for $p overridden") if $overridden;
+            }
 
             # skip writing data because it duplicates information
             # found in directory above above (as shown the path ending
@@ -156,7 +172,6 @@ sub update ($self, %args) {
             next if $paths[0] =~ /\.$/;
         };
 
-        my $datum = dclone($data[$id]);
         my $path_str = $self->normalize_path(\@paths);
         my $l = $datum->{License}{short_name};
 

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