On Tue, Dec 07, 2010 at 04:07:11PM -0400, Joey Hess wrote:
> Roger Leigh wrote:
> > I think it's more likely to be triggered now
> 
> It will happen by default now with mixed indep/arch packages.
> 
> One way to fix it is by adding a non-arch-specific configure target,
> like this:
[…]

This would be a decent way to handle things.  I've attached a patch
as a suggestion for an alternative way to approach this which doesn't
treat the build-arch and build-indep sequences specially (it doesn't
add "-a" or "-i" to the debhelper options), leaving customisation up
to the user.  This means the behaviour is the same as existing
versions by default, but the option is there to tweak the rules if
so desired.  It doesn't handle the dh_auto_install case though.

> But, that's not the only thing to run twice. The entire set of debhelper
> commands in the install and binary sequences gets run twice, with -i and
> -a switches, where before they ran once with no switches. Which is
> unnecessarily slow.

It is running the commands twice where it previously only ran them
once, and I do agree there's additional overhead here.  However, the
key difference is that the build is driven via the policy required
rules targets.  The entire purpose of the patch is to ensure that
dh doesn't skip those targets (which it currently does).

  debian/rules binary

should be directly equivalent to

  debian/rules binary-arch binary-indep

but if "debian/rules binary" runs "dh binary", it currently runs the
"binary" sequence and skips the other debian/rules targets entirely.
The tradeoff is that you're adding some overhead, but you are gaining
proper support for the standard targets, and more importantly getting
consistent build results irrespective of how you invoke things.  From
this point of view you're gaining correctness, and IMO it's worth the
small loss of speed.

> Particularly concerning is that dh_auto_install gets run twice, and unlike
> (most) building, 2 calls to make install will do 2x the work. And running
> make install twice could conceivably lead to a FTBFS too.
> 
> So I reluctantly can't apply the sequence dependencies patch in its
> current state.

I'll have a further think about this.  I think this is 90% of the way
there, and if these details can be fixed, it will be a massive
improvement.

My gut feeling is that the dh_auto_* commands are by their very nature
not intended to work on arch-only or indep-only packages, so maybe
they should be ignoring the -a and -o options and always operating
on all packages (users who need the split will have to override them
in any case in order to get useful results).  Or maybe dh should drop
the -i/-a options when invoking them automatically.  I'll give it some
more thought.


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 2a848025a9d6f499389d2decc9fccffbdd33b4e5 Mon Sep 17 00:00:00 2001
From: Roger Leigh <rle...@debian.org>
Date: Tue, 7 Dec 2010 23:25:01 +0000
Subject: [PATCH] dh: Don't treat build-arch and build-indep sequences specially

Currently, the build-arch sequence adds "-a", and build-indep adds
"-i" to the debhelper options.  This makes sense for binary and
install targets.  However, build targets are different; we don't
run any debhelper packaging commands at this point in the build where
this would make sense.  If separating architecture dependent and
independent parts of the build, we will be writing custom overrides
and/or rules in debian/rules.  If not, then the default actions will
suffice.

This change makes the build-arch and build-indep sequences behave
identically.  As a result, their behaviour is only different when
specifically requested by the user.  This means the behaviour is
identical to previous dh releases by default.  "dh build" will
run both the build-arch and build-indep sequences, but the sequence
actions will only be run the first time through.
---
 dh |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/dh b/dh
index 9031747..24db303 100755
--- a/dh
+++ b/dh
@@ -621,8 +621,7 @@ my @packag...@{$dh{dopackages}};
 # Get the options to pass to commands in the sequence.
 # Filter out options intended only for this program.
 my @options;
-if ($sequence eq 'build-arch' ||
-    $sequence eq 'install-arch' ||
+if ($sequence eq 'install-arch' ||
     $sequence eq 'binary-arch') {
 	push @options, "-a";
 	# as an optimisation, remove from the list any packages
@@ -630,8 +629,7 @@ if ($sequence eq 'build-arch' ||
 	my %arch_packages = map { $_ => 1 } getpackages("arch");
 	@packages = grep { $arch_packages{$_} } @packages;
 }
-elsif ($sequence eq 'build-indep' ||
-       $sequence eq 'install-indep' ||
+elsif ($sequence eq 'install-indep' ||
        $sequence eq 'binary-indep') {
 	push @options, "-i";
 	# ditto optimisation for arch indep
-- 
1.7.2.3

Attachment: signature.asc
Description: Digital signature

Reply via email to