Ccing Roger since I am shortly leaving for Debconf and will be traveling
for the next 4 days.

Thomas Preud'homme wrote:
> Since debhelper 8.9.1, debhelper fails to run install sequence in compat 9:
> debian/rules binary directly starts running dh_strip, skipping notably all the
> dh_[auto_]install helpers. It seems that optimize_sequence is the culprit here
> since the change
> 
> -my @sequence=optimize_sequence(@{$sequences{$sequence}});
> +my @sequence=@{$sequences{$sequence}};
> 
> make the bug disappear.

Analysis: This is caused by the rules file having an explicit build target. 

dh expands "binary" to these targets:
  debian/rules install
  debian/rules binary-arch
  debian/rules binary-indep

optimize_sequence expands them to this list of commands:

  install =>
      debian/rules build # to be run directly
      dh_testroot dh_prep
      dh_installdirs dh_auto_install dh_install dh_installdocs
      dh_installchangelogs dh_installexamples dh_installman dh_installcatalogs
      dh_installcron dh_installdebconf dh_installemacsen dh_installifupdown
      dh_installinfo 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 dh_fixperms

  install-arch => build-arch => 
      dh_testdir dh_auto_configure dh_auto_build dh_auto_test <-- MARK
  
  install-indep => build-indep => (optimised away)
  
  binary-arch => 
      dh_strip dh_makeshlibs dh_shlibdeps dh_installdeb
      dh_gencontrol dh_md5sums dh_builddeb

  binary-indep => (optimised away)

Now since the last command run by the build target was dh_auto_test,
dh starts from that in the above list as marked, which skips all the install
target's commands. (This skipping to last command run is required for
various --before --after stuff IIRC.)

When there is no explicit build target, the command list instead starts
with the build-arch sequence (containing dh_auto_test), and so debhelper
only skips that and gets right to dh_installdirs etc as expected.

So the problem is that the explicit build target, coupled with
install-arch being inserted later (as a dependency of the install target),
results in a badly ordered sequence.

Hmm, one possible fix could be to make it realize that an explicit build
target should mean it does not need to add build-arch as a dependency
for install-indep. Instead it should just be able to add the explit
build target as a dependency, 

diff --git a/dh b/dh
index 443d934..8d73add 100755
--- a/dh
+++ b/dh
@@ -447,8 +447,14 @@ if (! compat(8)) {
                # run standard sequence (this is faster)
                $sequences{build} = [@bd];
        }
-       $sequences{'install-indep'} = [rules("build-indep"), @i];
-       $sequences{'install-arch'} = [rules("build-arch"), @i];
+       if (rules_explicit_target('build')) {
+               $sequences{'install-indep'} = [rules("build"), @i];
+               $sequences{'install-arch'} = [rules("build"), @i];
+       }
+       else {
+               $sequences{'install-indep'} = [rules("build-indep"), @i];
+               $sequences{'install-arch'} = [rules("build-arch"), @i];
+       }
        if (rules_explicit_target('install-arch') ||
            rules_explicit_target('install-indep')) {
                # run sequences separately

The only problem I see with this offhand is that if the package has
explicit build, build-arch, and build-indep, install-arch will result
in build-indep being run.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to