builtins.storePath: resolve symlinks
Needed for Charon/Hydra interaction.
This commit is contained in:
parent
eae802459d
commit
a7a43adb79
1 changed files with 5 additions and 1 deletions
|
@ -502,7 +502,11 @@ static void prim_toPath(EvalState & state, Value * * args, Value & v)
|
||||||
static void prim_storePath(EvalState & state, Value * * args, Value & v)
|
static void prim_storePath(EvalState & state, Value * * args, Value & v)
|
||||||
{
|
{
|
||||||
PathSet context;
|
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))
|
if (!isInStore(path))
|
||||||
throw EvalError(format("path `%1%' is not in the Nix store") % path);
|
throw EvalError(format("path `%1%' is not in the Nix store") % path);
|
||||||
Path path2 = toStorePath(path);
|
Path path2 = toStorePath(path);
|
||||||
|
|
Loading…
Reference in a new issue