[debhelper-devel] [debhelper] 01/01: dh: Support pkgfile and pkgfile-logged PROMISE hints

Niels Thykier nthykier at moszumanska.debian.org
Sun Jul 9 07:45:00 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 962d83ae8f2e191a3546147659602b55e5c444b3
Author: Niels Thykier <niels at thykier.net>
Date:   Wed Jul 5 10:24:40 2017 +0000

    dh: Support pkgfile and pkgfile-logged PROMISE hints
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog   |  6 ++++++
 dh                 | 11 +++++++++++
 dh_install         |  2 +-
 dh_installexamples |  2 +-
 dh_installman      |  2 +-
 doc/PROGRAMMING    |  7 ++++++-
 6 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e787bf5..350347c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,12 @@ debhelper (10.6.3) UNRELEASED; urgency=medium
     feature should set "$main::VERSION" to the version of the tool.
   * dh_install: Rewrite and re-enable optimization so it
     deterministically and gracefully handles cases like #866405.
+  * dh: Support new "pkgfile-logged" hint, which can be used by
+    helpers that log what files they install.  It enables dh to
+    see that it may need to run a helper that would install no
+    files, but log what it would have done to avoid making
+    dh_missing complain.  Thanks to Michael Stapelberg for
+    reporting the issue and testing the fix.  (Closes: #867246)
 
  -- Niels Thykier <niels at thykier.net>  Wed, 05 Jul 2017 15:51:48 +0000
 
diff --git a/dh b/dh
index e6d81cd..8f26824 100755
--- a/dh
+++ b/dh
@@ -1039,6 +1039,7 @@ sub can_skip {
 	}
 	my @skipinfo=@{$skipinfo{$command}};
 	return 0 unless @skipinfo;
+	my $all_pkgs;
 
 	foreach my $skipinfo (@skipinfo) {
 		if ($skipinfo=~/^([a-zA-Z0-9-_]+)\((.*)\)$/) {
@@ -1049,6 +1050,16 @@ sub can_skip {
 					my $tmp = tmpdir($package);
 					return 0 if -e "$tmp/$need";
 				}
+			} elsif ($type eq 'pkgfile' or $type eq 'pkgfile-logged') {
+				my $pkgs;
+				if ($type eq 'pkgfile') {
+					$pkgs = \@packages;
+				} else {
+					$all_pkgs //= [getpackages()];
+					$pkgs = $all_pkgs;
+				}
+				# Use the secret bulk check call
+				return 0 if pkgfile($pkgs, $need) ne '';
 			} else {
 				# Unknown hint - make no assumptions
 				return 0;
diff --git a/dh_install b/dh_install
index 138498b..7422c45 100755
--- a/dh_install
+++ b/dh_install
@@ -157,7 +157,7 @@ if ($dh{EXCLUDE_FIND}) {
 my @search_dirs = ($srcdir);
 push(@search_dirs, 'debian/tmp') if not compat(6);
 
-# PROMISE: DH NOOP WITHOUT install
+# PROMISE: DH NOOP WITHOUT pkgfile-logged(install)
 
 foreach my $package (getpackages()) {
 	my (@installed, %dest2sources);
diff --git a/dh_installexamples b/dh_installexamples
index 530e03d..6f0e806 100755
--- a/dh_installexamples
+++ b/dh_installexamples
@@ -75,7 +75,7 @@ init(options => {
 	"sourcedir=s" => \$dh{SOURCEDIR},
 });
 
-# PROMISE: DH NOOP WITHOUT examples
+# PROMISE: DH NOOP WITHOUT pkgfile-logged(examples)
 
 my $pwd;
 my @search_dirs = ('.');
diff --git a/dh_installman b/dh_installman
index 7260660..afa8ffd 100755
--- a/dh_installman
+++ b/dh_installman
@@ -136,7 +136,7 @@ init(options => {
 });
 
 
-# PROMISE: DH NOOP WITHOUT manpages tmp(usr/share/man)
+# PROMISE: DH NOOP WITHOUT pkgfile-logged(manpages) tmp(usr/share/man)
 
 my (@sofiles, @sodests);
 my @all_packages = getpackages();
diff --git a/doc/PROGRAMMING b/doc/PROGRAMMING
index 0cbe21a..a6b47fe 100644
--- a/doc/PROGRAMMING
+++ b/doc/PROGRAMMING
@@ -210,7 +210,12 @@ pkgfile($package, $basename)
 	skip running it. This is done by inserting a special comment,
 	of the form:
 
-	# PROMISE: DH NOOP WITHOUT pkgfilea pkgfileb tmp(need/this)
+	# PROMISE: DH NOOP WITHOUT pkgfilea pkgfile-logged(pkgfileb) tmp(need/this)
+
+	The "pkgfile-logged" hint notifies dh that the helper logs these files
+	via "log_intalled_files".  This means dh will sometimes need to run it
+	even when it is a NO OP because it has to log what it would have
+	installed to avoid dh_missing complaining about missing files.
 
 pkgext($package)
 	Pass this command the name of a binary package, and it will return

-- 
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