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

dpkg-buipdpackage: Do not use build target fallback on arch:any + arch:all

As part of the transition to make build-indep and build-arch mandatory
and to be able to remove the fallback code without needing a flag day,
we split the transition in chunks. This is the first one which is made
mandatory. More will come.
Guillem Jover лет назад: 10
Родитель
Сommit
ad94a98cf6
3 измененных файлов с 21 добавлено и 3 удалено
  1. 2 0
      debian/changelog
  2. 4 3
      man/dpkg-buildpackage.1
  3. 15 0
      scripts/dpkg-buildpackage.pl

+ 2 - 0
debian/changelog

@@ -37,6 +37,8 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
     by setting SOURCE_DATE_EPOCH environment variable if it is not already
     by setting SOURCE_DATE_EPOCH environment variable if it is not already
     defined. Based on a patch by Jérémy Bobbio <lunar@debian.org>.
     defined. Based on a patch by Jérémy Bobbio <lunar@debian.org>.
     Closes: #759999
     Closes: #759999
+  * Do not use the debian/rules build target fallback when building both
+    architecture independent and dependent packages in dpkg-buipdpackage.
   * Perl modules:
   * Perl modules:
     - Use warnings::warnif() instead of carp() for deprecated warnings.
     - Use warnings::warnif() instead of carp() for deprecated warnings.
     - Add new format_range() method and deprecate dpkg() and rfc822() methods
     - Add new format_range() method and deprecate dpkg() and rfc822() methods

+ 4 - 3
man/dpkg-buildpackage.1

@@ -496,9 +496,10 @@ by \fBdpkg\-buildflags\fP. This is no longer the case.
 \fBdpkg\-buildpackage\fP is using the \fBbuild\-arch\fP and
 \fBdpkg\-buildpackage\fP is using the \fBbuild\-arch\fP and
 \fBbuild\-indep\fP targets since dpkg 1.16.2. Those targets are thus
 \fBbuild\-indep\fP targets since dpkg 1.16.2. Those targets are thus
 mandatory. But to avoid breakages of existing packages, and ease
 mandatory. But to avoid breakages of existing packages, and ease
-the transition, it will fallback to using the \fBbuild\fP target
-if \fBmake \-f debian/rules \-qn\fP \fIbuild-target\fP returns 2 as
-exit code.
+the transition, if the source package does not build both architecture
+independent and dependent binary packages (since dpkg 1.18.8) it will
+fallback to use the \fBbuild\fP target if \fBmake \-f debian/rules \-qn\fP
+\fIbuild-target\fP returns 2 as exit code.
 .SH BUGS
 .SH BUGS
 It should be possible to specify spaces and shell metacharacters
 It should be possible to specify spaces and shell metacharacters
 and initial arguments for
 and initial arguments for

+ 15 - 0
scripts/dpkg-buildpackage.pl

@@ -722,6 +722,21 @@ sub build_target_fallback {
     return if $buildtarget eq 'build';
     return if $buildtarget eq 'build';
     return if scalar @debian_rules != 1;
     return if scalar @debian_rules != 1;
 
 
+    # Check if we are building both arch:all and arch:any packages, in which
+    # case we now require working build-indep and build-arch targets.
+    my $pkg_arch = 0;
+    my $ctrl = Dpkg::Control::Info->new();
+
+    foreach my $bin ($ctrl->get_packages()) {
+        if ($bin->{Architecture} eq 'all') {
+            $pkg_arch |= BUILD_ARCH_INDEP;
+        } else {
+            $pkg_arch |= BUILD_ARCH_DEP;
+        }
+    }
+
+    return if $pkg_arch == BUILD_BINARY;
+
     # Check if the build-{arch,indep} targets are supported. If not, fallback
     # Check if the build-{arch,indep} targets are supported. If not, fallback
     # to build.
     # to build.
     my $pid = spawn(exec => [ 'make', '-f', @debian_rules, '-qn', $buildtarget ],
     my $pid = spawn(exec => [ 'make', '-f', @debian_rules, '-qn', $buildtarget ],