1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 23:11:16 +02:00

Add EvalState::allowAndSetStorePathString helper

This switches addPath from `printStorePath` to `toRealPath`.
This commit is contained in:
Robert Hensing 2022-02-27 15:59:34 +01:00
parent 158280d8e9
commit ee019d0afc
4 changed files with 18 additions and 19 deletions

View file

@ -185,13 +185,6 @@ static void prim_fetchTree(EvalState & state, const Pos & pos, Value * * args, V
// FIXME: document
static RegisterPrimOp primop_fetchTree("fetchTree", 1, prim_fetchTree);
static void setStorePath(EvalState &state, const StorePath &storePath, Value &v) {
state.allowPath(storePath);
auto path = state.store->printStorePath(storePath);
v.mkString(path, PathSet({path}));
}
static void fetch(EvalState & state, const Pos & pos, Value * * args, Value & v,
const std::string & who, bool unpack, std::string name)
{
@ -248,7 +241,7 @@ static void fetch(EvalState & state, const Pos & pos, Value * * args, Value & v,
auto validPaths = state.store->queryValidPaths({expectedPath}, NoSubstitute);
if (!validPaths.empty()) {
setStorePath(state, expectedPath, v);
state.allowAndSetStorePathString(expectedPath, v);
return;
}
}
@ -267,7 +260,7 @@ static void fetch(EvalState & state, const Pos & pos, Value * * args, Value & v,
*url, expectedHash->to_string(Base32, true), hash.to_string(Base32, true));
}
setStorePath(state, storePath, v);
state.allowAndSetStorePathString(storePath, v);
}
static void prim_fetchurl(EvalState & state, const Pos & pos, Value * * args, Value & v)