mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
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:
parent
9fcc35c51f
commit
bc69ea2d60
7 changed files with 13 additions and 39 deletions
|
@ -48,10 +48,6 @@ NIX_LIBEXEC_DIR="@abs_top_builddir@/nix/scripts" # for 'authenticate', etc.
|
|||
|
||||
export NIX_LIBEXEC_DIR
|
||||
|
||||
NIX_BUILD_HOOK="$abs_top_builddir/nix/scripts/offload"
|
||||
@BUILD_DAEMON_OFFLOAD_TRUE@export NIX_BUILD_HOOK
|
||||
@BUILD_DAEMON_OFFLOAD_FALSE@# No offloading support.
|
||||
@BUILD_DAEMON_OFFLOAD_FALSE@unset NIX_BUILD_HOOK
|
||||
# The daemon invokes 'guix'; tell it which one to use.
|
||||
GUIX="$abs_top_builddir/scripts/guix"
|
||||
export GUIX
|
||||
|
|
|
@ -150,8 +150,6 @@ if test "x$guix_build_daemon" = "xyes"; then
|
|||
GUIX_CHECK_LOCALSTATEDIR
|
||||
AC_CONFIG_FILES([nix/scripts/substitute],
|
||||
[chmod +x nix/scripts/substitute])
|
||||
AC_CONFIG_FILES([nix/scripts/offload],
|
||||
[chmod +x nix/scripts/offload])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([HAVE_LIBBZ2], [test "x$HAVE_LIBBZ2" = "xyes"])
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -157,13 +157,6 @@ noinst_HEADERS = \
|
|||
nodist_pkglibexec_SCRIPTS = \
|
||||
%D%/scripts/substitute
|
||||
|
||||
if BUILD_DAEMON_OFFLOAD
|
||||
|
||||
nodist_pkglibexec_SCRIPTS += \
|
||||
%D%/scripts/offload
|
||||
|
||||
endif BUILD_DAEMON_OFFLOAD
|
||||
|
||||
# The '.service' files for systemd.
|
||||
systemdservicedir = $(libdir)/systemd/system
|
||||
nodist_systemdservice_DATA = etc/guix-daemon.service etc/guix-publish.service
|
||||
|
|
|
@ -474,15 +474,8 @@ main (int argc, char *argv[])
|
|||
settings.set ("substitute-urls", GUIX_SUBSTITUTE_URLS);
|
||||
|
||||
#ifdef HAVE_DAEMON_OFFLOAD_HOOK
|
||||
/* Use our build hook for distributed builds by default. */
|
||||
/* Use 'guix offload' for distributed builds by default. */
|
||||
settings.useBuildHook = true;
|
||||
if (getenv ("NIX_BUILD_HOOK") == NULL)
|
||||
{
|
||||
std::string build_hook;
|
||||
|
||||
build_hook = settings.nixLibexecDir + "/offload";
|
||||
setenv ("NIX_BUILD_HOOK", build_hook.c_str (), 1);
|
||||
}
|
||||
#else
|
||||
/* We are not installing any build hook, so disable it. */
|
||||
settings.useBuildHook = false;
|
||||
|
|
|
@ -580,8 +580,14 @@ static void performOp(bool trusted, unsigned int clientVersion,
|
|||
settings.set("build-max-silent-time", std::to_string(readInt(from)));
|
||||
}
|
||||
|
||||
if (GET_PROTOCOL_MINOR(clientVersion) >= 2)
|
||||
if (GET_PROTOCOL_MINOR(clientVersion) >= 2) {
|
||||
#ifdef HAVE_DAEMON_OFFLOAD_HOOK
|
||||
settings.useBuildHook = readInt(from) != 0;
|
||||
#else
|
||||
readInt(from); // ignore the user's setting
|
||||
#endif
|
||||
}
|
||||
|
||||
if (GET_PROTOCOL_MINOR(clientVersion) >= 4) {
|
||||
settings.buildVerbosity = (Verbosity) readInt(from);
|
||||
logType = (LogType) readInt(from);
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
#!@SHELL@
|
||||
# A shorthand for "guix offload", for use by the daemon.
|
||||
|
||||
if test "x$GUIX_UNINSTALLED" = "x"
|
||||
then
|
||||
prefix="@prefix@"
|
||||
exec_prefix="@exec_prefix@"
|
||||
exec "@bindir@/guix" offload "$@"
|
||||
else
|
||||
exec guix offload "$@"
|
||||
fi
|
Loading…
Reference in a new issue