[debhelper-devel] [debhelper] 01/02: Refactor handling of $skip_install tests

Niels Thykier nthykier at moszumanska.debian.org
Wed Jun 28 13:03:54 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 b9d18f40621b54b7ac687fabb23983d0bea08621
Author: Niels Thykier <niels at thykier.net>
Date:   Wed Jun 28 12:59:37 2017 +0000

    Refactor handling of $skip_install tests
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Dh_Lib.pm | 14 +++++++++++++-
 dh_install                 |  2 +-
 dh_installman              |  3 +--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 15966b2..49c37c8 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -40,7 +40,7 @@ use vars qw(@EXPORT %dh);
             &nonquiet_print &print_and_doit &print_and_doit_noerror
             &warning &tmpdir &pkgfile &pkgext &pkgfilename &isnative
 	    &autoscript &filearray &filedoublearray &is_build_profile_active
-	    &getpackages &basename &dirname &xargs %dh
+	    &getpackages &basename &dirname &xargs %dh &process_pkg
 	    &compat &addsubstvar &delsubstvar &excludefile &package_arch
 	    &package_is_arch_all &package_binary_arch &package_declared_arch
 	    &is_udeb &debhelper_script_subst &escape_shell
@@ -1280,6 +1280,18 @@ sub is_udeb {
 	return $package_types{$package} eq 'udeb';
 }
 
+{
+	my %packages_to_process;
+
+	sub process_pkg {
+		my ($package) = @_;
+		if (not %packages_to_process) {
+			%packages_to_process = map { $_ => 1 } @{$dh{DOPACKAGES}};
+		}
+		return $packages_to_process{$package} // 0;
+	}
+}
+
 # Handles #DEBHELPER# substitution in a script; also can generate a new
 # script from scratch if none exists but there is a .debhelper file for it.
 sub debhelper_script_subst {
diff --git a/dh_install b/dh_install
index 0913c98..f3a72f1 100755
--- a/dh_install
+++ b/dh_install
@@ -160,7 +160,7 @@ foreach my $package (getpackages()) {
 	# Look at the install files for all packages to handle
 	# list-missing/fail-missing, but skip really installing for
 	# packages that are not being acted on.
-	my $skip_install=! grep { $_ eq $package } @{$dh{DOPACKAGES}};
+	my $skip_install = process_pkg($package) ? 0 : 1;
 
 	my $tmp=tmpdir($package);
 	my $file=pkgfile($package,"install");
diff --git a/dh_installman b/dh_installman
index 930152f..17c7633 100755
--- a/dh_installman
+++ b/dh_installman
@@ -130,7 +130,6 @@ on_items_in_parallel(\@all_packages, sub {
 
 		my $tmp = tmpdir($package);
 		my $file = pkgfile($package, "manpages");
-		my $skip_install = !grep { $_ eq $package } @{$dh{DOPACKAGES}};
 		my @manpages;
 
 		@manpages = filearray($file, ".") if $file;
@@ -141,7 +140,7 @@ on_items_in_parallel(\@all_packages, sub {
 
 		log_installed_files($package, @manpages);
 
-		next if $skip_install;
+		next if not process_pkg($package);
 
 		foreach my $page (@manpages) {
 			my $basename = basename($page);

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