Using dh causes configure to be run twice?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Using dh causes configure to be run twice?

Theodore Y. Ts'o
In my attempt to convert e2fsprfogs's debian/rules to use dh, I'm
running into yet another frustration with dh, which is that it insists
on running the configure script twice.

The problem is that dh is trying to use build-arch and build-indep:

% dh build --no-act
   debian/rules build-arch
   debian/rules build-indep

And build-arch and build-indep both want to run configure:

% dh build-arch --no-act
   dh_testdir -a
   dh_update_autotools_config -a
   debian/rules override_dh_auto_configure
   debian/rules override_dh_auto_build
   create-stamp debian/debhelper-build-stamp

% dh build-indep --no-act
   dh_testdir -i
   dh_update_autotools_config -i
   debian/rules override_dh_auto_configure
   debian/rules override_dh_auto_build
   create-stamp debian/debhelper-build-stamp

This seems.... amazingly non-optimal.

I tried to see how other packages work around this misfeature, and I
see that openssh just hacks things to make the second
dh_auto_configure a no-op:

override_dh_auto_configure-arch:
        dh_auto_configure -Bdebian/build-deb -- $(confflags)
ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
        dh_auto_configure -Bdebian/build-udeb -- $(confflags_udeb)
        # Avoid libnsl linkage. Ugh.
        perl -pi -e 's/ +-lnsl//' debian/build-udeb/config.status
        cd debian/build-udeb && ./config.status
endif

override_dh_auto_configure-indep:

RLY?

That seems like an amazing hack.  Is there no other way to work around
what appears to be massive mis-design in dh?

If the goal is to make moving to dh a mandate, and working on Debian
to be fun, we desperately need better documentation on how to use dh
for real-world packages, and not just simple, trivial packages....   :-(

                         - Ted

Reply | Threaded
Open this post in threaded view
|

Re: Using dh causes configure to be run twice?

Simon McVittie-7
On Wed, 10 Jul 2019 at 01:16:03 -0400, Theodore Ts'o wrote:
> In my attempt to convert e2fsprfogs's debian/rules to use dh, I'm
> running into yet another frustration with dh, which is that it insists
> on running the configure script twice.

This has not been my experience with other Autotools packages. dbus is
my usual example of a relatively complicated Autotools build, and it
only enters 'debian/rules override_dh_auto_configure' once (which as it
happens runs configure three times - for normal, debug and udeb builds -
but that's deliberate and dbus-specific).

  % dh build --no-act
   dh_testdir
   dh_update_autotools_config
   debian/rules override_dh_autoreconf
   debian/rules override_dh_auto_configure
   debian/rules override_dh_auto_build
   debian/rules override_dh_auto_test-arch
   debian/rules override_dh_auto_test-indep
   create-stamp debian/debhelper-build-stamp

I don't think we had that problem with glib2.0 either, although glib2.0
in stretch is old enough that it's still using cdbs, while glib2.0 in
buster is new enough that it has switched from Autotools to Meson, so I
don't have any buildd logs to provide evidence of that.

Perhaps you could share your latest version of d/rules somewhere?

> The problem is that dh is trying to use build-arch and build-indep:
>
> % dh build --no-act
>    debian/rules build-arch
>    debian/rules build-indep

dbus doesn't explicitly define build, build-arch or build-indep targets,
it leaves that to dh's "%" rule. Does e2fsprogs perhaps explicitly define
those targets?

    smcv

Reply | Threaded
Open this post in threaded view
|

Re: Using dh causes configure to be run twice?

Colin Watson
In reply to this post by Theodore Y. Ts'o
On Wed, Jul 10, 2019 at 01:16:03AM -0400, Theodore Ts'o wrote:

> I tried to see how other packages work around this misfeature, and I
> see that openssh just hacks things to make the second
> dh_auto_configure a no-op:
>
> override_dh_auto_configure-arch:
> dh_auto_configure -Bdebian/build-deb -- $(confflags)
> ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
> dh_auto_configure -Bdebian/build-udeb -- $(confflags_udeb)
> # Avoid libnsl linkage. Ugh.
> perl -pi -e 's/ +-lnsl//' debian/build-udeb/config.status
> cd debian/build-udeb && ./config.status
> endif
>
> override_dh_auto_configure-indep:
>
> RLY?

You've misread this, I'm afraid.  The point of the *-indep overrides in
openssh is to avoid doing unnecessary work in
architecture-independent-only builds, not to avoid duplicate configure
steps.  openssh has some Architecture: all binary packages, which
Debian's autobuilders build on separate builders that do the rough
equivalent of "sbuild --arch-all --no-arch-any", so a small amount of
time optimising this was worthwhile.

This is unrelated to the problem you're running into.

Proof: I introduced this change in
https://salsa.debian.org/ssh-team/openssh/commit/c1f965684b54bed51e8cb1e7a2f3d2003d64d341.
Aside from its commit message, you can also look at build logs from
before and after this change:

  https://buildd.debian.org/status/fetch.php?pkg=openssh&arch=i386&ver=1%3A6.9p1-2&stamp=1441886711&raw=0
  https://buildd.debian.org/status/fetch.php?pkg=openssh&arch=i386&ver=1%3A6.9p1-3&stamp=1448408594&raw=0

Both before and after this change, you can see that there's only one
dh_auto_configure pass (two actual configure runs, but that's because
there's one for deb and one for udeb).  I only started doing source-only
uploads with 1:6.9p1-3, so you can't easily see what it would have
looked like beforehand, but you can see that
https://buildd.debian.org/status/fetch.php?pkg=openssh&arch=all&ver=1%3A6.9p1-3&stamp=1448408071&raw=0
is nice and short once it gets past installing build-dependencies.

--
Colin Watson                                       [[hidden email]]