libexpr: Migrate mkStorePathString to return a Value
part of #1136 Change-Id: I32ba0f8ef369a82ceb8f75816a2ce6dc6a6a6964
This commit is contained in:
@@ -111,7 +111,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
|
||||
/* Construct a Nix expression that calls the user environment
|
||||
builder with the manifest as argument. */
|
||||
auto attrs = state.ctx.buildBindings(3);
|
||||
state.ctx.paths.mkStorePathString(manifestFile, attrs.alloc("manifest"));
|
||||
attrs.alloc("manifest") = state.ctx.paths.mkStorePathString(manifestFile);
|
||||
attrs.insert(state.ctx.symbols.create("derivations"), vManifest);
|
||||
Value args = {NewValueAs::attrs, attrs};
|
||||
|
||||
|
||||
+3
-4
@@ -438,7 +438,7 @@ void EvalPaths::allowAndSetStorePathString(const StorePath & storePath, Value &
|
||||
{
|
||||
allowPath(storePath);
|
||||
|
||||
mkStorePathString(storePath, v);
|
||||
v = mkStorePathString(storePath);
|
||||
}
|
||||
|
||||
CheckedSourcePath EvalPaths::checkSourcePath(const SourcePath & path_)
|
||||
@@ -865,10 +865,9 @@ void EvalState::mkPos(Value & v, PosIdx p)
|
||||
v.mkNull();
|
||||
}
|
||||
|
||||
|
||||
void EvalPaths::mkStorePathString(const StorePath & p, Value & v)
|
||||
Value EvalPaths::mkStorePathString(const StorePath & p)
|
||||
{
|
||||
v = {
|
||||
return {
|
||||
NewValueAs::string,
|
||||
store->printStorePath(p),
|
||||
NixStringContext{
|
||||
|
||||
+1
-1
@@ -449,7 +449,7 @@ public:
|
||||
* The string is the printed store path with a context containing a
|
||||
* single `NixStringContextElem::Opaque` element of that store path.
|
||||
*/
|
||||
void mkStorePathString(const StorePath & storePath, Value & v);
|
||||
Value mkStorePathString(const StorePath & storePath);
|
||||
};
|
||||
|
||||
struct EvalStatistics
|
||||
|
||||
@@ -88,7 +88,7 @@ void prim_fetchMercurial(EvalState & state, Value ** args, Value & v)
|
||||
auto [tree, input2] = state.aio.blockOn(input.fetch(state.ctx.store));
|
||||
|
||||
auto attrs2 = state.ctx.buildBindings(8);
|
||||
state.ctx.paths.mkStorePathString(tree.storePath, attrs2.alloc(state.ctx.symbols.sym_outPath));
|
||||
attrs2.alloc(state.ctx.symbols.sym_outPath) = state.ctx.paths.mkStorePathString(tree.storePath);
|
||||
if (input2.getRef())
|
||||
attrs2.alloc("branch") = {NewValueAs::string, *input2.getRef()};
|
||||
// Backward compatibility: set 'rev' to
|
||||
|
||||
@@ -26,7 +26,7 @@ Value emitTreeAttrs(
|
||||
|
||||
auto attrs = state.buildBindings(10);
|
||||
|
||||
state.paths.mkStorePathString(tree.storePath, attrs.alloc(state.symbols.sym_outPath));
|
||||
attrs.alloc(state.symbols.sym_outPath) = state.paths.mkStorePathString(tree.storePath);
|
||||
|
||||
// FIXME: support arbitrary input attributes.
|
||||
|
||||
|
||||
@@ -27,8 +27,7 @@ RC_GTEST_FIXTURE_PROP(
|
||||
prop_opaque_path_round_trip,
|
||||
(const SingleDerivedPath::Opaque & o))
|
||||
{
|
||||
Value v;
|
||||
evaluator.paths.mkStorePathString(o.path, v);
|
||||
Value v = evaluator.paths.mkStorePathString(o.path);
|
||||
auto d = state.coerceToSingleDerivedPath(noPos, v, "");
|
||||
RC_ASSERT(SingleDerivedPath { o } == d);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user