aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2021-05-19 16:27:09 +0200
committerregnat <rg@regnat.ovh>2021-06-23 11:27:16 +0200
commitd32cf0c17a3e5e139c384375084d9eb6aa428c3b (patch)
tree413268d41ee42edc6303a9568da854b010ecec40 /src/libstore
parentb8f7177a7b2e884cbfb8bbe3c1ee8d586159fbb3 (diff)
Gracefully ignore a substituter if it holds an incompatible realisation
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build/drv-output-substitution-goal.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/libstore/build/drv-output-substitution-goal.cc b/src/libstore/build/drv-output-substitution-goal.cc
index 1703e845d..ec3a8d758 100644
--- a/src/libstore/build/drv-output-substitution-goal.cc
+++ b/src/libstore/build/drv-output-substitution-goal.cc
@@ -17,6 +17,13 @@ DrvOutputSubstitutionGoal::DrvOutputSubstitutionGoal(const DrvOutput& id, Worker
void DrvOutputSubstitutionGoal::init()
{
trace("init");
+
+ /* If the derivation already exists, we’re done */
+ if (worker.store.queryRealisation(id)) {
+ amDone(ecSuccess);
+ return;
+ }
+
subs = settings.useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>();
tryNext();
}
@@ -53,9 +60,18 @@ void DrvOutputSubstitutionGoal::tryNext()
return;
}
- for (const auto & [drvOutputDep, _] : outputInfo->dependentRealisations) {
- if (drvOutputDep != id) {
- addWaitee(worker.makeDrvOutputSubstitutionGoal(drvOutputDep));
+ for (const auto & [depId, depPath] : outputInfo->dependentRealisations) {
+ if (depId != id) {
+ if (auto localOutputInfo = worker.store.queryRealisation(depId);
+ localOutputInfo && localOutputInfo->outPath != depPath) {
+ warn(
+ "substituter '%s' has an incompatible realisation for '%s', ignoring",
+ sub->getUri(),
+ depId.to_string());
+ tryNext();
+ return;
+ }
+ addWaitee(worker.makeDrvOutputSubstitutionGoal(depId));
}
}