Explorar o código

dpkg-genchanges: Clarify error message on binary builds w/o binaries

Only load the files list file if it exists, so that we can check if
there's any binary file being distributed.

When all binary packages are for different architectures than the
requested one, and no additional files have been shipped for
distribution (via dpkg-distaddfile), we should error out early and
with a better and more clear error, than just "no files list file found".

Closes: #726520
Guillem Jover %!s(int64=12) %!d(string=hai) anos
pai
achega
9947ec14e5
Modificáronse 2 ficheiros con 8 adicións e 1 borrados
  1. 2 0
      debian/changelog
  2. 6 1
      scripts/dpkg-genchanges.pl

+ 2 - 0
debian/changelog

@@ -25,6 +25,8 @@ dpkg (1.17.7) UNRELEASED; urgency=low
     Closes: #735975
   * Do not generate perl warnings on undef versions in
     Dpkg::Deps::deps_compare(). See: #737731
+  * Clarify dpkg-genchanges error message on binary builds without any binary
+    artifact built. Closes: #726520
 
   [ Updated dpkg translations ]
   * German (Sven Joachim).

+ 6 - 1
scripts/dpkg-genchanges.pl

@@ -240,7 +240,12 @@ if (defined($prev_changelog) and
 my $dist = Dpkg::Dist::Files->new();
 
 if (not is_sourceonly) {
-    $dist->load($fileslistfile);
+    my $dist_count = 0;
+
+    $dist_count = $dist->load($fileslistfile) if -e $fileslistfile;
+
+    error(_g('binary build with no binary artifacts found; cannot distribute'))
+        if $dist_count == 0;
 
     foreach my $file ($dist->get_files()) {
         if (defined $file->{package} && $file->{package_type} =~ m/^u?deb$/) {