diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-06-23 11:50:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 11:50:18 +0200 |
commit | 0a535dd5ac93576f7152d786464e330ae3d46b50 (patch) | |
tree | 03eeb91417ed9283b5ae7dcb73c1af7a503dfb47 /src/libstore/build | |
parent | f9f773b33296ed0e8cc4bc12672030ed905dd410 (diff) | |
parent | c878cee8954151aaa1054af7ef3746a979b05832 (diff) |
Merge pull request #4839 from NixOS/ca/gracefully-handle-duplicate-realisations
Gracefully handle duplicate realisations
Diffstat (limited to 'src/libstore/build')
-rw-r--r-- | src/libstore/build/drv-output-substitution-goal.cc | 27 |
1 files changed, 24 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..be270d079 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,23 @@ 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.\n" + "Local: %s\n" + "Remote: %s", + sub->getUri(), + depId.to_string(), + worker.store.printStorePath(localOutputInfo->outPath), + worker.store.printStorePath(depPath) + ); + tryNext(); + return; + } + addWaitee(worker.makeDrvOutputSubstitutionGoal(depId)); } } |