diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-04-07T14·35+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-04-07T14·35+0000 |
commit | 10c429c757625c4c36319751f6d87b8990677c1f (patch) | |
tree | e72e2460f91040891a9937623b9bf81428bd57fe /src | |
parent | f9848d4f3122b8a43b69d53277b606806bdba9dd (diff) |
* If store paths are specified as sources in Nix expressions, don't
copy them, but use them directly.
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/primops.cc | 26 |
1 files changed, 18 insertions, 8 deletions
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)) { |