builtins.storePath: resolve symlinks

Needed for Charon/Hydra interaction.
This commit is contained in:
Eelco Dolstra 2012-07-12 18:25:01 -04:00
parent eae802459d
commit a7a43adb79
1 changed files with 5 additions and 1 deletions

View File

@ -502,7 +502,11 @@ static void prim_toPath(EvalState & state, Value * * args, Value & v)
static void prim_storePath(EvalState & state, Value * * args, Value & v)
{
PathSet context;
Path path = canonPath(state.coerceToPath(*args[0], context));
Path path = state.coerceToPath(*args[0], context);
/* Resolve symlinks in path, unless path itself is a symlink
directly in the store. The latter condition is necessary so
e.g. nix-push does the right thing. */
if (!isStorePath(path)) path = canonPath(path, true);
if (!isInStore(path))
throw EvalError(format("path `%1%' is not in the Nix store") % path);
Path path2 = toStorePath(path);