daemon: Run 'guix offload' directly.

* nix/scripts/offload.in: Remove.
* nix/local.mk (nodist_pkglibexec_SCRIPTS) [BUILD_DAEMON_OFFLOAD]:
Remove 'scripts/offload'.
* config-daemon.ac: Don't output 'nix/scripts/offload'.
* build-aux/pre-inst-env.in: Don't set 'NIX_BUILD_HOOK'.
* nix/libstore/build.cc (HookInstance::HookInstance): Run 'guix
offload'.
(DerivationGoal::tryBuildHook): Remove reference to 'NIX_BUILD_HOOK'.
* nix/nix-daemon/guix-daemon.cc (main) [HAVE_DAEMON_OFFLOAD_HOOK]: Don't
set 'NIX_BUILD_HOOK'.
* nix/nix-daemon/nix-daemon.cc (performOp) [!HAVE_DAEMON_OFFLOAD_HOOK]:
Leave 'settings.useBuildHook' unchanged.
This commit is contained in:
Ludovic Courtès 2019-09-03 22:11:47 +02:00
parent 9fcc35c51f
commit bc69ea2d60
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
7 changed files with 13 additions and 39 deletions

View file

@ -614,9 +614,7 @@ HookInstance::HookInstance()
{
debug("starting build hook");
Path buildHook = getEnv("NIX_BUILD_HOOK");
if (string(buildHook, 0, 1) != "/") buildHook = settings.nixLibexecDir + "/nix/" + buildHook;
buildHook = canonPath(buildHook);
const Path &buildHook = settings.guixProgram;
/* Create a pipe to get the output of the child. */
fromHook.create();
@ -642,13 +640,14 @@ HookInstance::HookInstance()
if (dup2(builderOut.writeSide, 4) == -1)
throw SysError("dupping builder's stdout/stderr");
execl(buildHook.c_str(), buildHook.c_str(), settings.thisSystem.c_str(),
execl(buildHook.c_str(), buildHook.c_str(), "offload",
settings.thisSystem.c_str(),
(format("%1%") % settings.maxSilentTime).str().c_str(),
(format("%1%") % settings.printBuildTrace).str().c_str(),
(format("%1%") % settings.buildTimeout).str().c_str(),
NULL);
throw SysError(format("executing `%1%'") % buildHook);
throw SysError(format("executing `%1% offload'") % buildHook);
});
pid.setSeparatePG(true);
@ -1581,7 +1580,7 @@ void DerivationGoal::buildDone()
HookReply DerivationGoal::tryBuildHook()
{
if (!settings.useBuildHook || getEnv("NIX_BUILD_HOOK") == "") return rpDecline;
if (!settings.useBuildHook) return rpDecline;
if (!worker.hook)
worker.hook = std::shared_ptr<HookInstance>(new HookInstance);