mirror of
https://github.com/NixOS/nix.git
synced 2025-11-17 16:02:43 +01:00
Simplify DerivationGoal loop -> if
More taking advantage of single wanted output. Also `auto *` not `auto` for easy reading.
This commit is contained in:
parent
1a6f92837a
commit
2600391147
1 changed files with 4 additions and 9 deletions
|
|
@ -126,23 +126,18 @@ Goal::Co DerivationGoal::haveDerivation()
|
||||||
experimentalFeatureSettings.require(Xp::ImpureDerivations);
|
experimentalFeatureSettings.require(Xp::ImpureDerivations);
|
||||||
|
|
||||||
auto outputHashes = staticOutputHashes(worker.evalStore, *drv);
|
auto outputHashes = staticOutputHashes(worker.evalStore, *drv);
|
||||||
for (auto & [outputName, outputHash] : outputHashes) {
|
if (auto * mOutputHash = get(outputHashes, wantedOutput)) {
|
||||||
if (outputName != wantedOutput)
|
outputHash = *mOutputHash;
|
||||||
continue;
|
|
||||||
|
|
||||||
this->outputHash = outputHash;
|
|
||||||
|
|
||||||
/* TODO we might want to also allow randomizing the paths
|
/* TODO we might want to also allow randomizing the paths
|
||||||
for regular CA derivations, e.g. for sake of checking
|
for regular CA derivations, e.g. for sake of checking
|
||||||
determinism. */
|
determinism. */
|
||||||
if (impure) {
|
if (impure) {
|
||||||
outputKnown = InitialOutputStatus{
|
outputKnown = InitialOutputStatus{
|
||||||
.path = StorePath::random(outputPathName(drv->name, outputName)),
|
.path = StorePath::random(outputPathName(drv->name, wantedOutput)),
|
||||||
.status = PathStatus::Absent,
|
.status = PathStatus::Absent,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (impure) {
|
if (impure) {
|
||||||
|
|
@ -247,7 +242,7 @@ Goal::Co DerivationGoal::repairClosure()
|
||||||
}();
|
}();
|
||||||
|
|
||||||
StorePathSet outputClosure;
|
StorePathSet outputClosure;
|
||||||
if (auto mPath = get(outputs, wantedOutput)) {
|
if (auto * mPath = get(outputs, wantedOutput)) {
|
||||||
worker.store.computeFSClosure(*mPath, outputClosure);
|
worker.store.computeFSClosure(*mPath, outputClosure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue