From f6919ebdc6b0ce0286814cc6ab0564b1a4c67f5f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 4 Sep 2019 11:04:44 +0200 Subject: daemon: Run 'guix substitute' directly and assume a single substituter. The daemon had a mechanism that allows it to handle a list of substituters and try them sequentially; this removes it. * nix/scripts/substitute.in: Remove. * nix/local.mk (nodist_pkglibexec_SCRIPTS): Remove. * config-daemon.ac: Don't output 'nix/scripts/substitute'. * nix/libstore/build.cc (SubstitutionGoal)[subs, sub, hasSubstitute]: Remove. [tryNext]: Make private. (SubstitutionGoal::SubstitutionGoal, SubstitutionGoal::init): Remove now unneeded initializers. (SubstitutionGoal::tryNext): Adjust to assume a single substituter: call 'amDone' upfront when we couldn't find substitutes. (SubstitutionGoal::tryToRun): Adjust to run 'guix substitute' via 'settings.guixProgram'. (SubstitutionGoal::finished): Call 'amDone(ecFailed)' upon failure instead of setting 'state' to 'tryNext'. * nix/libstore/globals.hh (Settings)[substituters]: Remove. * nix/libstore/local-store.cc (LocalStore::~LocalStore): Adjust to handle a single substituter. (LocalStore::startSubstituter): Remove 'path' parameter. Adjust to invoke 'settings.guixProgram'. Don't refer to 'run.program', which no longer exists. (LocalStore::querySubstitutablePaths): Adjust for 'runningSubstituters' being a singleton instead of a list. (LocalStore::querySubstitutablePathInfos): Likewise, and remove 'substituter' parameter. * nix/libstore/local-store.hh (RunningSubstituter)[program]: Remove. (LocalStore)[runningSubstituters]: Remove. [runningSubstituter]: New field. [querySubstitutablePathInfos]: Remove 'substituter' parameter. [startSubstituter]: Remove 'substituter' parameter. * nix/nix-daemon/guix-daemon.cc (main): Remove references to 'settings.substituters'. * nix/nix-daemon/nix-daemon.cc (performOp): Ignore the user's "build-use-substitutes" value when 'settings.useSubstitutes' is false. --- nix/libstore/local-store.hh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'nix/libstore/local-store.hh') diff --git a/nix/libstore/local-store.hh b/nix/libstore/local-store.hh index 4e6b4cfc1d..4113fafcb5 100644 --- a/nix/libstore/local-store.hh +++ b/nix/libstore/local-store.hh @@ -40,7 +40,6 @@ struct OptimiseStats struct RunningSubstituter { - Path program; Pid pid; AutoCloseFD to, from, error; FdSource fromBuf; @@ -52,8 +51,8 @@ struct RunningSubstituter class LocalStore : public StoreAPI { private: - typedef std::map RunningSubstituters; - RunningSubstituters runningSubstituters; + /* The currently running substituter or empty. */ + std::unique_ptr runningSubstituter; Path linksDir; @@ -93,8 +92,8 @@ public: PathSet querySubstitutablePaths(const PathSet & paths); - void querySubstitutablePathInfos(const Path & substituter, - PathSet & paths, SubstitutablePathInfos & infos); + void querySubstitutablePathInfos(PathSet & paths, + SubstitutablePathInfos & infos); void querySubstitutablePathInfos(const PathSet & paths, SubstitutablePathInfos & infos); @@ -261,8 +260,7 @@ private: void removeUnusedLinks(const GCState & state); - void startSubstituter(const Path & substituter, - RunningSubstituter & runningSubstituter); + void startSubstituter(RunningSubstituter & runningSubstituter); string getLineFromSubstituter(RunningSubstituter & run); -- cgit 1.4.1