treewide: don't resolveDerivedPath opaque paths
resolution of opaque paths is just an expensive `->path`. Change-Id: I0c8d8b908f358d0bd26d1dcba84b2de6cbdc7c29
This commit is contained in:
@@ -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(state.aio.blockOn(resolveDerivedPath(*store, *bfd.drvPath)));
|
||||
drvPaths.insert(bfd.drvPath->path);
|
||||
},
|
||||
}, b.path.raw());
|
||||
|
||||
|
||||
@@ -127,9 +127,7 @@ void prim_getContext(EvalState & state, Value * * args, Value & v)
|
||||
contextInfos[std::move(d.drvPath)].allOutputs = true;
|
||||
},
|
||||
[&](NixStringContextElem::Built && b) {
|
||||
// FIXME should eventually show string context as is, no
|
||||
// resolving here.
|
||||
auto drvPath = state.aio.blockOn(resolveDerivedPath(*state.ctx.store, *b.drvPath));
|
||||
auto drvPath = b.drvPath->path;
|
||||
contextInfos[std::move(drvPath)].outputs.emplace_back(std::move(b.output));
|
||||
},
|
||||
[&](NixStringContextElem::Opaque && o) {
|
||||
|
||||
@@ -40,10 +40,7 @@ try {
|
||||
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
|
||||
// FIXME try-resolve on drvPath
|
||||
const auto outputMap = TRY_AWAIT(
|
||||
store.queryPartialDerivationOutputMap(TRY_AWAIT(resolveDerivedPath(store, *drvPath)))
|
||||
);
|
||||
const auto outputMap = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath->path));
|
||||
for (const auto & [output, outputPathOpt] : outputMap) {
|
||||
if (!outputs.contains(output)) continue;
|
||||
if (outputPathOpt)
|
||||
|
||||
@@ -474,7 +474,7 @@ try {
|
||||
kj::Promise<Result<OutputPathMap>>
|
||||
resolveDerivedPath(Store & store, const DerivedPath::Built & bfd, Store * evalStore_)
|
||||
try {
|
||||
auto drvPath = TRY_AWAIT(resolveDerivedPath(store, *bfd.drvPath, evalStore_));
|
||||
auto drvPath = bfd.drvPath->path;
|
||||
|
||||
auto outputsOpt_ = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath, evalStore_));
|
||||
|
||||
@@ -523,7 +523,7 @@ try {
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-capturing-lambda-coroutines)
|
||||
[&](const SingleDerivedPath::Built & bfd) -> kj::Promise<Result<StorePath>> {
|
||||
try {
|
||||
auto drvPath = TRY_AWAIT(resolveDerivedPath(store, *bfd.drvPath, evalStore_));
|
||||
auto drvPath = bfd.drvPath->path;
|
||||
auto outputPaths =
|
||||
TRY_AWAIT(evalStore.queryPartialDerivationOutputMap(drvPath, evalStore_));
|
||||
if (outputPaths.count(bfd.output) == 0)
|
||||
|
||||
@@ -748,7 +748,7 @@ try {
|
||||
};
|
||||
|
||||
OutputPathMap outputs;
|
||||
auto drvPath = TRY_AWAIT(resolveDerivedPath(*evalStore, *bfd.drvPath));
|
||||
auto drvPath = bfd.drvPath->path;
|
||||
auto drv = TRY_AWAIT(evalStore->readDerivation(drvPath));
|
||||
const auto outputHashes =
|
||||
TRY_AWAIT(staticOutputHashes(*evalStore, drv)); // FIXME: expensive
|
||||
|
||||
+3
-4
@@ -34,15 +34,14 @@ struct CmdLog : InstallableCommand
|
||||
auto b = installable->toDerivedPath(*getEvaluator()->begin(aio()));
|
||||
|
||||
// For compat with CLI today, TODO revisit
|
||||
auto oneUp = std::visit(overloaded {
|
||||
auto path = std::visit(overloaded {
|
||||
[&](const DerivedPath::Opaque & bo) {
|
||||
return make_ref<SingleDerivedPath::Opaque>(bo);
|
||||
return bo.path;
|
||||
},
|
||||
[&](const DerivedPath::Built & bfd) {
|
||||
return bfd.drvPath;
|
||||
return bfd.drvPath->path;
|
||||
},
|
||||
}, b.path.raw());
|
||||
auto path = aio().blockOn(resolveDerivedPath(*store, *oneUp));
|
||||
|
||||
RunPager pager;
|
||||
for (auto & sub : subs) {
|
||||
|
||||
Reference in New Issue
Block a user