1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00
This commit is contained in:
John Ericson 2025-11-08 14:35:44 +01:00 committed by GitHub
commit 0c516f3505
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 15 deletions

View file

@ -155,6 +155,12 @@ Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution(bool storeDerivation)
/* Determine the full set of input paths. */ /* 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) { if (storeDerivation) {
assert(drv->inputDrvs.map.empty()); assert(drv->inputDrvs.map.empty());
/* Store the resolved derivation, as part of the record of /* 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 slot to become available, since we don't need one if there is a
build hook. */ build hook. */
co_await yield(); co_await yield();
co_return tryToBuild();
}
Goal::Co DerivationBuildingGoal::tryToBuild() tryToBuild:
{
std::map<std::string, InitialOutput> initialOutputs; std::map<std::string, InitialOutput> initialOutputs;
/* Recheck at this point. In particular, whereas before we were /* Recheck at this point. In particular, whereas before we were
@ -350,7 +354,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
if (buildLocally) { if (buildLocally) {
useHook = false; useHook = false;
} else { } else {
switch (tryBuildHook(initialOutputs)) { switch (tryBuildHook(inputPaths, initialOutputs)) {
case rpAccept: case rpAccept:
/* Yes, it has started doing so. Wait until we get /* Yes, it has started doing so. Wait until we get
EOF from the hook. */ EOF from the hook. */
@ -527,7 +531,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
if (curBuilds >= settings.maxBuildJobs) { if (curBuilds >= settings.maxBuildJobs) {
outputLocks.unlock(); outputLocks.unlock();
co_await waitForBuildSlot(); co_await waitForBuildSlot();
co_return tryToBuild(); goto tryToBuild;
} }
if (!builder) { if (!builder) {
@ -803,7 +807,8 @@ BuildError DerivationBuildingGoal::fixupBuilderFailureErrorMessage(BuilderFailur
return BuildError{e.status, msg}; return BuildError{e.status, msg};
} }
HookReply DerivationBuildingGoal::tryBuildHook(const std::map<std::string, InitialOutput> & initialOutputs) HookReply DerivationBuildingGoal::tryBuildHook(
const StorePathSet & inputPaths, const std::map<std::string, InitialOutput> & initialOutputs)
{ {
#ifdef _WIN32 // TODO enable build hook on Windows #ifdef _WIN32 // TODO enable build hook on Windows
return rpDecline; return rpDecline;

View file

@ -58,12 +58,6 @@ private:
* The remainder is state held during the build. * 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. * File descriptor for the log file.
*/ */
@ -110,12 +104,12 @@ private:
* The states. * The states.
*/ */
Co gaveUpOnSubstitution(bool storeDerivation); Co gaveUpOnSubstitution(bool storeDerivation);
Co tryToBuild();
/** /**
* Is the build hook willing to perform the build? * Is the build hook willing to perform the build?
*/ */
HookReply tryBuildHook(const std::map<std::string, InitialOutput> & initialOutputs); HookReply
tryBuildHook(const StorePathSet & inputPaths, const std::map<std::string, InitialOutput> & initialOutputs);
/** /**
* Open a log file and a pipe to it. * Open a log file and a pipe to it.