[PATCH] config: Conditionally configure daemon offload script.

  • Done
  • quality assurance status badge
Details
3 participants
  • Eric Bavier
  • Eric Bavier
  • Ludovic Courtès
Owner
unassigned
Submitted by
Eric Bavier
Severity
normal
E
E
Eric Bavier wrote on 9 Oct 2017 21:08
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
CY4PR11MB17189D487BEBC3AA8150097AB7740@CY4PR11MB1718.namprd11.prod.outlook.com
This prevents pre-inst-env from exporting NIX_BUILD_HOOK when guile-ssh is not available.

Eric Bavier, Scientific Libraries, Cray Inc.
From 984e324370c2c17d8d1a982adf2884112c9e64b7 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@cray.com>
Date: Mon, 9 Oct 2017 13:58:04 -0500
Subject: [PATCH] config: Conditionally configure daemon offload script.

* config-daemon.ac (nix/scripts/offload): Configure only if offloading enabled.
---
config-daemon.ac | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Toggle diff (19 lines)
diff --git a/config-daemon.ac b/config-daemon.ac
index 42b5981..841e0ac 100644
--- a/config-daemon.ac
+++ b/config-daemon.ac
@@ -159,8 +159,10 @@ if test "x$guix_build_daemon" = "xyes"; then
[chmod +x nix/scripts/substitute])
AC_CONFIG_FILES([nix/scripts/guix-authenticate],
[chmod +x nix/scripts/guix-authenticate])
- AC_CONFIG_FILES([nix/scripts/offload],
- [chmod +x nix/scripts/offload])
+ if test "x$guix_build_daemon_offload" = "xyes"; then
+ AC_CONFIG_FILES([nix/scripts/offload],
+ [chmod +x nix/scripts/offload])
+ fi
fi
AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"])
--
1.8.5.6
L
L
Ludovic Courtès wrote on 9 Oct 2017 23:07
(name . Eric Bavier)(address . bavier@cray.com)(address . 28765@debbugs.gnu.org)
87vajoowsh.fsf@gnu.org
Eric Bavier <bavier@cray.com> skribis:

Toggle quote (4 lines)
> From 984e324370c2c17d8d1a982adf2884112c9e64b7 Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@cray.com>
> Date: Mon, 9 Oct 2017 13:58:04 -0500
> Subject: [PATCH] config: Conditionally configure daemon offload script.
^
Nitpick: rather “build:”, which is for all things build-related.

Toggle quote (2 lines)
> * config-daemon.ac (nix/scripts/offload): Configure only if offloading enabled.

It LGTM, but is it helpful? guix-daemon does not invoke ‘guix offload’
when it’s missing, as can be seen in guix-daemon.cc:

#ifdef HAVE_DAEMON_OFFLOAD_HOOK
/* Use our build hook for distributed builds by default. */

Thanks,
Ludo’.
E
E
Eric Bavier wrote on 10 Oct 2017 02:08
(name . Ludovic Courtès)(address . ludo@gnu.org)
20171009190801.22685b19@centurylink.net
On Mon, 09 Oct 2017 23:07:10 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (18 lines)
> Eric Bavier <bavier@cray.com> skribis:
>
> > From 984e324370c2c17d8d1a982adf2884112c9e64b7 Mon Sep 17 00:00:00 2001
> > From: Eric Bavier <bavier@cray.com>
> > Date: Mon, 9 Oct 2017 13:58:04 -0500
> > Subject: [PATCH] config: Conditionally configure daemon offload script.
> ^
> Nitpick: rather “build:”, which is for all things build-related.
>
> > * config-daemon.ac (nix/scripts/offload): Configure only if offloading enabled.
>
> It LGTM, but is it helpful? guix-daemon does not invoke ‘guix offload’
> when it’s missing, as can be seen in guix-daemon.cc:
>
> #ifdef HAVE_DAEMON_OFFLOAD_HOOK
> /* Use our build hook for distributed builds by default. */
> …

Or maybe something like this would be preferable, to avoid exporting
NIX_BUILD_HOOK if Guix has been configured to disable the daemon
offload hook?

