aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-07-20 14:39:21 +0200
committerGitHub <noreply@github.com>2021-07-20 14:39:21 +0200
commitdd7bcf3e1cf63a25cda4080fe70565353c358795 (patch)
treeffea44c1494c39df65233816dc5b965e91f154f9 /src/libstore
parent1af3f63be53018ab764090acab36e7c5401609cd (diff)
parent87077739658b35863fb56131fd7099294c181ee5 (diff)
Merge pull request #5030 from NixOS/lock-ca-derivations
Properly lock the builds of CA derivations
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build/derivation-goal.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc
index 06f854629..7df597400 100644
--- a/src/libstore/build/derivation-goal.cc
+++ b/src/libstore/build/derivation-goal.cc
@@ -544,7 +544,7 @@ void DerivationGoal::tryToBuild()
PathSet lockFiles;
/* FIXME: Should lock something like the drv itself so we don't build same
CA drv concurrently */
- if (dynamic_cast<LocalStore *>(&worker.store))
+ if (dynamic_cast<LocalStore *>(&worker.store)) {
/* If we aren't a local store, we might need to use the local store as
a build remote, but that would cause a deadlock. */
/* FIXME: Make it so we can use ourselves as a build remote even if we
@@ -552,9 +552,15 @@ void DerivationGoal::tryToBuild()
/* FIXME: find some way to lock for scheduling for the other stores so
a forking daemon with --store still won't farm out redundant builds.
*/
- for (auto & i : drv->outputsAndOptPaths(worker.store))
+ for (auto & i : drv->outputsAndOptPaths(worker.store)) {
if (i.second.second)
lockFiles.insert(worker.store.Store::toRealPath(*i.second.second));
+ else
+ lockFiles.insert(
+ worker.store.Store::toRealPath(drvPath) + "!" + i.first
+ );
+ }
+ }
if (!outputLocks.lockPaths(lockFiles, "", false)) {
if (!actLock)