libexpr: Migrate EvalState::mkOutputString to return a Value
part of #1136 and a small step toward resolving #744 Change-Id: I4e1602b37c40517a92cbab8fe4074d7e6a6a6964
This commit is contained in:
+2
-6
@@ -882,13 +882,9 @@ std::string EvalState::mkOutputStringRaw(
|
||||
return ctx.store->printStorePath(staticOutputPath);
|
||||
}
|
||||
|
||||
|
||||
void EvalState::mkOutputString(
|
||||
Value & value,
|
||||
const SingleDerivedPath::Built & b,
|
||||
const StorePath & staticOutputPath)
|
||||
Value EvalState::mkOutputString(const SingleDerivedPath::Built & b, const StorePath & staticOutputPath)
|
||||
{
|
||||
value = {NewValueAs::string, mkOutputStringRaw(staticOutputPath), NixStringContext{b}};
|
||||
return {NewValueAs::string, mkOutputStringRaw(staticOutputPath), NixStringContext{b}};
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-6
@@ -809,18 +809,13 @@ public:
|
||||
* single `NixStringContextElem::Built` element of the drv path and
|
||||
* output name.
|
||||
*
|
||||
* @param value Value we are settings
|
||||
*
|
||||
* @param b the drv whose output we are making a string for, and the
|
||||
* output
|
||||
*
|
||||
* @param staticOutputPath Output path for that string.
|
||||
* Will be printed to form string.
|
||||
*/
|
||||
void mkOutputString(
|
||||
Value & value,
|
||||
const SingleDerivedPath::Built & b,
|
||||
const StorePath & staticOutputPath);
|
||||
Value mkOutputString(const SingleDerivedPath::Built & b, const StorePath & staticOutputPath);
|
||||
|
||||
/**
|
||||
* Create a string representing a `SingleDerivedPath`.
|
||||
|
||||
@@ -158,13 +158,13 @@ static void mkOutputString(
|
||||
const StorePath & drvPath,
|
||||
const std::pair<std::string, DerivationOutput> & o)
|
||||
{
|
||||
state.mkOutputString(
|
||||
attrs.alloc(o.first),
|
||||
SingleDerivedPath::Built {
|
||||
attrs.alloc(o.first) = state.mkOutputString(
|
||||
SingleDerivedPath::Built{
|
||||
.drvPath = makeConstantStorePath(drvPath),
|
||||
.output = o.first,
|
||||
},
|
||||
o.second.path(*state.ctx.store, Derivation::nameFromPath(drvPath), o.first));
|
||||
o.second.path(*state.ctx.store, Derivation::nameFromPath(drvPath), o.first)
|
||||
);
|
||||
}
|
||||
|
||||
/* Load and evaluate an expression from path specified by the
|
||||
|
||||
@@ -41,8 +41,7 @@ RC_GTEST_FIXTURE_PROP(
|
||||
prop_derived_path_built_out_path_round_trip,
|
||||
(const SingleDerivedPath::Built & b, const StorePath & outPath))
|
||||
{
|
||||
Value v;
|
||||
state.mkOutputString(v, b, outPath);
|
||||
Value v = state.mkOutputString(b, outPath);
|
||||
auto [d, _] = state.coerceToSingleDerivedPathUnchecked(noPos, v, "");
|
||||
RC_ASSERT(SingleDerivedPath { b } == d);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user