diff --git a/src/libstore/build/derivation-building-goal.cc b/src/libstore/build/derivation-building-goal.cc index c72130142..025e995f2 100644 --- a/src/libstore/build/derivation-building-goal.cc +++ b/src/libstore/build/derivation-building-goal.cc @@ -155,6 +155,12 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution(bool storeDerivation) /* Determine the full set of input paths. */ + /** + * All input paths (that is, the union of FS closures of the + * immediate input paths). + */ + StorePathSet inputPaths; + if (storeDerivation) { assert(drv->inputDrvs.map.empty()); /* Store the resolved derivation, as part of the record of @@ -201,11 +207,9 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution(bool storeDerivation) slot to become available, since we don't need one if there is a build hook. */ co_await yield(); - co_return tryToBuild(); -} -Goal::Co DerivationBuildingGoal::tryToBuild() -{ +tryToBuild: + std::map initialOutputs; /* Recheck at this point. In particular, whereas before we were @@ -350,7 +354,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild() if (buildLocally) { useHook = false; } else { - switch (tryBuildHook(initialOutputs)) { + switch (tryBuildHook(inputPaths, initialOutputs)) { case rpAccept: /* Yes, it has started doing so. Wait until we get EOF from the hook. */ @@ -527,7 +531,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild() if (curBuilds >= settings.maxBuildJobs) { outputLocks.unlock(); co_await waitForBuildSlot(); - co_return tryToBuild(); + goto tryToBuild; } if (!builder) { @@ -803,7 +807,8 @@ BuildError DerivationBuildingGoal::fixupBuilderFailureErrorMessage(BuilderFailur return BuildError{e.status, msg}; } -HookReply DerivationBuildingGoal::tryBuildHook(const std::map & initialOutputs) +HookReply DerivationBuildingGoal::tryBuildHook( + const StorePathSet & inputPaths, const std::map & initialOutputs) { #ifdef _WIN32 // TODO enable build hook on Windows return rpDecline; diff --git a/src/libstore/include/nix/store/build/derivation-building-goal.hh b/src/libstore/include/nix/store/build/derivation-building-goal.hh index 547e533e2..ac5bd43f6 100644 --- a/src/libstore/include/nix/store/build/derivation-building-goal.hh +++ b/src/libstore/include/nix/store/build/derivation-building-goal.hh @@ -58,12 +58,6 @@ private: * The remainder is state held during the build. */ - /** - * All input paths (that is, the union of FS closures of the - * immediate input paths). - */ - StorePathSet inputPaths; - /** * File descriptor for the log file. */ @@ -110,12 +104,12 @@ private: * The states. */ Co gaveUpOnSubstitution(bool storeDerivation); - Co tryToBuild(); /** * Is the build hook willing to perform the build? */ - HookReply tryBuildHook(const std::map & initialOutputs); + HookReply + tryBuildHook(const StorePathSet & inputPaths, const std::map & initialOutputs); /** * Open a log file and a pipe to it.