mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 20:16:03 +01:00
DerivationGoal::done Clean up parameter types
We don't need to ask all these callers to build these single-entry maps for us.
This commit is contained in:
parent
c940283750
commit
f155dffe59
2 changed files with 14 additions and 7 deletions
|
|
@ -93,7 +93,7 @@ Goal::Co DerivationGoal::haveDerivation()
|
||||||
|
|
||||||
/* If they are all valid, then we're done. */
|
/* If they are all valid, then we're done. */
|
||||||
if (checkResult && checkResult->second == PathStatus::Valid && buildMode == bmNormal) {
|
if (checkResult && checkResult->second == PathStatus::Valid && buildMode == bmNormal) {
|
||||||
co_return done(BuildResult::AlreadyValid, {{wantedOutput, checkResult->first}});
|
co_return done(BuildResult::AlreadyValid, checkResult->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
Goals waitees;
|
Goals waitees;
|
||||||
|
|
@ -136,7 +136,7 @@ Goal::Co DerivationGoal::haveDerivation()
|
||||||
bool allValid = checkResult && checkResult->second == PathStatus::Valid;
|
bool allValid = checkResult && checkResult->second == PathStatus::Valid;
|
||||||
|
|
||||||
if (buildMode == bmNormal && allValid) {
|
if (buildMode == bmNormal && allValid) {
|
||||||
co_return done(BuildResult::Substituted, {{wantedOutput, checkResult->first}});
|
co_return done(BuildResult::Substituted, checkResult->first);
|
||||||
}
|
}
|
||||||
if (buildMode == bmRepair && allValid) {
|
if (buildMode == bmRepair && allValid) {
|
||||||
co_return repairClosure();
|
co_return repairClosure();
|
||||||
|
|
@ -280,7 +280,7 @@ Goal::Co DerivationGoal::repairClosure()
|
||||||
"some paths in the output closure of derivation '%s' could not be repaired",
|
"some paths in the output closure of derivation '%s' could not be repaired",
|
||||||
worker.store.printStorePath(drvPath));
|
worker.store.printStorePath(drvPath));
|
||||||
}
|
}
|
||||||
co_return done(BuildResult::AlreadyValid, {{wantedOutput, assertPathValidity()}});
|
co_return done(BuildResult::AlreadyValid, assertPathValidity());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::pair<Realisation, PathStatus>> DerivationGoal::checkPathValidity()
|
std::optional<std::pair<Realisation, PathStatus>> DerivationGoal::checkPathValidity()
|
||||||
|
|
@ -338,7 +338,8 @@ Realisation DerivationGoal::assertPathValidity()
|
||||||
return checkResult->first;
|
return checkResult->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
Goal::Done DerivationGoal::done(BuildResult::Status status, SingleDrvOutputs builtOutputs, std::optional<Error> ex)
|
Goal::Done
|
||||||
|
DerivationGoal::done(BuildResult::Status status, std::optional<Realisation> builtOutput, std::optional<Error> ex)
|
||||||
{
|
{
|
||||||
buildResult.status = status;
|
buildResult.status = status;
|
||||||
if (ex)
|
if (ex)
|
||||||
|
|
@ -351,8 +352,8 @@ Goal::Done DerivationGoal::done(BuildResult::Status status, SingleDrvOutputs bui
|
||||||
mcExpectedBuilds.reset();
|
mcExpectedBuilds.reset();
|
||||||
|
|
||||||
if (buildResult.success()) {
|
if (buildResult.success()) {
|
||||||
assert(!builtOutputs.empty());
|
assert(builtOutput);
|
||||||
buildResult.builtOutputs = std::move(builtOutputs);
|
buildResult.builtOutputs = {{wantedOutput, std::move(*builtOutput)}};
|
||||||
if (status == BuildResult::Built)
|
if (status == BuildResult::Built)
|
||||||
worker.doneBuilds++;
|
worker.doneBuilds++;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,13 @@ private:
|
||||||
|
|
||||||
Co repairClosure();
|
Co repairClosure();
|
||||||
|
|
||||||
Done done(BuildResult::Status status, SingleDrvOutputs builtOutputs = {}, std::optional<Error> ex = {});
|
/**
|
||||||
|
* @param builtOutput Must be set if `status` is successful.
|
||||||
|
*/
|
||||||
|
Done done(
|
||||||
|
BuildResult::Status status,
|
||||||
|
std::optional<Realisation> builtOutput = std::nullopt,
|
||||||
|
std::optional<Error> ex = {});
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nix
|
} // namespace nix
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue