From b682fae9d93037af65282e02b88a9ce34129026e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 2 Feb 2009 17:24:10 +0000 Subject: * 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. --- src/libstore/local-store.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/libstore/local-store.cc') diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 159f28c91860..1d0c68cb88a5 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(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(dstPath)); if (!isValidPath(dstPath)) { -- cgit 1.4.1