Skip to content

Commit 4e776a5

Browse files
authored
Merge pull request NixOS#13753 from obsidiansystems/simplify-derivation-goal
Simplify `DerivationGoal` in many ways
2 parents f64000e + 4a2de1d commit 4e776a5

File tree

5 files changed

+173
-225
lines changed

5 files changed

+173
-225
lines changed

src/libstore/build/derivation-building-goal.cc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,33 @@ std::string showKnownOutputs(Store & store, const Derivation & drv)
151151
produced using a substitute. So we have to build instead. */
152152
Goal::Co DerivationBuildingGoal::gaveUpOnSubstitution()
153153
{
154+
/* Recheck at goal start. In particular, whereas before we were
155+
given this information by the downstream goal, that cannot happen
156+
anymore if the downstream goal only cares about one output, but
157+
we care about all outputs. */
158+
auto outputHashes = staticOutputHashes(worker.evalStore, *drv);
159+
for (auto & [outputName, outputHash] : outputHashes) {
160+
InitialOutput v{
161+
.wanted = true, // Will be refined later
162+
.outputHash = outputHash};
163+
164+
/* TODO we might want to also allow randomizing the paths
165+
for regular CA derivations, e.g. for sake of checking
166+
determinism. */
167+
if (drv->type().isImpure()) {
168+
v.known = InitialOutputStatus{
169+
.path = StorePath::random(outputPathName(drv->name, outputName)),
170+
.status = PathStatus::Absent,
171+
};
172+
}
173+
174+
initialOutputs.insert({
175+
outputName,
176+
std::move(v),
177+
});
178+
}
179+
checkPathValidity();
180+
154181
Goals waitees;
155182

156183
std::map<ref<const SingleDerivedPath>, GoalPtr, value_comparison> inputGoals;

0 commit comments

Comments
 (0)