On Tue, Jun 07, 2011 at 03:52:01PM +0100, Roger Leigh wrote: > On Tue, Jun 07, 2011 at 01:47:41PM +0100, Roger Leigh wrote: > > On Tue, Jun 07, 2011 at 08:12:15AM -0400, Joey Hess wrote: > > > Roger Leigh wrote: > > > > I think I may have proposed something similar to this patch before, but > > > > I can't find it in the BTS. > > > > > > It caused significant slowdown (due to running every debhelper command > > > twice with -a and -i) and quite likely broke packages due to > > > running make install twice, so was removed. > > > > > > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=604563#77 > > > > > > 657852b56b0d835afd4e45407d6e8d217c63ab20 > > > > I'm sure we can improve the performance with some additional work. > > > > Currently we have the "sequence dependencies" as a separate > > list, not associated with the sequences themselves. It would be > > possible to put them directly into the sequence list, e.g. with > > a prefix such as "rules:build" which would make dh invoke > > "debian/rules build" rather than the command directly. This would > > permit the rules targets to be run at any point in a sequence. > > Patch attached which includes the rules in the sequences. This should, > as far as I can tell with my testing, eliminate the performance issues > you mentioned above. With the rules targets in the sequence list, it > also means you can potentially also use them as sequence points for > --before etc.
I've greatly simplified the patch. This is now much more straightforward and works well for me. It has the performance improvements of previous patches, but with greatly reduced complexity. Examples: % dh build --no-act dh_testdir debian/rules override_dh_auto_configure debian/rules override_dh_auto_build # Skipping dh_auto_test - empty override debian/rules build-arch debian/rules build-indep % dh build-arch --no-act dh_testdir -a debian/rules override_dh_auto_configure debian/rules override_dh_auto_build # Skipping dh_auto_test - empty override % dh install --no-act debian/rules build dh_testroot dh_prep dh_installdirs debian/rules override_dh_auto_install dh_install debian/rules override_dh_installdocs debian/rules override_dh_installchangelogs dh_installexamples dh_installman dh_installcatalogs dh_installcron dh_installdebconf dh_installemacsen dh_installifupdown dh_installinfo dh_pysupport debian/rules override_dh_installinit dh_installmenu dh_installmime dh_installmodules dh_installlogcheck dh_installlogrotate dh_installpam dh_installppp dh_installudev dh_installwm dh_installxfonts dh_installgsettings dh_bugfiles dh_ucf dh_lintian dh_gconf dh_icons dh_perl dh_usrlocal dh_link dh_compress debian/rules override_dh_fixperms debian/rules install-arch debian/rules install-indep % dh install-arch --no-act debian/rules build-arch dh_testroot -a dh_prep -a dh_installdirs -a debian/rules override_dh_auto_install dh_install -a debian/rules override_dh_installdocs debian/rules override_dh_installchangelogs dh_installexamples -a dh_installman -a dh_installcatalogs -a dh_installcron -a dh_installdebconf -a dh_installemacsen -a dh_installifupdown -a dh_installinfo -a dh_pysupport -a debian/rules override_dh_installinit dh_installmenu -a dh_installmime -a dh_installmodules -a dh_installlogcheck -a dh_installlogrotate -a dh_installpam -a dh_installppp -a dh_installudev -a dh_installwm -a dh_installxfonts -a dh_installgsettings -a dh_bugfiles -a dh_ucf -a dh_lintian -a dh_gconf -a dh_icons -a dh_perl -a dh_usrlocal -a dh_link -a dh_compress -a debian/rules override_dh_fixperms This has been working beautifully for me, and means you now get uniform behaviour from debian/rules $target and dh target including when being invoked as a sequence dependency. One scenario in which this can potentially cause problems is if you're abusing dh by calling things out of sequence. For example, if you run "dh binary --until" from within the build rule. With this patch, the build commands are no longer present within the binary sequence, being restricted to the build* sequences. However, such behaviour from dh users is arguably rather broken--one should be restricting dh calls to the target-specific sequences rather than playing these sorts of tricks. 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 b7f3d44ded267d0d6dd799f784a629f82cea56ab Mon Sep 17 00:00:00 2001 From: Roger Leigh <rle...@debian.org> Date: Fri, 3 Jun 2011 20:41:30 +0100 Subject: [PATCH] dh: Add sequence dependency support Rather than dh sequences containing dependent sequences within themselves, invoke the sub-sequence via debian/rules to permit overriding and customisation using the policy-defined debian/rules targets. Signed-off-by: Roger Leigh <rle...@debian.org> --- dh | 57 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 46 insertions(+), 11 deletions(-) diff --git a/dh b/dh index 50e0f14..81e11b2 100755 --- a/dh +++ b/dh @@ -151,6 +151,16 @@ either and instead run your own commands. override_dh_auto_build: make universe-explode-in-delight +If running a configure script, it may be necessary to prevent it being +run twice, once for architecture-independent packages, and again for +architecture-dependent packages. This may be accomplished by +overriding L<dh_autoconfigure(1)>: + + override_dh_auto_configure: config.status + + config.status: + dh_auto_configure -- $configure_options + Another common case is wanting to do something manually before or after a particular debhelper command is run. @@ -273,6 +283,13 @@ that is in the specified sequence. It then continues with the next command in the sequence. The B<--until>, B<--before>, B<--after>, and B<--remaining> options can override this behavior. +A sequence can also run dependent targets in debian/rules. For +example, the "binary" sequence runs the "install" target. This will +show up in the dh output as "debian/rules install", but internally +will be called "rules:install" in the sequence. The "install" +sequence likewise runs "debian/rules build", internally named +"rules:build". + B<dh> uses the B<DH_INTERNAL_OPTIONS> environment variable to pass information through to debhelper commands that are run inside override targets. The contents (and indeed, existence) of this environment variable, as the name @@ -321,14 +338,15 @@ if (is_make_jobserver_unavailable()) { # Definitions of sequences. my %sequences; -$sequences{build} = [qw{ +my @bd = qw{ dh_testdir dh_auto_configure dh_auto_build dh_auto_test -}], -$sequences{'build-indep'} = [@{$sequences{build}}]; -$sequences{'build-arch'} = [@{$sequences{build}}]; +}; +$sequences{build} = [@bd, 'rules:build-arch', 'rules:build-indep']; +$sequences{'build-indep'} = [@bd]; +$sequences{'build-arch'} = [@bd]; $sequences{clean} = [qw{ dh_testdir dh_auto_clean @@ -376,9 +394,9 @@ my @i = qw{ dh_compress dh_fixperms }; -$sequences{'install'} = [@{$sequences{build}}, @i]; -$sequences{'install-indep'} = [@{$sequences{'build-indep'}}, @i]; -$sequences{'install-arch'} = [@{$sequences{'build-arch'}}, @i]; +$sequences{'install'} = ['rules:build', @i, 'rules:install-arch', 'rules:install-indep']; +$sequences{'install-indep'} = ['rules:build-indep', @i]; +$sequences{'install-arch'} = ['rules:build-arch', @i]; my @ba=qw{ dh_strip dh_makeshlibs @@ -390,9 +408,9 @@ my @b=qw{ dh_md5sums dh_builddeb }; -$sequences{binary} = [@{$sequences{install}}, @ba, @b]; -$sequences{'binary-indep'} = [@{$sequences{'install-indep'}}, @b]; -$sequences{'binary-arch'} = [@{$sequences{'install-arch'}}, @ba, @b]; +$sequences{binary} = ['rules:install', @ba, @b, 'rules:binary-arch', 'rules:binary-indep']; +$sequences{'binary-indep'} = ['rules:install-indep', @b]; +$sequences{'binary-arch'} = ['rules:install-arch', @ba, @b]; # Additional command options my %command_opts; @@ -641,11 +659,28 @@ sub run { # to prevent them from being acted on. push @options, map { "-N$_" } @exclude; + # If the command has a rules: prefix, run debian/rules with + # the remainder as the target. + my $rules_target = undef; + if ($command =~ /^rules:(.*)/) { + $rules_target = $1; + } + # Check for override targets in debian/rules and # run them instead of running the command directly. my $override_command; my $has_explicit_target = rules_explicit_target("override_".$command); - if (defined $has_explicit_target) { + + if (defined $rules_target) { + # Don't pass DH_ environment variables, since this is + # a fresh invocation of debian/rules and any sub-dh + # commands. + delete $ENV{DH_INTERNAL_OPTIONS}; + delete $ENV{DH_INTERNAL_OVERRIDE}; + $command="debian/rules"; + @options=$rules_target; + } + elsif (defined $has_explicit_target) { $override_command=$command; # Check if target isn't noop if ($has_explicit_target) { -- 1.7.5.4
signature.asc
Description: Digital signature