[debhelper-devel] [debhelper] 06/06: pkgfile: Create a "secret" bulk check call for dh

Niels Thykier nthykier at moszumanska.debian.org
Mon Apr 10 17:39:29 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 666528ef23590cbb88a346bafcf29f58bff472ef
Author: Niels Thykier <niels at thykier.net>
Date:   Mon Apr 10 17:18:55 2017 +0000

    pkgfile: Create a "secret" bulk check call for dh
    
    With "enough" packages, pkgfile is still a very expensive part of dh.
    Mostly due to the can_skip check which often need to call pkgfile to
    determine if a helper can be skipped.  By doing a "bulk check" we can
    reduce that overhead by about roughly 50% (20-25% of dh's total
    runtime).
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Dh_Lib.pm | 39 +++++++++++++++++++++++++++------------
 dh                         |  5 ++---
 2 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 690f91c..796c866 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -546,19 +546,34 @@ sub tmpdir {
 		} else {
 			$check_expensive = $_check_expensive{$filename};
 		}
-		# Avoid checking for buildarch+buildos unless we have reason
-		# to believe that they exist.
-		if ($check_expensive) {
-			push(@try,
-				 "debian/${package}.${filename}.".buildarch(),
-				 "debian/${package}.${filename}.".buildos(),
-			);
-		}
-		push(@try, "debian/$package.$filename");
-		if ($package eq $dh{MAINPACKAGE}) {
-			push @try, "debian/$filename";
+		if (ref($package) eq 'ARRAY') {
+			# !!NOT A PART OF THE PUBLIC API!!
+			# Bulk test used by dh to speed up the can_skip check.   It
+			# is NOT useful for finding the most precise pkgfile.
+			push(@try, "debian/$filename");
+			for my $pkg (@{$package}) {
+				push(@try, "debian/$package.$filename");
+				if ($check_expensive) {
+					push(@try,
+						 "debian/${package}.${filename}.".buildarch(),
+						 "debian/${package}.${filename}.".buildos(),
+					);
+				}
+			}
+		} else {
+			# Avoid checking for buildarch+buildos unless we have reason
+			# to believe that they exist.
+			if ($check_expensive) {
+				push(@try,
+					 "debian/${package}.${filename}.".buildarch(),
+					 "debian/${package}.${filename}.".buildos(),
+					);
+			}
+			push(@try, "debian/$package.$filename");
+			if ($package eq $dh{MAINPACKAGE}) {
+				push @try, "debian/$filename";
+			}
 		}
-
 		foreach my $file (@try) {
 			if (-f $file &&
 				(! $dh{IGNORE} || ! exists $dh{IGNORE}->{$file})) {
diff --git a/dh b/dh
index 5114446..efa2643 100755
--- a/dh
+++ b/dh
@@ -1057,9 +1057,8 @@ sub can_skip {
 				return 0;
 			}
 		} else {
-			foreach my $package (@packages) {
-				return 0 if pkgfile($package, $skipinfo) ne '';
-			}
+			# Use the secret bulk check call
+			return 0 if pkgfile(\@packages, $skipinfo) ne '';
 		}
 	}
 	return 1;

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