On Sun, Jun 12, 2011 at 08:28:01PM +0100, Roger Leigh wrote:
> On Sun, Jun 12, 2011 at 11:47:54AM -0400, Joey Hess wrote:
> One possible approach here would be to call
> rules_explicit_target("build-(arch|indep)") and and then if they exist,
> we can skip the entire build sequence up to invoking
> "debian/rules build-(arch|indep)". This would mean if you don't
> explicitly write a build-(arch|indep) rule, you get the faster
> behaviour by doing all the arch and indep work together; and if you
> do define them, you get the separate, slower behaviour. This would
> be correct in both cases, it's just trading speed for flexibility.
> The same can be done for the install target. I've attached a second
> patch which implements this optimisation.Sorry, wrong version of second patch; I've attached the correct one. To improve performance in dh, have you considered making rules_explicit_target cache the rules so that the parsing only needs to be done once per dh invocation? If you checked for overrides for all dh commands and rules for all rules: in a single pass, it might save quite a bit of overhead. Regards, Roger -- .''`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
From e529509c3026e7a29ec3efa567cab212b66b85e6 Mon Sep 17 00:00:00 2001 From: Roger Leigh <[email protected]> Date: Sun, 12 Jun 2011 20:22:43 +0100 Subject: [PATCH 2/2] dh: Use minimal sequences if delegating work The build and install rules run a minimal sequence if the build-arch or build-indep, or install-arch or install-indep targets, respectively, are present in debian/rules. The purpose is to not do work ahead of time, such as building before the build-arch or build-indep targets are built, which could potentially lead to misbuilds. If the targets are not defined, the sequences may be run directly which is faster due to being able to run the arch and indep commands together. --- dh | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/dh b/dh index 75070ea..8af408c 100755 --- a/dh +++ b/dh @@ -338,6 +338,10 @@ if (is_make_jobserver_unavailable()) { # Definitions of sequences. my %sequences; +my @bd_minimal = qw{ + dh_testdir + dh_auto_configure +}; my @bd = qw{ dh_testdir dh_auto_configure @@ -357,6 +361,9 @@ $sequences{clean} = [qw{ dh_auto_clean dh_clean }]; +my @i_minimal = qw{ + dh_testroot +}; my @i = qw{ dh_testroot dh_prep @@ -550,6 +557,23 @@ elsif (! exists $sequences{$sequence}) { error "Unknown sequence $sequence (choose from: ". join(" ", sort keys %sequences).")"; } + +# Note: it's not safe to run rules_explicit_target before this point +# due to dh being recursively invoked with debhelper-fail-me as the +# sequence +# If debian/rules defines build-arch or build-indep, run sequences +# separately. +if (rules_explicit_target('build-arch') || + rules_explicit_target('build-indep')) { + $sequences{build} = [@bd_minimal, 'rules:build-arch', 'rules:build-indep']; +} +# If debian/rules defines install-arch or install-indep, run sequences +# separately. +if (rules_explicit_target('install-arch') || + rules_explicit_target('install-indep')) { + $sequences{'install'} = ['rules:build', @i_minimal, 'rules:install-arch', 'rules:install-indep']; +} + my @sequence=@{$sequences{$sequence}}; # The list of all packages that can be acted on. -- 1.7.5.4
signature.asc
Description: Digital signature

