* If store paths are specified as sources in Nix expressions, don't

copy them, but use them directly.
This commit is contained in:
Eelco Dolstra 2005-04-07 14:35:01 +00:00
parent f9848d4f31
commit 10c429c757

View file

@ -125,14 +125,24 @@ static void processBinding(EvalState & state, Expr e, Derivation & drv,
else if (matchPath(e, s)) { else if (matchPath(e, s)) {
Path srcPath(canonPath(aterm2String(s))); Path srcPath(canonPath(aterm2String(s)));
if (isDerivation(srcPath))
throw Error(format("file names are not allowed to end in `%1%'") if (isStorePath(srcPath)) {
% drvExtension); printMsg(lvlChatty, format("using store path `%1%' as source")
Path dstPath(addToStore(srcPath)); % srcPath);
printMsg(lvlChatty, format("copied source `%1%' -> `%2%'") drv.inputSrcs.insert(srcPath);
% srcPath % dstPath); ss.push_back(srcPath);
drv.inputSrcs.insert(dstPath); }
ss.push_back(dstPath);
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)) { else if (matchList(e, es)) {