Gracefully ignore a substituter if it holds an incompatible realisation

This commit is contained in:
regnat 2021-05-19 16:27:09 +02:00
parent b8f7177a7b
commit d32cf0c17a

View file

@ -17,6 +17,13 @@ DrvOutputSubstitutionGoal::DrvOutputSubstitutionGoal(const DrvOutput& id, Worker
void DrvOutputSubstitutionGoal::init() void DrvOutputSubstitutionGoal::init()
{ {
trace("init"); trace("init");
/* If the derivation already exists, were done */
if (worker.store.queryRealisation(id)) {
amDone(ecSuccess);
return;
}
subs = settings.useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>(); subs = settings.useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>();
tryNext(); tryNext();
} }
@ -53,9 +60,18 @@ void DrvOutputSubstitutionGoal::tryNext()
return; return;
} }
for (const auto & [drvOutputDep, _] : outputInfo->dependentRealisations) { for (const auto & [depId, depPath] : outputInfo->dependentRealisations) {
if (drvOutputDep != id) { if (depId != id) {
addWaitee(worker.makeDrvOutputSubstitutionGoal(drvOutputDep)); 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));
} }
} }