diff options
author | Guillem Jover <guillem@debian.org> | 2016-05-30 23:54:43 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2016-07-03 21:02:20 +0200 |
commit | 5b3952a330c177b0f99c20c36b4ff2a0fb699be5 (patch) | |
tree | f8deb5bb1f184b6f207e1a256f92373329561862 /scripts/dpkg-buildpackage.pl | |
parent | 5dc74874e6cf26e01105d8b1798e39b8b8d9e126 (diff) | |
download | dpkg-5b3952a330c177b0f99c20c36b4ff2a0fb699be5.tar.gz |
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.
Diffstat (limited to 'scripts/dpkg-buildpackage.pl')
-rwxr-xr-x | scripts/dpkg-buildpackage.pl | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl index 714f571b8..21602afc5 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'; + } +} |