ソースを参照

dpkg-genchanges: Fold dist filtering and checksumming into initial loop

We should not include architectures for artifacts we are not going to
distribute. And we should not recompute the checksums for artifacts we
have already computed.
Guillem Jover 9 年 前
コミット
fbc87b7454
共有2 個のファイルを変更した13 個の追加11 個の削除を含む
  1. 4 0
      debian/changelog
  2. 9 11
      scripts/dpkg-genchanges.pl

+ 4 - 0
debian/changelog

@@ -26,6 +26,10 @@ dpkg (1.18.19) UNRELEASED; urgency=medium
     supported. Closes: #848705
   * Add again the architecture from the filename to .changes files for any
     artifact with one. This reverts the change introduced in dpkg 1.18.11.
+  * Fold the filtering and checksumming of files to distribute in a .changes
+    file in dpkg-genchanges into the initial loop. This way we do not include
+    architectures for artifacts we are not going to distribute, and do not
+    unnecessarily recompute the checksums for artifacts like the sources.
   * Portability:
     - On GNU/Hurd try to use the new process executable name attribute from
       libps, to properly match on start-stop-daemon --exec.

+ 9 - 11
scripts/dpkg-genchanges.pl

@@ -309,16 +309,25 @@ error(g_('binary build with no binary artifacts found; cannot distribute'))
     if build_has_any(BUILD_BINARY) && $dist_count == 0;
 
 foreach my $file ($dist->get_files()) {
+    my $f = $file->{filename};
+
     # If this is a source-only upload, ignore any other artifacts.
     next if build_has_none(BUILD_BINARY);
 
     if (defined $file->{arch}) {
+        my $arch_all = debarch_eq('all', $file->{arch});
+
+        next if build_has_none(BUILD_ARCH_INDEP) and $arch_all;
+        next if build_has_none(BUILD_ARCH_DEP) and not $arch_all;
+
         push @archvalues, $file->{arch} if not $archadded{$file->{arch}}++;
     }
     if (defined $file->{package} && $file->{package_type} =~ m/^u?deb$/) {
         $p2f{$file->{package}} //= [];
         push @{$p2f{$file->{package}}}, $file->{filename};
     }
+
+    $checksums->add_from_file("$uploadfilesdir/$f", key => $f);
 }
 
 # Scan control info of all binary packages
@@ -461,17 +470,6 @@ $fields->{'Description'} = "\n" . join("\n", sort @descriptions);
 
 $fields->{'Files'} = '';
 
-for my $file ($dist->get_files()) {
-    my $f = $file->{filename};
-
-    if (defined $file->{package} && $file->{package_type} =~ m/^u?deb$/) {
-        my $arch_all = debarch_eq('all', $file->{arch});
-
-        next if build_has_none(BUILD_ARCH_INDEP) and $arch_all;
-        next if build_has_none(BUILD_ARCH_DEP) and not $arch_all;
-    }
-    $checksums->add_from_file("$uploadfilesdir/$f", key => $f);
-}
 foreach my $f ($checksums->get_files()) {
     my $file = $dist->get_file($f);