summaryrefslogtreecommitdiff
path: root/dh
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2011-06-12 20:22:43 +0100
committerJoey Hess <joey@kitenet.net>2011-06-13 15:35:32 -0400
commit99ad2a71e45b1d015bd4539ba093a9fae9fbf53b (patch)
tree4c4120f9cd405e055dbf5e21da6a88d94bb3f61c /dh
parent11ca8d1fc9eece1621f612f8be6c13b3aed8eeb7 (diff)
dh: Use minimal sequences if delegating work
The build and install rules run a minimal sequence if the build-arch or build-indep, or install-arch or install-indep targets, respectively, are present in debian/rules. The purpose is to not do work ahead of time, such as building before the build-arch or build-indep targets are built, which could potentially lead to misbuilds. If the targets are not defined, the sequences may be run directly which is faster due to being able to run the arch and indep commands together.
Diffstat (limited to 'dh')
-rwxr-xr-xdh24
1 files changed, 24 insertions, 0 deletions
diff --git a/dh b/dh
index 75070ea8..8af408c4 100755
--- a/dh
+++ b/dh
@@ -338,6 +338,10 @@ if (is_make_jobserver_unavailable()) {
# Definitions of sequences.
my %sequences;
+my @bd_minimal = qw{
+ dh_testdir
+ dh_auto_configure
+};
my @bd = qw{
dh_testdir
dh_auto_configure
@@ -357,6 +361,9 @@ $sequences{clean} = [qw{
dh_auto_clean
dh_clean
}];
+my @i_minimal = qw{
+ dh_testroot
+};
my @i = qw{
dh_testroot
dh_prep
@@ -550,6 +557,23 @@ elsif (! exists $sequences{$sequence}) {
error "Unknown sequence $sequence (choose from: ".
join(" ", sort keys %sequences).")";
}
+
+# Note: it's not safe to run rules_explicit_target before this point
+# due to dh being recursively invoked with debhelper-fail-me as the
+# sequence
+# If debian/rules defines build-arch or build-indep, run sequences
+# separately.
+if (rules_explicit_target('build-arch') ||
+ rules_explicit_target('build-indep')) {
+ $sequences{build} = [@bd_minimal, 'rules:build-arch', 'rules:build-indep'];
+}
+# If debian/rules defines install-arch or install-indep, run sequences
+# separately.
+if (rules_explicit_target('install-arch') ||
+ rules_explicit_target('install-indep')) {
+ $sequences{'install'} = ['rules:build', @i_minimal, 'rules:install-arch', 'rules:install-indep'];
+}
+
my @sequence=@{$sequences{$sequence}};
# The list of all packages that can be acted on.