--- a/build-aux/pre-inst-env.in
+++ b/build-aux/pre-inst-env.in
@@ -50,13 +50,9 @@ NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'guix-authenticate'
export NIX_ROOT_FINDER NIX_SUBSTITUTERS NIX_LIBEXEC_DIR
NIX_BUILD_HOOK="$abs_top_builddir/nix/scripts/offload"
-if [ -x "$NIX_BUILD_HOOK" ]
-then
- export NIX_BUILD_HOOK
-else
- # No offloading support.
- unset NIX_BUILD_HOOK
-fi
+@BUILD_DAEMON_OFFLOAD_TRUE@export NIX_BUILD_HOOK
+@BUILD_DAEMON_OFFLOAD_FALSE@# No offloading support.
+@BUILD_DAEMON_OFFLOAD_FALSE@unset NIX_BUILD_HOOK
# The 'guix-register' program.
GUIX_REGISTER="$abs_top_builddir/guix-register"
L
L
Ludovic Courtès wrote on 10 Oct 2017 08:49
(name . Eric Bavier)(address . ericbavier@centurylink.net)
87zi8zpkdu.fsf@gnu.org
Hello,

Eric Bavier <ericbavier@centurylink.net> skribis:

Toggle quote (42 lines)
> On Mon, 09 Oct 2017 23:07:10 +0200
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> Eric Bavier <bavier@cray.com> skribis:
>>
>> > From 984e324370c2c17d8d1a982adf2884112c9e64b7 Mon Sep 17 00:00:00 2001
>> > From: Eric Bavier <bavier@cray.com>
>> > Date: Mon, 9 Oct 2017 13:58:04 -0500
>> > Subject: [PATCH] config: Conditionally configure daemon offload script.
>> ^
>> Nitpick: rather “build:”, which is for all things build-related.
>>
>> > * config-daemon.ac (nix/scripts/offload): Configure only if offloading enabled.
>>
>> It LGTM, but is it helpful? guix-daemon does not invoke ‘guix offload’
>> when it’s missing, as can be seen in guix-daemon.cc:
>>
>> #ifdef HAVE_DAEMON_OFFLOAD_HOOK
>> /* Use our build hook for distributed builds by default. */
>> …
>
> Or maybe something like this would be preferable, to avoid exporting
> NIX_BUILD_HOOK if Guix has been configured to disable the daemon
> offload hook?
>
> --- a/build-aux/pre-inst-env.in
> +++ b/build-aux/pre-inst-env.in
> @@ -50,13 +50,9 @@ NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'guix-authenticate'
> export NIX_ROOT_FINDER NIX_SUBSTITUTERS NIX_LIBEXEC_DIR
>
> NIX_BUILD_HOOK="$abs_top_builddir/nix/scripts/offload"
> -if [ -x "$NIX_BUILD_HOOK" ]
> -then
> - export NIX_BUILD_HOOK
> -else
> - # No offloading support.
> - unset NIX_BUILD_HOOK
> -fi
> +@BUILD_DAEMON_OFFLOAD_TRUE@export NIX_BUILD_HOOK
> +@BUILD_DAEMON_OFFLOAD_FALSE@# No offloading support.
> +@BUILD_DAEMON_OFFLOAD_FALSE@unset NIX_BUILD_HOOK

It’s nicer (you’re welcome to push this change!), but it’s equivalent to
what’s already here, no?

Is there a problem that we are trying to solve in the first place, or is
it more about making things nicer?

Thank you,
Ludo’.
E
E
Eric Bavier wrote on 10 Oct 2017 15:00
(name . Ludovic Courtès)(address . ludo@gnu.org)
20171010080019.19341e92@centurylink.net
On Tue, 10 Oct 2017 08:49:49 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (49 lines)
> Hello,
>
> Eric Bavier <ericbavier@centurylink.net> skribis:
>
> > On Mon, 09 Oct 2017 23:07:10 +0200
> > ludo@gnu.org (Ludovic Courtès) wrote:
> >
> >> Eric Bavier <bavier@cray.com> skribis:
> >>
> >> > From 984e324370c2c17d8d1a982adf2884112c9e64b7 Mon Sep 17 00:00:00 2001
> >> > From: Eric Bavier <bavier@cray.com>
> >> > Date: Mon, 9 Oct 2017 13:58:04 -0500
> >> > Subject: [PATCH] config: Conditionally configure daemon offload script.
> >> ^
> >> Nitpick: rather “build:”, which is for all things build-related.
> >>
> >> > * config-daemon.ac (nix/scripts/offload): Configure only if offloading enabled.
> >>
> >> It LGTM, but is it helpful? guix-daemon does not invoke ‘guix offload’
> >> when it’s missing, as can be seen in guix-daemon.cc:
> >>
> >> #ifdef HAVE_DAEMON_OFFLOAD_HOOK
> >> /* Use our build hook for distributed builds by default. */
> >> …
> >
> > Or maybe something like this would be preferable, to avoid exporting
> > NIX_BUILD_HOOK if Guix has been configured to disable the daemon
> > offload hook?
> >
> > --- a/build-aux/pre-inst-env.in
> > +++ b/build-aux/pre-inst-env.in
> > @@ -50,13 +50,9 @@ NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'guix-authenticate'
> > export NIX_ROOT_FINDER NIX_SUBSTITUTERS NIX_LIBEXEC_DIR
> >
> > NIX_BUILD_HOOK="$abs_top_builddir/nix/scripts/offload"
> > -if [ -x "$NIX_BUILD_HOOK" ]
> > -then
> > - export NIX_BUILD_HOOK
> > -else
> > - # No offloading support.
> > - unset NIX_BUILD_HOOK
> > -fi
> > +@BUILD_DAEMON_OFFLOAD_TRUE@export NIX_BUILD_HOOK
> > +@BUILD_DAEMON_OFFLOAD_FALSE@# No offloading support.
> > +@BUILD_DAEMON_OFFLOAD_FALSE@unset NIX_BUILD_HOOK
>
> It’s nicer (you’re welcome to push this change!), but it’s equivalent to
> what’s already here, no?

