[Reproducible-commits] [dpkg] 47/74: dpkg-buildpackage: Refactor build target fallback code

Mattia Rizzolo mattia at debian.org
Sun Jul 3 22:22:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to annotated tag 1.18.8
in repository dpkg.

commit 5b3952a330c177b0f99c20c36b4ff2a0fb699be5
Author: Guillem Jover <guillem at debian.org>
Date:   Mon May 30 23:54:43 2016 +0200

    dpkg-buildpackage: Refactor build target fallback code
    
    Move this aside to not clutter the main code flow, to make it easier
    to add additional heuristics and to make clear what needs to be
    removed once the time comes.
---
 scripts/dpkg-buildpackage.pl | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 714f571..21602af 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -525,23 +525,9 @@ if (build_has_any(BUILD_SOURCE)) {
 
 run_hook('build', build_has_any(BUILD_BINARY));
 
-if ($buildtarget ne 'build' and scalar(@debian_rules) == 1) {
-    # Verify that build-{arch,indep} are supported. If not, fallback to build.
-    # This is a temporary measure to not break too many packages on a flag day.
-    my $pid = spawn(exec => [ 'make', '-f', @debian_rules, '-qn', $buildtarget ],
-                    from_file => '/dev/null', to_file => '/dev/null',
-                    error_to_file => '/dev/null');
-    my $cmdline = "make -f @debian_rules -qn $buildtarget";
-    wait_child($pid, nocheck => 1, cmdline => $cmdline);
-    my $exitcode = WEXITSTATUS($?);
-    subprocerr($cmdline) unless WIFEXITED($?);
-    if ($exitcode == 2) {
-        warning(g_("%s must be updated to support the 'build-arch' and " .
-                   "'build-indep' targets (at least '%s' seems to be " .
-                   'missing)'), "@debian_rules", $buildtarget);
-        $buildtarget = 'build';
-    }
-}
+# XXX Use some heuristics to decide whether to use build-{arch,indep} targets.
+# This is a temporary measure to not break too many packages on a flag day.
+build_target_fallback();
 
 if (build_has_any(BUILD_BINARY)) {
     withecho(@debian_rules, $buildtarget);
@@ -731,3 +717,24 @@ sub describe_build {
         return g_('full upload (original source is included)');
     }
 }
+
+sub build_target_fallback {
+    return if $buildtarget eq 'build';
+    return if scalar @debian_rules != 1;
+
+    # Check if the build-{arch,indep} targets are supported. If not, fallback
+    # to build.
+    my $pid = spawn(exec => [ 'make', '-f', @debian_rules, '-qn', $buildtarget ],
+                    from_file => '/dev/null', to_file => '/dev/null',
+                    error_to_file => '/dev/null');
+    my $cmdline = "make -f @debian_rules -qn $buildtarget";
+    wait_child($pid, nocheck => 1, cmdline => $cmdline);
+    my $exitcode = WEXITSTATUS($?);
+    subprocerr($cmdline) unless WIFEXITED($?);
+    if ($exitcode == 2) {
+        warning(g_("%s must be updated to support the 'build-arch' and " .
+                   "'build-indep' targets (at least '%s' seems to be " .
+                   'missing)'), "@debian_rules", $buildtarget);
+        $buildtarget = 'build';
+    }
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list