[debhelper-devel] [debhelper] 02/02: dh: Optimize out dh_testdir as it is literally useless

Niels Thykier nthykier at moszumanska.debian.org
Sat Jul 22 19:56:32 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 fca6ebf45cefecfc45fb34dcb6b00d85d5e44846
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Jul 22 19:43:28 2017 +0000

    dh: Optimize out dh_testdir as it is literally useless
    
    As it turned out in 333376abf9c4d6e8f286a7cbda7e8c13307745f3,
    dh_testdir is called too late to provide its "helpful" error message.
    Accordingly, dh itself has to print it directly now (via getpackages())
    for the user to get the correct error message.
    
    This literally makes dh_testdir useless under dh in its default
    configuration.  While it is possible to override dh_testdir and have
    it check for other files, it is largely an unused feature - even more
    under dh.
    
    On the plus side, we seem to save 2x 0.040s by doing this per build.
    Assuming 70% of the 25 000 source packages in Debian are using dh,
    this translates into a 23 "core-minutes" saving on an single
    architecture archive-wide rebuild (e.g. arch:amd64 plus arch:all).
    
    Somehow, I hope I got the math wrong because it seems obscene...
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog |  2 ++
 dh               | 10 ++++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 50cb42b..2f47b23 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -43,6 +43,8 @@ debhelper (10.7) UNRELEASED; urgency=medium
   * Dh_Lib: Provide a better error message when getpackages() is called
     by a helper in the wrong directory.  Unfortunately, dh cannot rely
     on dh_testdir to do this as dh_testdir is called too late.
+  * dh: optimize out the call to dh_testdir.  It is useless for
+    printing a helpful error message when called by dh.
 
  -- Niels Thykier <niels at thykier.net>  Sat, 15 Jul 2017 09:42:32 +0000
 
diff --git a/dh b/dh
index fceba5e..01ef8d9 100755
--- a/dh
+++ b/dh
@@ -370,11 +370,10 @@ if ($sequence eq 'debian/rules' ||
 # Definitions of sequences.
 my $build_stamp_file = 'debian/debhelper-build-stamp';
 my %sequences;
-my @bd_minimal = qw{
-	dh_testdir
-};
-my @bd = (qw{
+my @bd_minimal = compat(10) ? qw{
 	dh_testdir
+} : ();
+my @bd = (@bd_minimal, qw{
 	dh_update_autotools_config
 	dh_auto_configure
 	dh_auto_build
@@ -438,8 +437,7 @@ my @b=qw{
 	dh_md5sums
 	dh_builddeb
 };
-$sequences{clean} = [qw{
-	dh_testdir
+$sequences{clean} = [@bd_minimal, qw{
 	dh_auto_clean
 	dh_clean
 }];

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