diff options
author | jade <lix@jade.fyi> | 2024-08-25 20:00:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@localhost> | 2024-08-25 20:00:58 +0000 |
commit | 72f91767a898e0e918ae377193b58c19a97eec56 (patch) | |
tree | 516ef249ec51110550834efdd1c13db938165c54 /src/libstore/build/derivation-goal.cc | |
parent | 3bf8819fa2717176c9b3bfc24281b3428c431e71 (diff) | |
parent | 686120ee4a34f658b2f19dcac9f9dc44dbc98b93 (diff) |
Merge "fix: good errors for failures caused by allowSubstitutes" into main
Diffstat (limited to 'src/libstore/build/derivation-goal.cc')
-rw-r--r-- | src/libstore/build/derivation-goal.cc | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index f31c3acd5..0f082b193 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -261,24 +261,29 @@ Goal::WorkResult DerivationGoal::haveDerivation(bool inBuildSlot) through substitutes. If that doesn't work, we'll build them. */ WaitForGoals result; - if (settings.useSubstitutes && parsedDrv->substitutesAllowed()) - for (auto & [outputName, status] : initialOutputs) { - if (!status.wanted) continue; - if (!status.known) - result.goals.insert( - worker.makeDrvOutputSubstitutionGoal( - DrvOutput{status.outputHash, outputName}, - buildMode == bmRepair ? Repair : NoRepair - ) - ); - else { - auto * cap = getDerivationCA(*drv); - result.goals.insert(worker.makePathSubstitutionGoal( - status.known->path, - buildMode == bmRepair ? Repair : NoRepair, - cap ? std::optional { *cap } : std::nullopt)); + if (settings.useSubstitutes) { + if (parsedDrv->substitutesAllowed()) { + for (auto & [outputName, status] : initialOutputs) { + if (!status.wanted) continue; + if (!status.known) + result.goals.insert( + worker.makeDrvOutputSubstitutionGoal( + DrvOutput{status.outputHash, outputName}, + buildMode == bmRepair ? Repair : NoRepair + ) + ); + else { + auto * cap = getDerivationCA(*drv); + result.goals.insert(worker.makePathSubstitutionGoal( + status.known->path, + buildMode == bmRepair ? Repair : NoRepair, + cap ? std::optional { *cap } : std::nullopt)); + } } + } else { + trace("skipping substitute because allowSubstitutes is false"); } + } if (result.goals.empty()) { /* to prevent hang (no wake-up event) */ return outputsSubstitutionTried(inBuildSlot); |