about summary refs log tree commit diff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-02-02T17·24+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-02-02T17·24+0000
commitb682fae9d93037af65282e02b88a9ce34129026e (patch)
tree2e349a7480d315561bf40864e405b51f9c3ee16d /src/libstore/local-store.cc
parent6f8c96d12399b747b5f41b5211a635d2801247c8 (diff)
* Build hooks: use nix-store --import. This prevents a redundant
  scan for runtime dependencies (i.e. the local machine shouldn't do a
  scan that the remote machine has already done).  Also pipe directly
  into `nix-store --import': don't use a temporary file.

Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 159f28c918..1d0c68cb88 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -924,7 +924,14 @@ Path LocalStore::importPath(bool requireSignature, Source & source)
 
     if (!isValidPath(dstPath)) {
 
-        PathLocks outputLock(singleton<PathSet, Path>(dstPath));
+        PathLocks outputLock;
+
+        /* Lock the output path.  But don't lock if we're being called
+           from a build hook (whose parent process already acquired a
+           lock on this path). */
+        Strings locksHeld = tokenizeString(getEnv("NIX_HELD_LOCKS"));
+        if (find(locksHeld.begin(), locksHeld.end(), dstPath) == locksHeld.end())
+            outputLock.lockPaths(singleton<PathSet, Path>(dstPath));
 
         if (!isValidPath(dstPath)) {