[debhelper-devel] [debhelper] 01/01: dh: Rely on PROMISE NOOP to exclude dh_testdir

Niels Thykier nthykier at moszumanska.debian.org
Sun Jul 23 09:48:02 UTC 2017


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

nthykier pushed a commit to branch master
in repository debhelper.

commit 16004f4e7d33a2303e5f1cc7461ba8dd0ca19c21
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Jul 23 09:43:38 2017 +0000

    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 at thykier.net>
---
 dh         | 10 ++++++----
 dh_testdir |  7 +++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/dh b/dh
index 01ef8d9..d7fb418 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 4fb5a9c..1ba0c85 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');

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




More information about the debhelper-devel mailing list