It's not quite equivalent. The current situation would end up always
exporting NIX_BUILD_HOOK because it is always generated by
config.status.
Toggle quote (4 lines)
>
> Is there a problem that we are trying to solve in the first place, or is
> it more about making things nicer?

The problem is libstore/build.cc executing NIX_BUILD_HOOK even if the
daemon offload hook is disabled, i.e. when guile-ssh is missing.

Make sense?

`~Eric
L
L
Ludovic Courtès wrote on 10 Oct 2017 16:17
(name . Eric Bavier)(address . ericbavier@centurylink.net)
87sherm6id.fsf@gnu.org
Eric Bavier <ericbavier@centurylink.net> skribis:

Toggle quote (56 lines)
> On Tue, 10 Oct 2017 08:49:49 +0200
> ludo@gnu.org (Ludovic Courtès) wrote:
>
>> Hello,
>>
>> Eric Bavier <ericbavier@centurylink.net> skribis:
>>
>> > On Mon, 09 Oct 2017 23:07:10 +0200
>> > ludo@gnu.org (Ludovic Courtès) wrote:
>> >
>> >> Eric Bavier <bavier@cray.com> skribis:
>> >>
>> >> > From 984e324370c2c17d8d1a982adf2884112c9e64b7 Mon Sep 17 00:00:00 2001
>> >> > From: Eric Bavier <bavier@cray.com>
>> >> > Date: Mon, 9 Oct 2017 13:58:04 -0500
>> >> > Subject: [PATCH] config: Conditionally configure daemon offload script.
>> >> ^
>> >> Nitpick: rather “build:”, which is for all things build-related.
>> >>
>> >> > * config-daemon.ac (nix/scripts/offload): Configure only if offloading enabled.
>> >>
>> >> It LGTM, but is it helpful? guix-daemon does not invoke ‘guix offload’
>> >> when it’s missing, as can be seen in guix-daemon.cc:
>> >>
>> >> #ifdef HAVE_DAEMON_OFFLOAD_HOOK
>> >> /* Use our build hook for distributed builds by default. */
>> >> …
>> >
>> > Or maybe something like this would be preferable, to avoid exporting
>> > NIX_BUILD_HOOK if Guix has been configured to disable the daemon
>> > offload hook?
>> >
>> > --- a/build-aux/pre-inst-env.in
>> > +++ b/build-aux/pre-inst-env.in
>> > @@ -50,13 +50,9 @@ NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'guix-authenticate'
>> > export NIX_ROOT_FINDER NIX_SUBSTITUTERS NIX_LIBEXEC_DIR
>> >
>> > NIX_BUILD_HOOK="$abs_top_builddir/nix/scripts/offload"
>> > -if [ -x "$NIX_BUILD_HOOK" ]
>> > -then
>> > - export NIX_BUILD_HOOK
>> > -else
>> > - # No offloading support.
>> > - unset NIX_BUILD_HOOK
>> > -fi
>> > +@BUILD_DAEMON_OFFLOAD_TRUE@export NIX_BUILD_HOOK
>> > +@BUILD_DAEMON_OFFLOAD_FALSE@# No offloading support.
>> > +@BUILD_DAEMON_OFFLOAD_FALSE@unset NIX_BUILD_HOOK
>>
>> It’s nicer (you’re welcome to push this change!), but it’s equivalent to
>> what’s already here, no?
>
> It's not quite equivalent. The current situation would end up always
> exporting NIX_BUILD_HOOK because it is always generated by
> config.status.

Oooh, got it.

Toggle quote (8 lines)
>> Is there a problem that we are trying to solve in the first place, or is
>> it more about making things nicer?
>
> The problem is libstore/build.cc executing NIX_BUILD_HOOK even if the
> daemon offload hook is disabled, i.e. when guile-ssh is missing.
>
> Make sense?

Yes, definitely.

Then you can definitely commit the pre-inst-env.in patch; the
config-daemon.ac patch can’t hurt either.

Thank you!

Ludo’.
E
E
Eric Bavier wrote on 11 Oct 2017 06:18
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 28765-done@debbugs.gnu.org)
20171010231831.587b03db@centurylink.net
On Tue, 10 Oct 2017 16:17:46 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

Toggle quote (73 lines)
> Eric Bavier <ericbavier@centurylink.net> skribis:
>
> > On Tue, 10 Oct 2017 08:49:49 +0200
> > ludo@gnu.org (Ludovic Courtès) wrote:
> >
> >> Hello,
> >>
> >> Eric Bavier <ericbavier@centurylink.net> skribis:
> >>
> >> > On Mon, 09 Oct 2017 23:07:10 +0200
> >> > ludo@gnu.org (Ludovic Courtès) wrote:
> >> >
> >> >> Eric Bavier <bavier@cray.com> skribis:
> >> >>
> >> >> > From 984e324370c2c17d8d1a982adf2884112c9e64b7 Mon Sep 17 00:00:00 2001
> >> >> > From: Eric Bavier <bavier@cray.com>
> >> >> > Date: Mon, 9 Oct 2017 13:58:04 -0500
> >> >> > Subject: [PATCH] config: Conditionally configure daemon offload script.
> >> >> ^
> >> >> Nitpick: rather “build:”, which is for all things build-related.
> >> >>
> >> >> > * config-daemon.ac (nix/scripts/offload): Configure only if offloading enabled.
> >> >>
> >> >> It LGTM, but is it helpful? guix-daemon does not invoke ‘guix offload’
> >> >> when it’s missing, as can be seen in guix-daemon.cc:
> >> >>
> >> >> #ifdef HAVE_DAEMON_OFFLOAD_HOOK
> >> >> /* Use our build hook for distributed builds by default. */
> >> >> …
> >> >
> >> > Or maybe something like this would be preferable, to avoid exporting
> >> > NIX_BUILD_HOOK if Guix has been configured to disable the daemon
> >> > offload hook?
> >> >
> >> > --- a/build-aux/pre-inst-env.in
> >> > +++ b/build-aux/pre-inst-env.in
> >> > @@ -50,13 +50,9 @@ NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'guix-authenticate'
> >> > export NIX_ROOT_FINDER NIX_SUBSTITUTERS NIX_LIBEXEC_DIR
> >> >
> >> > NIX_BUILD_HOOK="$abs_top_builddir/nix/scripts/offload"
> >> > -if [ -x "$NIX_BUILD_HOOK" ]
> >> > -then
> >> > - export NIX_BUILD_HOOK
> >> > -else
> >> > - # No offloading support.
> >> > - unset NIX_BUILD_HOOK
> >> > -fi
> >> > +@BUILD_DAEMON_OFFLOAD_TRUE@export NIX_BUILD_HOOK
> >> > +@BUILD_DAEMON_OFFLOAD_FALSE@# No offloading support.
> >> > +@BUILD_DAEMON_OFFLOAD_FALSE@unset NIX_BUILD_HOOK
> >>
> >> It’s nicer (you’re welcome to push this change!), but it’s equivalent to
> >> what’s already here, no?
> >
> > It's not quite equivalent. The current situation would end up always
> > exporting NIX_BUILD_HOOK because it is always generated by
> > config.status.
>
> Oooh, got it.
>
> >> Is there a problem that we are trying to solve in the first place, or is
> >> it more about making things nicer?
> >
> > The problem is libstore/build.cc executing NIX_BUILD_HOOK even if the
> > daemon offload hook is disabled, i.e. when guile-ssh is missing.
> >
> > Make sense?
>
> Yes, definitely.
>
> Then you can definitely commit the pre-inst-env.in patch; the
> config-daemon.ac patch can’t hurt either.

pre-inst-env patch pushed as 7740228e3523e3e0e4c007eb1f1b224575d16574
Closed
?