[libconfig-model-dpkg-perl] 22/33: Scanner: extract __swap_merged_ids from __squash_copyright_years

dod at debian.org dod at debian.org
Mon Mar 30 17:41:43 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 e80ff7ba10209e10ec47689388a955a9d338f242
Author: Dominique Dumont <dod at debian.org>
Date:   Sat Mar 28 11:05:10 2015 +0100

    Scanner: extract __swap_merged_ids from __squash_copyright_years
---
 lib/Dpkg/Copyright/Scanner.pm      | 10 ++++++----
 t/scanner/squash_copyright_years.t |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/Dpkg/Copyright/Scanner.pm b/lib/Dpkg/Copyright/Scanner.pm
index df98c1c..986eb32 100644
--- a/lib/Dpkg/Copyright/Scanner.pm
+++ b/lib/Dpkg/Copyright/Scanner.pm
@@ -131,7 +131,9 @@ sub scan_files ( %args ) {
 
     say "No copyright information found" unless keys %$files;
 
-    __squash_copyrights_years ($files, \@copyrights_by_id) ;
+    my $merged_c_info = __squash_copyrights_years (\@copyrights_by_id) ;
+    # replace the old ids with news ids
+    __swap_merged_ids($files, $merged_c_info);
 
     # regroup %files hash: all leaves have same id -> wild card
     my $squashed = __squash($files);
@@ -220,7 +222,7 @@ sub __pack_dir ($h, $pack, @path) {
 # find ids that can be merged together in a single directory.
 # I.e. merge entries with same license and same set of owners. In this
 # case the years are merged together.
-sub __squash_copyrights_years ($files, $copyrights_by_id) {
+sub __squash_copyrights_years ($copyrights_by_id) {
 
     my %id_year_by_same_owner_license;
     for (my $id = 0; $id < $#$copyrights_by_id; $id++ ) {
@@ -272,8 +274,8 @@ sub __squash_copyrights_years ($files, $copyrights_by_id) {
             $merged_c_info[$id] = $new_id;
         }
     }
-    # replace the old ids with news ids
-    __swap_merged_ids($files, \@merged_c_info);
+
+    return \@merged_c_info;
 }
 
 sub __swap_merged_ids ($files, $merged_c_info) {
diff --git a/t/scanner/squash_copyright_years.t b/t/scanner/squash_copyright_years.t
index 2bb636a..ca6c9da 100644
--- a/t/scanner/squash_copyright_years.t
+++ b/t/scanner/squash_copyright_years.t
@@ -55,7 +55,8 @@ my @copyright_by_id = (
 foreach my $t (@tests) {
     my ($label,$in,$expect) = @$t;
     my $h = Load($in);
-    Dpkg::Copyright::Scanner::__squash_copyrights_years($h, \@copyright_by_id);
+    my $info = Dpkg::Copyright::Scanner::__squash_copyrights_years(\@copyright_by_id);
+    Dpkg::Copyright::Scanner::__swap_merged_ids($h, $info);
     eq_or_diff(
         $h,
         ref($expect) ? $expect : Load($expect),

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