mirror of
https://github.com/NixOS/nix
synced 2025-06-28 17:51:15 +02:00
Merge pull request #12692 from obsidiansystems/small-derivation-goal-cleanups
Small derivation goal cleanups
This commit is contained in:
commit
c97f779dbb
3 changed files with 19 additions and 17 deletions
|
@ -533,9 +533,6 @@ Goal::Co DerivationGoal::gaveUpOnSubstitution()
|
||||||
|
|
||||||
debug("added input paths %s", worker.store.showPaths(inputPaths));
|
debug("added input paths %s", worker.store.showPaths(inputPaths));
|
||||||
|
|
||||||
/* What type of derivation are we building? */
|
|
||||||
derivationType = drv->type();
|
|
||||||
|
|
||||||
/* Okay, try to build. Note that here we don't wait for a build
|
/* Okay, try to build. Note that here we don't wait for a build
|
||||||
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. */
|
||||||
|
@ -597,17 +594,19 @@ Goal::Co DerivationGoal::tryToBuild()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!outputLocks.lockPaths(lockFiles, "", false)) {
|
if (!outputLocks.lockPaths(lockFiles, "", false))
|
||||||
if (!actLock)
|
{
|
||||||
actLock = std::make_unique<Activity>(*logger, lvlWarn, actBuildWaiting,
|
Activity act(*logger, lvlWarn, actBuildWaiting,
|
||||||
fmt("waiting for lock on %s", Magenta(showPaths(lockFiles))));
|
fmt("waiting for lock on %s", Magenta(showPaths(lockFiles))));
|
||||||
|
|
||||||
|
/* Wait then try locking again, repeat until success (returned
|
||||||
|
boolean is true). */
|
||||||
|
do {
|
||||||
worker.waitForAWhile(shared_from_this());
|
worker.waitForAWhile(shared_from_this());
|
||||||
co_await Suspend{};
|
co_await Suspend{};
|
||||||
co_return tryToBuild();
|
} while (!outputLocks.lockPaths(lockFiles, "", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
actLock.reset();
|
|
||||||
|
|
||||||
/* Now check again whether the outputs are valid. This is because
|
/* Now check again whether the outputs are valid. This is because
|
||||||
another process may have started building in parallel. After
|
another process may have started building in parallel. After
|
||||||
it has finished and released the locks, we can (and should)
|
it has finished and released the locks, we can (and should)
|
||||||
|
|
|
@ -198,11 +198,6 @@ struct DerivationGoal : public Goal
|
||||||
std::unique_ptr<HookInstance> hook;
|
std::unique_ptr<HookInstance> hook;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* The sort of derivation we are building.
|
|
||||||
*/
|
|
||||||
std::optional<DerivationType> derivationType;
|
|
||||||
|
|
||||||
BuildMode buildMode;
|
BuildMode buildMode;
|
||||||
|
|
||||||
std::unique_ptr<MaintainCount<uint64_t>> mcExpectedBuilds, mcRunningBuilds;
|
std::unique_ptr<MaintainCount<uint64_t>> mcExpectedBuilds, mcRunningBuilds;
|
||||||
|
|
|
@ -150,6 +150,13 @@ struct LocalDerivationGoal : DerivationGoal, RestrictionContext
|
||||||
*/
|
*/
|
||||||
std::shared_ptr<AutoDelete> autoDelChroot;
|
std::shared_ptr<AutoDelete> autoDelChroot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sort of derivation we are building.
|
||||||
|
*
|
||||||
|
* Just a cached value, can be recomputed from `drv`.
|
||||||
|
*/
|
||||||
|
std::optional<DerivationType> derivationType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stuff we need to pass to initChild().
|
* Stuff we need to pass to initChild().
|
||||||
*/
|
*/
|
||||||
|
@ -478,7 +485,8 @@ Goal::Co LocalDerivationGoal::tryLocalBuild()
|
||||||
co_return tryToBuild();
|
co_return tryToBuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(derivationType);
|
/* Cache this */
|
||||||
|
derivationType = drv->type();
|
||||||
|
|
||||||
/* Are we doing a chroot build? */
|
/* Are we doing a chroot build? */
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue