summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2017-07-23 09:43:38 +0000
committerNiels Thykier <niels@thykier.net>2017-07-23 09:47:19 +0000
commit16004f4e7d33a2303e5f1cc7461ba8dd0ca19c21 (patch)
treee8b51d6e1edaaee288b3d89f3f6eb5a37c96c67d
parent063c761fda757ef24ff43f57911f4f461c8fd0dc (diff)
downloaddebhelper-16004f4e7d33a2303e5f1cc7461ba8dd0ca19c21.tar.gz
dh: Rely on PROMISE NOOP to exclude dh_testdir
Turns out that some debhelper sequences try to inject themselves *before* dh_testdir. Concretely, dh-di (--with d-i) being an example. While I find the use rather questionable at first glance, I am not going to break their code. Signed-off-by: Niels Thykier <niels@thykier.net>
-rwxr-xr-xdh10
-rwxr-xr-xdh_testdir7
2 files changed, 13 insertions, 4 deletions
diff --git a/dh b/dh
index 01ef8d96..d7fb4184 100755
--- a/dh
+++ b/dh
@@ -370,9 +370,9 @@ if ($sequence eq 'debian/rules' ||
# Definitions of sequences.
my $build_stamp_file = 'debian/debhelper-build-stamp';
my %sequences;
-my @bd_minimal = compat(10) ? qw{
+my @bd_minimal = qw{
dh_testdir
-} : ();
+};
my @bd = (@bd_minimal, qw{
dh_update_autotools_config
dh_auto_configure
@@ -1041,6 +1041,7 @@ sub can_skip {
}
my @skipinfo=@{$skipinfo{$command}};
return 0 unless @skipinfo;
+ return 1 if scalar(@skipinfo) == 1 and $skipinfo[0] eq 'always-skip';
my $all_pkgs;
foreach my $skipinfo (@skipinfo) {
@@ -1080,9 +1081,10 @@ sub extract_skipinfo {
foreach my $dir (split (':', $ENV{PATH})) {
if (open (my $h, "<", "$dir/$command")) {
while (<$h>) {
- if (m/PROMISE: DH NOOP WITHOUT\s+(.*)/) {
+ if (m/PROMISE: DH NOOP( WITHOUT\s+(.*))?/) {
close $h;
- return split(' ', $1);
+ return split(' ', $2) if defined($2);
+ return ('always-skip');
}
}
close $h;
diff --git a/dh_testdir b/dh_testdir
index 4fb5a9cf..1ba0c858 100755
--- a/dh_testdir
+++ b/dh_testdir
@@ -35,6 +35,13 @@ Test for the existence of these files too.
=cut
+# This command is completely useless when called from dh(1) as dh will
+# have attempted to read d/control before it even constructs the
+# command sequences. Accordingly, there is no doubt that the
+# following is unconditionally true:
+#
+# PROMISE: DH NOOP
+
# Run before init because init will try to read debian/control and
# we want a nicer error message.
checkfile('debian/control');