From 10c429c757625c4c36319751f6d87b8990677c1f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 7 Apr 2005 14:35:01 +0000 Subject: * If store paths are specified as sources in Nix expressions, don't copy them, but use them directly. --- src/libexpr/primops.cc | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/libexpr') diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 03d36638d4b4..4f0a9f1bdbf5 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -125,14 +125,24 @@ static void processBinding(EvalState & state, Expr e, Derivation & drv, else if (matchPath(e, s)) { Path srcPath(canonPath(aterm2String(s))); - if (isDerivation(srcPath)) - throw Error(format("file names are not allowed to end in `%1%'") - % drvExtension); - Path dstPath(addToStore(srcPath)); - printMsg(lvlChatty, format("copied source `%1%' -> `%2%'") - % srcPath % dstPath); - drv.inputSrcs.insert(dstPath); - ss.push_back(dstPath); + + if (isStorePath(srcPath)) { + printMsg(lvlChatty, format("using store path `%1%' as source") + % srcPath); + drv.inputSrcs.insert(srcPath); + ss.push_back(srcPath); + } + + else { + if (isDerivation(srcPath)) + throw Error(format("file names are not allowed to end in `%1%'") + % drvExtension); + Path dstPath(addToStore(srcPath)); + printMsg(lvlChatty, format("copied source `%1%' -> `%2%'") + % srcPath % dstPath); + drv.inputSrcs.insert(dstPath); + ss.push_back(dstPath); + } } else if (matchList(e, es)) { -- cgit 1.4.1