libstore: de-ref {Derived,Built}Path::Built drvPath
they're no longer recursive, so this is perfectly fine. Change-Id: If565a557f2c2074e2a96a7f89c51ff1c51146b36
This commit is contained in:
@@ -336,7 +336,7 @@ connected:
|
||||
));
|
||||
auto res = aio.blockOn(sshStore->buildPathsWithResults({
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(*drvPath),
|
||||
.drvPath = makeConstantStorePath(*drvPath),
|
||||
.outputs = OutputsSpec::All {},
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -355,7 +355,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a
|
||||
|
||||
auto bashDrv = drv->requireDrvPath(*state);
|
||||
pathsToBuild.push_back(DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(bashDrv),
|
||||
.drvPath = makeConstantStorePath(bashDrv),
|
||||
.outputs = OutputsSpec::Names {"out"},
|
||||
});
|
||||
pathsToCopy.insert(bashDrv);
|
||||
@@ -368,7 +368,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a
|
||||
}
|
||||
}
|
||||
|
||||
auto accumDerivedPath = [&](ref<SingleDerivedPath::Opaque> inputDrv, const StringSet & inputNode) {
|
||||
auto accumDerivedPath = [&](SingleDerivedPath::Opaque inputDrv, const StringSet & inputNode) {
|
||||
if (!inputNode.empty())
|
||||
pathsToBuild.push_back(DerivedPath::Built {
|
||||
.drvPath = inputDrv,
|
||||
@@ -386,7 +386,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a
|
||||
return !std::regex_search(store->printStorePath(inputDrv), regex::parse(exclude));
|
||||
}))
|
||||
{
|
||||
accumDerivedPath(makeConstantStorePathRef(inputDrv), inputNode);
|
||||
accumDerivedPath(makeConstantStorePath(inputDrv), inputNode);
|
||||
pathsToCopy.insert(inputDrv);
|
||||
}
|
||||
}
|
||||
@@ -571,7 +571,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a
|
||||
throw Error("derivation '%s' lacks an 'outputName' attribute", store->printStorePath(drvPath));
|
||||
|
||||
pathsToBuild.push_back(DerivedPath::Built{
|
||||
.drvPath = makeConstantStorePathRef(drvPath),
|
||||
.drvPath = makeConstantStorePath(drvPath),
|
||||
.outputs = OutputsSpec::Names{outputName},
|
||||
});
|
||||
pathsToBuildOrdered.push_back({drvPath, {outputName}});
|
||||
|
||||
@@ -495,7 +495,7 @@ static void printMissing(EvalState & state, DrvInfos & elems)
|
||||
for (auto & i : elems)
|
||||
if (auto drvPath = i.queryDrvPath(state))
|
||||
targets.emplace_back(DerivedPath::Built{
|
||||
.drvPath = makeConstantStorePathRef(*drvPath),
|
||||
.drvPath = makeConstantStorePath(*drvPath),
|
||||
.outputs = OutputsSpec::All { },
|
||||
});
|
||||
else
|
||||
@@ -792,7 +792,7 @@ static void opSet(Globals & globals, Strings opFlags, Strings opArgs)
|
||||
std::vector<DerivedPath> paths {
|
||||
drvPath
|
||||
? (DerivedPath) (DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(*drvPath),
|
||||
.drvPath = makeConstantStorePath(*drvPath),
|
||||
.outputs = OutputsSpec::All { },
|
||||
})
|
||||
: (DerivedPath) (DerivedPath::Opaque {
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace nix {
|
||||
bool MY_TYPE ::operator COMPARATOR (const MY_TYPE & other) const \
|
||||
{ \
|
||||
const MY_TYPE* me = this; \
|
||||
auto fields1 = std::tie(*me->drvPath, me->FIELD); \
|
||||
auto fields1 = std::tie(me->drvPath, me->FIELD); \
|
||||
me = &other; \
|
||||
auto fields2 = std::tie(*me->drvPath, me->FIELD); \
|
||||
auto fields2 = std::tie(me->drvPath, me->FIELD); \
|
||||
return fields1 COMPARATOR fields2; \
|
||||
}
|
||||
#define CMP(CHILD_TYPE, MY_TYPE, FIELD) \
|
||||
@@ -52,7 +52,7 @@ StorePathSet BuiltPath::outPaths() const
|
||||
kj::Promise<Result<JSON>> BuiltPath::Built::toJSON(const Store & store) const
|
||||
try {
|
||||
JSON res;
|
||||
res["drvPath"] = TRY_AWAIT(drvPath->toJSON(store));
|
||||
res["drvPath"] = TRY_AWAIT(drvPath.toJSON(store));
|
||||
for (const auto & [outputName, outputPath] : outputs) {
|
||||
res["outputs"][outputName] = store.printStorePath(outputPath);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ try {
|
||||
[&](const BuiltPath::Built & p) -> kj::Promise<Result<void>> {
|
||||
try {
|
||||
auto drvHashes = TRY_AWAIT(
|
||||
staticOutputHashes(store, TRY_AWAIT(store.readDerivation(p.drvPath->path)))
|
||||
staticOutputHashes(store, TRY_AWAIT(store.readDerivation(p.drvPath.path)))
|
||||
);
|
||||
for (auto& [outputName, outputPath] : p.outputs) {
|
||||
if (experimentalFeatureSettings.isEnabled(
|
||||
@@ -118,7 +118,7 @@ try {
|
||||
if (!drvOutput)
|
||||
throw Error(
|
||||
"the derivation '%s' has unrealised output '%s' (derived-path.cc/toRealisedPaths)",
|
||||
store.printStorePath(p.drvPath->path), outputName);
|
||||
store.printStorePath(p.drvPath.path), outputName);
|
||||
auto thisRealisation = TRY_AWAIT(store.queryRealisation(
|
||||
DrvOutput{*drvOutput, outputName}));
|
||||
assert(thisRealisation); // We’ve built it, so we must
|
||||
|
||||
@@ -53,7 +53,7 @@ static inline ref<SingleBuiltPath> staticDrv(StorePath drvPath)
|
||||
* See 'BuiltPath' for more an explanation.
|
||||
*/
|
||||
struct BuiltPathBuilt {
|
||||
ref<DerivedPathOpaque> drvPath;
|
||||
DerivedPathOpaque drvPath;
|
||||
std::map<std::string, StorePath> outputs;
|
||||
|
||||
std::string to_string(const Store & store) const;
|
||||
|
||||
@@ -76,7 +76,7 @@ DerivedPathsWithInfo InstallableAttrPath::toDerivedPaths(EvalState & state)
|
||||
for (auto & [drvPath, outputs] : byDrvPath)
|
||||
res.push_back({
|
||||
.path = DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(drvPath),
|
||||
.drvPath = makeConstantStorePath(drvPath),
|
||||
.outputs = outputs,
|
||||
},
|
||||
.info = make_ref<ExtraPathInfoValue>(ExtraPathInfoValue::Value {
|
||||
|
||||
@@ -35,7 +35,7 @@ InstallableDerivedPath InstallableDerivedPath::parse(
|
||||
// Remove this prior to stabilizing the new CLI.
|
||||
if (storePath.isDerivation()) {
|
||||
auto oldDerivedPath = DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(storePath),
|
||||
.drvPath = makeConstantStorePath(storePath),
|
||||
.outputs = OutputsSpec::All { },
|
||||
};
|
||||
warn(
|
||||
@@ -48,7 +48,7 @@ InstallableDerivedPath InstallableDerivedPath::parse(
|
||||
},
|
||||
// If the user did use ^, we just do exactly what is written.
|
||||
[&](const ExtendedOutputsSpec::Explicit & outputSpec) -> DerivedPath {
|
||||
auto drv = make_ref<DerivedPathOpaque>(DerivedPathOpaque::parse(*store, prefix));
|
||||
auto drv = DerivedPathOpaque::parse(*store, prefix);
|
||||
return DerivedPath::Built {
|
||||
.drvPath = std::move(drv),
|
||||
.outputs = outputSpec,
|
||||
|
||||
@@ -98,7 +98,7 @@ DerivedPathsWithInfo InstallableFlake::toDerivedPaths(EvalState & state)
|
||||
|
||||
return {{
|
||||
.path = DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(std::move(drvPath)),
|
||||
.drvPath = makeConstantStorePath(std::move(drvPath)),
|
||||
.outputs = std::visit(overloaded {
|
||||
[&](const ExtendedOutputsSpec::Default & d) -> OutputsSpec {
|
||||
std::set<std::string> outputsToInstall;
|
||||
|
||||
@@ -759,7 +759,7 @@ StorePathSet Installable::toDerivations(
|
||||
: throw Error("argument '%s' did not evaluate to a derivation", i->what()));
|
||||
},
|
||||
[&](const DerivedPath::Built & bfd) {
|
||||
drvPaths.insert(bfd.drvPath->path);
|
||||
drvPaths.insert(bfd.drvPath.path);
|
||||
},
|
||||
}, b.path.raw());
|
||||
|
||||
|
||||
+1
-1
@@ -760,7 +760,7 @@ ProcessLineResult NixRepl::processLine(std::string line)
|
||||
|
||||
state.aio.blockOn(evaluator.store->buildPaths({
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(drvPath),
|
||||
.drvPath = makeConstantStorePath(drvPath),
|
||||
.outputs = OutputsSpec::All { },
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -580,7 +580,7 @@ string_t AttrCursor::getStringWithContext(EvalState & state)
|
||||
return d.drvPath;
|
||||
},
|
||||
[&](const NixStringContextElem::Built & b) -> const StorePath & {
|
||||
return b.drvPath->path;
|
||||
return b.drvPath.path;
|
||||
},
|
||||
[&](const NixStringContextElem::Opaque & o) -> const StorePath & {
|
||||
return o.path;
|
||||
|
||||
+3
-3
@@ -922,10 +922,10 @@ std::string EvalState::mkSingleDerivedPathStringRaw(
|
||||
return ctx.store->printStorePath(o.path);
|
||||
},
|
||||
[&](const SingleDerivedPath::Built & b) {
|
||||
auto drv = aio.blockOn(ctx.store->readDerivation(b.drvPath->path));
|
||||
auto drv = aio.blockOn(ctx.store->readDerivation(b.drvPath.path));
|
||||
auto i = drv.outputs.find(b.output);
|
||||
if (i == drv.outputs.end())
|
||||
throw Error("derivation '%s' does not have output '%s'", b.drvPath->to_string(*ctx.store), b.output);
|
||||
throw Error("derivation '%s' does not have output '%s'", b.drvPath.to_string(*ctx.store), b.output);
|
||||
auto optStaticOutputPath = i->second.path(*ctx.store, drv.name, b.output);
|
||||
return mkOutputStringRaw(b, optStaticOutputPath);
|
||||
}
|
||||
@@ -2477,7 +2477,7 @@ SingleDerivedPath EvalState::coerceToSingleDerivedPath(const PosIdx pos, Value &
|
||||
[&](const SingleDerivedPath::Built & b) {
|
||||
ctx.errors.make<EvalError>(
|
||||
"string '%s' has context with the output '%s' from derivation '%s', but the string is not the right placeholder for this derivation output. It should be '%s'",
|
||||
s, b.output, b.drvPath->to_string(*ctx.store), sExpected)
|
||||
s, b.output, b.drvPath.to_string(*ctx.store), sExpected)
|
||||
.withTrace(pos, errorCtx).debugThrow(always_progresses);
|
||||
}
|
||||
}, derivedPath.raw());
|
||||
|
||||
@@ -58,7 +58,7 @@ StringMap EvalState::realiseContext(const NixStringContext & context)
|
||||
.drvPath = b.drvPath,
|
||||
.outputs = OutputsSpec::Names { b.output },
|
||||
});
|
||||
return ensureValid(b.drvPath->path);
|
||||
return ensureValid(b.drvPath.path);
|
||||
},
|
||||
[&](const NixStringContextElem::Opaque & o) {
|
||||
auto ctxS = ctx.store->printStorePath(o.path);
|
||||
@@ -166,7 +166,7 @@ static void mkOutputString(
|
||||
state.mkOutputString(
|
||||
attrs.alloc(o.first),
|
||||
SingleDerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(drvPath),
|
||||
.drvPath = makeConstantStorePath(drvPath),
|
||||
.output = o.first,
|
||||
},
|
||||
o.second.path(*state.ctx.store, Derivation::nameFromPath(drvPath), o.first));
|
||||
@@ -977,7 +977,7 @@ drvName, Bindings * attrs, Value & v)
|
||||
}
|
||||
},
|
||||
[&](const NixStringContextElem::Built & b) {
|
||||
drv.inputDrvs[b.drvPath->path].insert(b.output);
|
||||
drv.inputDrvs[b.drvPath.path].insert(b.output);
|
||||
},
|
||||
[&](const NixStringContextElem::Opaque & o) {
|
||||
drv.inputSrcs.insert(o.path);
|
||||
|
||||
@@ -127,7 +127,7 @@ void prim_getContext(EvalState & state, Value * * args, Value & v)
|
||||
contextInfos[std::move(d.drvPath)].allOutputs = true;
|
||||
},
|
||||
[&](NixStringContextElem::Built && b) {
|
||||
auto drvPath = b.drvPath->path;
|
||||
auto drvPath = b.drvPath.path;
|
||||
contextInfos[std::move(drvPath)].outputs.emplace_back(std::move(b.output));
|
||||
},
|
||||
[&](NixStringContextElem::Opaque && o) {
|
||||
@@ -217,7 +217,7 @@ static void prim_appendContext(EvalState & state, Value * * args, Value & v)
|
||||
for (auto elem : iter->value->listItems()) {
|
||||
auto outputName = state.forceStringNoCtx(*elem, iter->pos, "while evaluating an output name within a string context");
|
||||
context.emplace(NixStringContextElem::Built {
|
||||
.drvPath = makeConstantStorePathRef(namePath),
|
||||
.drvPath = makeConstantStorePath(namePath),
|
||||
.output = std::string { outputName },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ NixStringContextElem NixStringContextElem::parse(std::string_view s0)
|
||||
std::string output { s.substr(0, index) };
|
||||
// Advance string to parse after the '!'
|
||||
s = s.substr(index + 1);
|
||||
auto drv = make_ref<SingleDerivedPath::Opaque>(SingleDerivedPath::Opaque{StorePath{s}});
|
||||
auto drv = SingleDerivedPath::Opaque{StorePath{s}};
|
||||
return SingleDerivedPath::Built{
|
||||
.drvPath = std::move(drv),
|
||||
.output = std::move(output),
|
||||
@@ -59,7 +59,7 @@ std::string NixStringContextElem::to_string() const
|
||||
res += '!';
|
||||
res += b.output;
|
||||
res += '!';
|
||||
res += b.drvPath->path.to_string();
|
||||
res += b.drvPath.path.to_string();
|
||||
},
|
||||
[&](const NixStringContextElem::Opaque & o) {
|
||||
res += o.path.to_string();
|
||||
|
||||
@@ -74,7 +74,7 @@ DerivationGoal::DerivationGoal(const StorePath & drvPath,
|
||||
{
|
||||
name = fmt(
|
||||
"building of '%s' from .drv file",
|
||||
DerivedPath::Built { makeConstantStorePathRef(drvPath), wantedOutputs }.to_string(worker.store));
|
||||
DerivedPath::Built { makeConstantStorePath(drvPath), wantedOutputs }.to_string(worker.store));
|
||||
trace("created");
|
||||
|
||||
mcExpectedBuilds = worker.expectedBuilds.addTemporarily(1);
|
||||
@@ -93,7 +93,7 @@ DerivationGoal::DerivationGoal(DrvHasRoot, const StorePath & drvPath, const Basi
|
||||
|
||||
name = fmt(
|
||||
"building of '%s' from in-memory derivation",
|
||||
DerivedPath::Built { makeConstantStorePathRef(drvPath), drv.outputNames() }.to_string(worker.store));
|
||||
DerivedPath::Built { makeConstantStorePath(drvPath), drv.outputNames() }.to_string(worker.store));
|
||||
trace("created");
|
||||
|
||||
mcExpectedBuilds = worker.expectedBuilds.addTemporarily(1);
|
||||
@@ -373,7 +373,7 @@ try {
|
||||
/* The inputs must be built before we can build this goal. */
|
||||
inputDrvOutputs.clear();
|
||||
if (useDerivation) {
|
||||
auto addWaiteeDerivedPath = [&](ref<DerivedPathOpaque> inputDrv, const StringSet & inputNode) {
|
||||
auto addWaiteeDerivedPath = [&](DerivedPathOpaque inputDrv, const StringSet & inputNode) {
|
||||
if (!inputNode.empty())
|
||||
dependencies.add(worker.goalFactory().makeGoal(
|
||||
DerivedPath::Built {
|
||||
@@ -384,7 +384,7 @@ try {
|
||||
};
|
||||
|
||||
for (const auto & [inputDrvPath, inputNode] : dynamic_cast<Derivation *>(drv.get())->inputDrvs) {
|
||||
addWaiteeDerivedPath(makeConstantStorePathRef(inputDrvPath), inputNode);
|
||||
addWaiteeDerivedPath(makeConstantStorePath(inputDrvPath), inputNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ try {
|
||||
else
|
||||
dependencies.add(worker.goalFactory().makeGoal(
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(drvPath2->second),
|
||||
.drvPath = makeConstantStorePath(drvPath2->second),
|
||||
.outputs = OutputsSpec::All { },
|
||||
},
|
||||
bmRepair));
|
||||
@@ -1762,7 +1762,7 @@ void DerivationGoal::waiteeDone(GoalPtr waitee)
|
||||
|
||||
for (auto & outputName : outputs) {
|
||||
auto buildResult = dg->buildResult.restrictTo(DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(dg->drvPath),
|
||||
.drvPath = makeConstantStorePath(dg->drvPath),
|
||||
.outputs = OutputsSpec::Names { outputName },
|
||||
});
|
||||
if (buildResult.success()) {
|
||||
|
||||
@@ -93,7 +93,7 @@ try {
|
||||
}));
|
||||
auto & result = results.goals.begin()->second;
|
||||
co_return result.result.restrictTo(DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(drvPath),
|
||||
.drvPath = makeConstantStorePath(drvPath),
|
||||
.outputs = OutputsSpec::All {},
|
||||
});
|
||||
} catch (Error & e) {
|
||||
@@ -151,7 +151,7 @@ try {
|
||||
Worker::Targets goals;
|
||||
goals.emplace_back(gf.makeGoal(
|
||||
DerivedPath::Built{
|
||||
.drvPath = makeConstantStorePathRef(*info->deriver),
|
||||
.drvPath = makeConstantStorePath(*info->deriver),
|
||||
// FIXME: Should just build the specific output we need.
|
||||
.outputs = OutputsSpec::All{},
|
||||
},
|
||||
|
||||
@@ -201,7 +201,7 @@ std::pair<GoalPtr, kj::Promise<Result<Goal::WorkResult>>> Worker::makeGoal(const
|
||||
{
|
||||
return std::visit(overloaded {
|
||||
[&](const DerivedPath::Built & bfd) -> std::pair<GoalPtr, kj::Promise<Result<Goal::WorkResult>>> {
|
||||
return makeDerivationGoal(bfd.drvPath->path, bfd.outputs, buildMode);
|
||||
return makeDerivationGoal(bfd.drvPath.path, bfd.outputs, buildMode);
|
||||
},
|
||||
[&](const DerivedPath::Opaque & bo) -> std::pair<GoalPtr, kj::Promise<Result<Goal::WorkResult>>> {
|
||||
return makePathSubstitutionGoal(bo.path, buildMode == bmRepair ? Repair : NoRepair);
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace nix {
|
||||
bool MY_TYPE ::operator COMPARATOR (const MY_TYPE & other) const \
|
||||
{ \
|
||||
const MY_TYPE* me = this; \
|
||||
auto fields1 = std::tie(*me->drvPath, me->FIELD); \
|
||||
auto fields1 = std::tie(me->drvPath, me->FIELD); \
|
||||
me = &other; \
|
||||
auto fields2 = std::tie(*me->drvPath, me->FIELD); \
|
||||
auto fields2 = std::tie(me->drvPath, me->FIELD); \
|
||||
return fields1 COMPARATOR fields2; \
|
||||
}
|
||||
#define CMP(CHILD_TYPE, MY_TYPE, FIELD) \
|
||||
@@ -37,10 +37,10 @@ try {
|
||||
kj::Promise<Result<JSON>> DerivedPath::Built::toJSON(Store & store) const
|
||||
try {
|
||||
JSON res;
|
||||
res["drvPath"] = TRY_AWAIT(drvPath->toJSON(store));
|
||||
res["drvPath"] = TRY_AWAIT(drvPath.toJSON(store));
|
||||
// Fallback for the input-addressed derivation case: We expect to always be
|
||||
// able to print the output paths, so let’s do it
|
||||
const auto outputMap = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath->path));
|
||||
const auto outputMap = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath.path));
|
||||
for (const auto & [output, outputPathOpt] : outputMap) {
|
||||
if (!outputs.contains(output)) continue;
|
||||
if (outputPathOpt)
|
||||
@@ -60,14 +60,14 @@ std::string DerivedPath::Opaque::to_string(const Store & store) const
|
||||
|
||||
std::string DerivedPath::Built::to_string(const Store & store) const
|
||||
{
|
||||
return drvPath->to_string(store)
|
||||
return drvPath.to_string(store)
|
||||
+ '^'
|
||||
+ outputs.to_string();
|
||||
}
|
||||
|
||||
std::string DerivedPath::Built::to_string_legacy(const Store & store) const
|
||||
{
|
||||
return drvPath->to_string(store)
|
||||
return drvPath.to_string(store)
|
||||
+ "!"
|
||||
+ outputs.to_string();
|
||||
}
|
||||
@@ -94,11 +94,11 @@ DerivedPath::Opaque DerivedPath::Opaque::parse(const Store & store, std::string_
|
||||
}
|
||||
|
||||
DerivedPath::Built DerivedPath::Built::parse(
|
||||
const Store & store, ref<DerivedPathOpaque> drv,
|
||||
const Store & store, DerivedPathOpaque drv,
|
||||
OutputNameView outputsS)
|
||||
{
|
||||
return {
|
||||
.drvPath = drv,
|
||||
.drvPath = std::move(drv),
|
||||
.outputs = OutputsSpec::parse(outputsS),
|
||||
};
|
||||
}
|
||||
@@ -112,12 +112,10 @@ static DerivedPathT parseDerivedPath(
|
||||
return DerivedPathT::Opaque::parse(store, s);
|
||||
} else {
|
||||
auto path = DerivedPathT::Built::parse(store,
|
||||
make_ref<typename DerivedPathT::Opaque>(DerivedPathT::Opaque::parse(
|
||||
store,
|
||||
s.substr(0, n))),
|
||||
DerivedPathT::Opaque::parse(store, s.substr(0, n)),
|
||||
s.substr(n + 1));
|
||||
|
||||
const auto& basePath = path.drvPath->path;
|
||||
const auto& basePath = path.drvPath.path;
|
||||
if (!basePath.isDerivation()) {
|
||||
throw InvalidPath("cannot use output selection ('%s') on non-derivation store path '%s'",
|
||||
separator, basePath.to_string());
|
||||
@@ -152,7 +150,7 @@ static inline const StorePath & getBaseStorePath_(const DP & derivedPath)
|
||||
{
|
||||
return std::visit(overloaded {
|
||||
[&](const typename DP::Built & bfd) -> const StorePath & {
|
||||
return bfd.drvPath->path;
|
||||
return bfd.drvPath.path;
|
||||
},
|
||||
[&](const typename DP::Opaque & bo) -> const StorePath & {
|
||||
return bo.path;
|
||||
|
||||
@@ -43,7 +43,7 @@ struct SingleDerivedPath;
|
||||
* path of the given output name.
|
||||
*/
|
||||
struct SingleDerivedPathBuilt {
|
||||
ref<DerivedPathOpaque> drvPath;
|
||||
DerivedPathOpaque drvPath;
|
||||
OutputName output;
|
||||
|
||||
DECLARE_CMP(SingleDerivedPathBuilt);
|
||||
@@ -79,9 +79,9 @@ struct SingleDerivedPath : derived_path::detail::SingleDerivedPathRaw {
|
||||
}
|
||||
};
|
||||
|
||||
static inline ref<DerivedPathOpaque> makeConstantStorePathRef(StorePath drvPath)
|
||||
static inline DerivedPathOpaque makeConstantStorePath(StorePath drvPath)
|
||||
{
|
||||
return make_ref<DerivedPathOpaque>(SingleDerivedPath::Opaque { drvPath });
|
||||
return SingleDerivedPath::Opaque { std::move(drvPath) };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ static inline ref<DerivedPathOpaque> makeConstantStorePathRef(StorePath drvPath)
|
||||
* output name.
|
||||
*/
|
||||
struct DerivedPathBuilt {
|
||||
ref<DerivedPathOpaque> drvPath;
|
||||
DerivedPathOpaque drvPath;
|
||||
OutputsSpec outputs;
|
||||
|
||||
/**
|
||||
@@ -111,7 +111,7 @@ struct DerivedPathBuilt {
|
||||
/**
|
||||
* The caller splits on the separator, so it works for both variants.
|
||||
*/
|
||||
static DerivedPathBuilt parse(const Store & store, ref<DerivedPathOpaque>, std::string_view);
|
||||
static DerivedPathBuilt parse(const Store & store, DerivedPathOpaque, std::string_view);
|
||||
kj::Promise<Result<JSON>> toJSON(Store & store) const;
|
||||
|
||||
DECLARE_CMP(DerivedPathBuilt);
|
||||
|
||||
@@ -27,7 +27,7 @@ DownstreamPlaceholder DownstreamPlaceholder::fromSingleDerivedPathBuilt(
|
||||
const SingleDerivedPath::Built & b,
|
||||
const ExperimentalFeatureSettings & xpSettings)
|
||||
{
|
||||
return DownstreamPlaceholder::unknownCaOutput(b.drvPath->path, b.output, xpSettings);
|
||||
return DownstreamPlaceholder::unknownCaOutput(b.drvPath.path, b.output, xpSettings);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -150,10 +150,10 @@ struct QueryMissingContext
|
||||
|
||||
kj::Promise<Result<void>> queryMissing(const std::vector<DerivedPath> & targets);
|
||||
|
||||
void enqueueDerivedPaths(ref<DerivedPathOpaque> inputDrv, const StringSet & inputNode)
|
||||
void enqueueDerivedPaths(DerivedPathOpaque inputDrv, const StringSet & inputNode)
|
||||
{
|
||||
if (!inputNode.empty()) {
|
||||
pool.enqueueWithAio([this, path{DerivedPath::Built{inputDrv, inputNode}}](
|
||||
pool.enqueueWithAio([this, path{DerivedPath::Built{std::move(inputDrv), inputNode}}](
|
||||
AsyncIoRoot & aio
|
||||
) { doPath(aio, path); });
|
||||
}
|
||||
@@ -167,7 +167,7 @@ struct QueryMissingContext
|
||||
}
|
||||
|
||||
for (const auto & [inputDrv, inputNode] : drv.inputDrvs) {
|
||||
enqueueDerivedPaths(makeConstantStorePathRef(inputDrv), inputNode);
|
||||
enqueueDerivedPaths(makeConstantStorePath(inputDrv), inputNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ struct QueryMissingContext
|
||||
|
||||
void doPathBuilt(AsyncIoRoot & aio, const DerivedPath::Built & bfd)
|
||||
{
|
||||
auto & drvPath = bfd.drvPath->path;
|
||||
auto & drvPath = bfd.drvPath.path;
|
||||
|
||||
if (!aio.blockOn(store.isValidPath(drvPath))) {
|
||||
// FIXME: we could try to substitute the derivation.
|
||||
@@ -457,7 +457,7 @@ try {
|
||||
kj::Promise<Result<OutputPathMap>>
|
||||
resolveDerivedPath(Store & store, const DerivedPath::Built & bfd, Store * evalStore_)
|
||||
try {
|
||||
auto drvPath = bfd.drvPath->path;
|
||||
auto drvPath = bfd.drvPath.path;
|
||||
|
||||
auto outputsOpt_ = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath, evalStore_));
|
||||
|
||||
@@ -474,7 +474,7 @@ try {
|
||||
if (!pOutputPathOpt)
|
||||
throw Error(
|
||||
"the derivation '%s' doesn't have an output named '%s'",
|
||||
bfd.drvPath->to_string(store), output);
|
||||
bfd.drvPath.to_string(store), output);
|
||||
outputsOpt.insert_or_assign(output, std::move(*pOutputPathOpt));
|
||||
}
|
||||
return outputsOpt;
|
||||
@@ -484,7 +484,7 @@ try {
|
||||
OutputPathMap outputs;
|
||||
for (auto & [outputName, outputPathOpt] : outputsOpt) {
|
||||
if (!outputPathOpt)
|
||||
throw MissingRealisation(bfd.drvPath->to_string(store), outputName);
|
||||
throw MissingRealisation(bfd.drvPath.to_string(store), outputName);
|
||||
auto & outputPath = *outputPathOpt;
|
||||
outputs.insert_or_assign(outputName, outputPath);
|
||||
}
|
||||
@@ -506,7 +506,7 @@ try {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-capturing-lambda-coroutines)
|
||||
[&](const SingleDerivedPath::Built & bfd) -> kj::Promise<Result<StorePath>> {
|
||||
try {
|
||||
auto drvPath = bfd.drvPath->path;
|
||||
auto drvPath = bfd.drvPath.path;
|
||||
auto outputPaths =
|
||||
TRY_AWAIT(evalStore.queryPartialDerivationOutputMap(drvPath, evalStore_));
|
||||
if (outputPaths.count(bfd.output) == 0)
|
||||
@@ -514,7 +514,7 @@ try {
|
||||
store.printStorePath(drvPath), bfd.output);
|
||||
auto & optPath = outputPaths.at(bfd.output);
|
||||
if (!optPath)
|
||||
throw MissingRealisation(bfd.drvPath->to_string(store), bfd.output);
|
||||
throw MissingRealisation(bfd.drvPath.to_string(store), bfd.output);
|
||||
co_return *optPath;
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
|
||||
@@ -16,13 +16,13 @@ DerivedPath StorePathWithOutputs::toDerivedPath() const
|
||||
{
|
||||
if (!outputs.empty()) {
|
||||
return DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(path),
|
||||
.drvPath = makeConstantStorePath(path),
|
||||
.outputs = OutputsSpec::Names { outputs },
|
||||
};
|
||||
} else if (path.isDerivation()) {
|
||||
assert(outputs.empty());
|
||||
return DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(path),
|
||||
.drvPath = makeConstantStorePath(path),
|
||||
.outputs = OutputsSpec::All { },
|
||||
};
|
||||
} else {
|
||||
@@ -51,7 +51,7 @@ StorePathWithOutputs::ParseResult StorePathWithOutputs::tryFromDerivedPath(const
|
||||
},
|
||||
[&](const DerivedPath::Built & bfd) -> StorePathWithOutputs::ParseResult {
|
||||
return StorePathWithOutputs {
|
||||
.path = bfd.drvPath->path,
|
||||
.path = bfd.drvPath.path,
|
||||
// Use legacy encoding of wildcard as empty set
|
||||
.outputs = std::visit(overloaded {
|
||||
[&](const OutputsSpec::All &) -> StringSet {
|
||||
|
||||
@@ -667,7 +667,7 @@ try {
|
||||
// Do nothing, path is hopefully there already
|
||||
},
|
||||
[&](const DerivedPath::Built & bp) {
|
||||
drvPaths2.insert(bp.drvPath->path);
|
||||
drvPaths2.insert(bp.drvPath.path);
|
||||
},
|
||||
}, i.raw());
|
||||
}
|
||||
@@ -748,7 +748,7 @@ try {
|
||||
};
|
||||
|
||||
OutputPathMap outputs;
|
||||
auto drvPath = bfd.drvPath->path;
|
||||
auto drvPath = bfd.drvPath.path;
|
||||
auto drv = TRY_AWAIT(evalStore->readDerivation(drvPath));
|
||||
const auto outputHashes =
|
||||
TRY_AWAIT(staticOutputHashes(*evalStore, drv)); // FIXME: expensive
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ StringPairs resolveRewrites(
|
||||
res.emplace(
|
||||
DownstreamPlaceholder::fromSingleDerivedPathBuilt(
|
||||
SingleDerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(drvDep->drvPath->path),
|
||||
.drvPath = makeConstantStorePath(drvDep->drvPath.path),
|
||||
.output = outputName,
|
||||
}).render(),
|
||||
store.printStorePath(outputPath)
|
||||
@@ -73,7 +73,7 @@ UnresolvedApp InstallableValue::toApp(EvalState & state)
|
||||
[&](const NixStringContextElem::DrvDeep & d) -> DerivedPath {
|
||||
/* We want all outputs of the drv */
|
||||
return DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(d.drvPath),
|
||||
.drvPath = makeConstantStorePath(d.drvPath),
|
||||
.outputs = OutputsSpec::All {},
|
||||
};
|
||||
},
|
||||
@@ -114,7 +114,7 @@ UnresolvedApp InstallableValue::toApp(EvalState & state)
|
||||
auto program = outPath + "/bin/" + mainProgram;
|
||||
return UnresolvedApp { App {
|
||||
.context = { DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(drvPath),
|
||||
.drvPath = makeConstantStorePath(drvPath),
|
||||
.outputs = OutputsSpec::Names { outputName },
|
||||
} },
|
||||
.program = program,
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ struct CmdBundle : InstallableCommand
|
||||
|
||||
aio().blockOn(store->buildPaths({
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(drvPath),
|
||||
.drvPath = makeConstantStorePath(drvPath),
|
||||
.outputs = OutputsSpec::All { },
|
||||
},
|
||||
}));
|
||||
|
||||
+1
-1
@@ -262,7 +262,7 @@ try {
|
||||
/* Build the derivation. */
|
||||
TRY_AWAIT(store->buildPaths(
|
||||
{ DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(shellDrvPath),
|
||||
.drvPath = makeConstantStorePath(shellDrvPath),
|
||||
.outputs = OutputsSpec::All { },
|
||||
}},
|
||||
bmNormal, evalStore));
|
||||
|
||||
+1
-1
@@ -615,7 +615,7 @@ struct CmdFlakeCheck : FlakeCommand
|
||||
*attr2.value, attr2.pos);
|
||||
if (drvPath && attr_name == evalSettings.getCurrentSystem()) {
|
||||
drvPaths.push_back(DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(*drvPath),
|
||||
.drvPath = makeConstantStorePath(*drvPath),
|
||||
.outputs = OutputsSpec::All { },
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ struct CmdLog : InstallableCommand
|
||||
return bo.path;
|
||||
},
|
||||
[&](const DerivedPath::Built & bfd) {
|
||||
return bfd.drvPath->path;
|
||||
return bfd.drvPath.path;
|
||||
},
|
||||
}, b.path.raw());
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ readConstituents(const nix::Value *v, nix::box_ptr<nix::EvalState> &state,
|
||||
std::visit(nix::overloaded{
|
||||
[&](const nix::NixStringContextElem::Built &b) {
|
||||
constituents.push_back(
|
||||
b.drvPath->to_string(*evaluator->store));
|
||||
b.drvPath.to_string(*evaluator->store));
|
||||
},
|
||||
[&](const nix::NixStringContextElem::Opaque &) {},
|
||||
[&](const nix::NixStringContextElem::DrvDeep &) {},
|
||||
|
||||
@@ -25,7 +25,7 @@ int main (int argc, char **argv)
|
||||
|
||||
std::vector<DerivedPath> paths {
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(store->parseStorePath(drvPath)),
|
||||
.drvPath = makeConstantStorePath(store->parseStorePath(drvPath)),
|
||||
.outputs = OutputsSpec::Names{"out"}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ TEST(NixStringContextElemTest, built_opaque) {
|
||||
auto * p = std::get_if<NixStringContextElem::Built>(&elem.raw);
|
||||
ASSERT_TRUE(p);
|
||||
ASSERT_EQ(p->output, "foo");
|
||||
ASSERT_EQ(*p->drvPath, (SingleDerivedPath::Opaque {
|
||||
ASSERT_EQ(p->drvPath, (SingleDerivedPath::Opaque {
|
||||
.path = StorePath { built.substr(5) },
|
||||
}));
|
||||
ASSERT_EQ(elem.to_string(), built);
|
||||
|
||||
@@ -20,7 +20,7 @@ Gen<DerivedPath::Opaque> Arbitrary<DerivedPath::Opaque>::arbitrary()
|
||||
Gen<SingleDerivedPath::Built> Arbitrary<SingleDerivedPath::Built>::arbitrary()
|
||||
{
|
||||
return gen::just(SingleDerivedPath::Built {
|
||||
.drvPath = make_ref<DerivedPathOpaque>(*gen::arbitrary<DerivedPathOpaque>()),
|
||||
.drvPath = *gen::arbitrary<DerivedPathOpaque>(),
|
||||
.output = (*gen::arbitrary<StorePathName>()).name,
|
||||
});
|
||||
}
|
||||
@@ -28,7 +28,7 @@ Gen<SingleDerivedPath::Built> Arbitrary<SingleDerivedPath::Built>::arbitrary()
|
||||
Gen<DerivedPath::Built> Arbitrary<DerivedPath::Built>::arbitrary()
|
||||
{
|
||||
return gen::just(DerivedPath::Built {
|
||||
.drvPath = make_ref<DerivedPathOpaque>(*gen::arbitrary<DerivedPathOpaque>()),
|
||||
.drvPath = *gen::arbitrary<DerivedPathOpaque>(),
|
||||
.outputs = *gen::arbitrary<OutputsSpec>(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -76,13 +76,13 @@ VERSIONED_CHARACTERIZATION_TEST(
|
||||
.path = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo" },
|
||||
},
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(StorePath {
|
||||
.drvPath = makeConstantStorePath(StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::All { },
|
||||
},
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(StorePath {
|
||||
.drvPath = makeConstantStorePath(StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::Names { "x", "y" },
|
||||
@@ -102,13 +102,13 @@ VERSIONED_CHARACTERIZATION_TEST(
|
||||
.path = StorePath { "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv" },
|
||||
},
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(StorePath {
|
||||
.drvPath = makeConstantStorePath(StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::All { },
|
||||
},
|
||||
DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(StorePath {
|
||||
.drvPath = makeConstantStorePath(StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::Names { "x", "y" },
|
||||
@@ -318,7 +318,7 @@ VERSIONED_CHARACTERIZATION_TEST(
|
||||
.stopTime = 50,
|
||||
},
|
||||
/* .path = */ DerivedPath::Built {
|
||||
.drvPath = makeConstantStorePathRef(StorePath {
|
||||
.drvPath = makeConstantStorePath(StorePath {
|
||||
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
|
||||
}),
|
||||
.outputs = OutputsSpec::Names { "out" },
|
||||
|
||||
Reference in New Issue
Block a user