Просмотр исходного кода

dpkg-buildpackage: Fallback to one job on unknown number of online processors

On unsupported or exotic systems where we might be unable to retrieve
the number of online processors and have been requested to infer them
ourselves via the --jobs or --jobs-try “auto” argument, default to
serial execution instead of unlimited jobs, to be on the safe side.

Proposed-by: Simon McVittie <smcv@debian.org>
Guillem Jover лет назад: 9
Родитель
Сommit
4c217aee7a
3 измененных файлов с 9 добавлено и 1 удалено
  1. 4 0
      debian/changelog
  2. 2 1
      man/dpkg-buildpackage.man
  3. 3 0
      scripts/dpkg-buildpackage.pl

+ 4 - 0
debian/changelog

@@ -11,6 +11,10 @@ dpkg (1.18.15) UNRELEASED; urgency=medium
   * Generate deterministic .buildinfo filenames in dpkg-genbuildinfo,
     following the same pattern as used for .changes files.
   * Bump .buildinfo Format to version 0.2.
+  * Change dpkg-buildpackage -j and -J on “auto” mode to fallback to serial
+    execution when we cannot infer the number of online processors on
+    unsupported or exotic systems. This should be a safer mode of operation.
+    Proposed by Simon McVittie <smcv@debian.org>.
   * Perl modules:
     - Validate architecture arguments in Dpkg::Deps deps_parse().
       Prompted by Johannes Schauer <josch@debian.org>.

+ 2 - 1
man/dpkg-buildpackage.man

@@ -246,7 +246,8 @@ The \fB\-j\fP value will override the \fBparallel=\fP\fIjobs\fP or
 Note that the \fBauto\fP value will get replaced by the actual number of
 currently active processors, and as such will not get propagated to any
 child process. If the number of online processors cannot be inferred then
-the code will fallback to using an unlimited number.
+the code will fallback to using serial execution (since dpkg 1.18.15),
+although this should only happen on exotic and unsupported systems.
 .TP
 .BR \-J ", " \-\-jobs\-try [=\fIjobs\fP|\fBauto\fP]
 This option (since dpkg 1.18.2, long option since dpkg 1.18.8) is equivalent

+ 3 - 0
scripts/dpkg-buildpackage.pl

@@ -393,6 +393,9 @@ if (defined $parallel) {
         $parallel = qx(getconf _NPROCESSORS_ONLN 2>/dev/null);
         # Fallback for at least Irix.
         $parallel = qx(getconf _NPROC_ONLN 2>/dev/null) if $?;
+        # Fallback to serial execution if cannot infer the number of online
+        # processors.
+        $parallel = '1' if $?;
         chomp $parallel;
     }
     if ($parallel_force) {