diff --git a/lix/legacy/nix-build.cc b/lix/legacy/nix-build.cc index 2fd7b58f8..240721539 100644 --- a/lix/legacy/nix-build.cc +++ b/lix/legacy/nix-build.cc @@ -401,7 +401,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a if (shellDrv) { auto shellDrvOutputs = - aio.blockOn(store->queryPartialDerivationOutputMap(shellDrv.value(), &*evalStore)); + aio.blockOn(store->queryDerivationOutputMap(shellDrv.value(), &*evalStore)); shell = store->printStorePath(shellDrvOutputs.at("out")) + "/bin/bash"; } @@ -445,7 +445,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a auto accumInputClosure = [&](const StorePath & inputDrv, const StringSet & inputNode) { auto outputs = - aio.blockOn(store->queryPartialDerivationOutputMap(inputDrv, &*evalStore)); + aio.blockOn(store->queryDerivationOutputMap(inputDrv, &*evalStore)); for (auto & i : inputNode) { auto o = outputs.at(i); aio.blockOn(store->computeFSClosure(o, inputs)); @@ -591,7 +591,7 @@ static void main_nix_build(AsyncIoRoot & aio, std::string programName, Strings a drvPrefix += fmt("-%d", counter + 1); auto builtOutputs = - aio.blockOn(store->queryPartialDerivationOutputMap(drvPath, &*evalStore)); + aio.blockOn(store->queryDerivationOutputMap(drvPath, &*evalStore)); auto outputPath = builtOutputs.at(outputName); diff --git a/lix/libstore/build/derivation-goal.cc b/lix/libstore/build/derivation-goal.cc index 0db5b1762..4ed42e225 100644 --- a/lix/libstore/build/derivation-goal.cc +++ b/lix/libstore/build/derivation-goal.cc @@ -438,7 +438,7 @@ try { for (auto & i : inputClosure) if (i.isDerivation()) { auto depOutputs = - TRY_AWAIT(worker.store.queryPartialDerivationOutputMap(i, &worker.evalStore)); + TRY_AWAIT(worker.store.queryDerivationOutputMap(i, &worker.evalStore)); for (auto & j : depOutputs) outputsToDrv.insert_or_assign(j.second, i); } diff --git a/lix/libstore/daemon.cc b/lix/libstore/daemon.cc index 5f8c2b322..aceb4da29 100644 --- a/lix/libstore/daemon.cc +++ b/lix/libstore/daemon.cc @@ -387,7 +387,7 @@ static void performOp(AsyncIoRoot & aio, TunnelLogger * logger, ref store case WorkerProto::Op::QueryDerivationOutputMap: { auto path = store->parseStorePath(readString(from)); logger->startWork(); - auto outputs = aio.blockOn(store->queryPartialDerivationOutputMap(path)); + auto outputs = aio.blockOn(store->queryDerivationOutputMap(path)); logger->stopWork(); to << WorkerProto::write(*store, wconn, outputs); break; diff --git a/lix/libstore/derived-path.cc b/lix/libstore/derived-path.cc index bd55a9daa..8489caff5 100644 --- a/lix/libstore/derived-path.cc +++ b/lix/libstore/derived-path.cc @@ -40,7 +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 - const auto outputMap = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath.path)); + const auto outputMap = TRY_AWAIT(store.queryDerivationOutputMap(drvPath.path)); for (const auto & [output, outputPathOpt] : outputMap) { if (!outputs.contains(output)) continue; res["outputs"][output] = store.printStorePath(outputPathOpt); diff --git a/lix/libstore/gc.cc b/lix/libstore/gc.cc index bcc046cdc..6e7e5c7bf 100644 --- a/lix/libstore/gc.cc +++ b/lix/libstore/gc.cc @@ -775,7 +775,7 @@ try { derivation, then visit the derivation outputs. */ if (gcKeepDerivations && path->isDerivation()) { for (auto & [name, outPath] : - TRY_AWAIT(queryPartialDerivationOutputMap(*path))) + TRY_AWAIT(queryDerivationOutputMap(*path))) { if (TRY_AWAIT(isValidPath(outPath)) && TRY_AWAIT(queryPathInfo(outPath))->deriver == *path) diff --git a/lix/libstore/local-store.cc b/lix/libstore/local-store.cc index 7fbc9d33f..ffa765d76 100644 --- a/lix/libstore/local-store.cc +++ b/lix/libstore/local-store.cc @@ -1027,7 +1027,7 @@ try { kj::Promise>> -LocalStore::queryStaticPartialDerivationOutputMap(const StorePath & path) +LocalStore::queryStaticDerivationOutputMap(const StorePath & path) try { co_return TRY_AWAIT( // NOLINTNEXTLINE(cppcoreguidelines-avoid-capturing-lambda-coroutines) diff --git a/lix/libstore/local-store.hh b/lix/libstore/local-store.hh index f5758157b..fa00c4885 100644 --- a/lix/libstore/local-store.hh +++ b/lix/libstore/local-store.hh @@ -202,7 +202,7 @@ public: kj::Promise> queryValidDerivers(const StorePath & path) override; kj::Promise>> - queryStaticPartialDerivationOutputMap(const StorePath & path) override; + queryStaticDerivationOutputMap(const StorePath & path) override; kj::Promise>> queryPathFromHashPart(const std::string & hashPart) override; diff --git a/lix/libstore/misc.cc b/lix/libstore/misc.cc index 6185b4129..b46383047 100644 --- a/lix/libstore/misc.cc +++ b/lix/libstore/misc.cc @@ -37,7 +37,7 @@ try { res.insert(i); if (includeDerivers && path.isDerivation()) - for (auto& [_, outPath] : TRY_AWAIT(queryPartialDerivationOutputMap(path))) + for (auto& [_, outPath] : TRY_AWAIT(queryDerivationOutputMap(path))) if (TRY_AWAIT(isValidPath(outPath))) res.insert(outPath); co_return res; @@ -56,7 +56,7 @@ try { res.insert(ref); if (includeOutputs && path.isDerivation()) - for (auto& [_, outPath] : TRY_AWAIT(queryPartialDerivationOutputMap(path))) + for (auto& [_, outPath] : TRY_AWAIT(queryDerivationOutputMap(path))) if (TRY_AWAIT(isValidPath(outPath))) res.insert(outPath); @@ -241,7 +241,7 @@ struct QueryMissingContext StorePathSet invalid; for (auto & [outputName, path] : - aio.blockOn(store.queryPartialDerivationOutputMap(drvPath))) + aio.blockOn(store.queryDerivationOutputMap(drvPath))) { if (bfd.outputs.contains(outputName) && !aio.blockOn(store.isValidPath(path))) invalid.insert(path); @@ -354,7 +354,7 @@ resolveDerivedPath(Store & store, const DerivedPath::Built & bfd, Store * evalSt try { auto drvPath = bfd.drvPath.path; - auto outputs_ = TRY_AWAIT(store.queryPartialDerivationOutputMap(drvPath, evalStore_)); + auto outputs_ = TRY_AWAIT(store.queryDerivationOutputMap(drvPath, evalStore_)); co_return std::visit(overloaded { [&](const OutputsSpec::All &) { diff --git a/lix/libstore/remote-store.cc b/lix/libstore/remote-store.cc index 46f47eb16..fd9d8b241 100644 --- a/lix/libstore/remote-store.cc +++ b/lix/libstore/remote-store.cc @@ -339,7 +339,7 @@ try { kj ::Promise>> -RemoteStore::queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore_) +RemoteStore::queryDerivationOutputMap(const StorePath & path, Store * evalStore_) try { if (GET_PROTOCOL_MINOR(TRY_AWAIT(getProtocol())) >= 22) { if (!evalStore_) { @@ -361,11 +361,11 @@ try { co_return result; } else { auto & evalStore = *evalStore_; - auto outputs = TRY_AWAIT(evalStore.queryStaticPartialDerivationOutputMap(path)); + auto outputs = TRY_AWAIT(evalStore.queryStaticDerivationOutputMap(path)); // union with the first branch overriding the statically-known ones // when non-`std::nullopt`. for (auto && [outputName, optPath] : - TRY_AWAIT(queryPartialDerivationOutputMap(path, nullptr))) + TRY_AWAIT(queryDerivationOutputMap(path, nullptr))) { outputs.insert_or_assign(std::move(outputName), std::move(optPath)); } @@ -380,7 +380,7 @@ try { // from the derivation itself (and not the ones that are known because // the have been built), but as old stores don't handle floating-CA // derivations this shouldn't matter - co_return TRY_AWAIT(evalStore.queryStaticPartialDerivationOutputMap(path)); + co_return TRY_AWAIT(evalStore.queryStaticDerivationOutputMap(path)); } } catch (...) { co_return result::current_exception(); diff --git a/lix/libstore/remote-store.hh b/lix/libstore/remote-store.hh index 6232cd191..55bac529f 100644 --- a/lix/libstore/remote-store.hh +++ b/lix/libstore/remote-store.hh @@ -70,7 +70,7 @@ public: kj::Promise> queryDerivationOutputs(const StorePath & path) override; kj::Promise>> - queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr) override; + queryDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr) override; kj::Promise>> queryPathFromHashPart(const std::string & hashPart) override; diff --git a/lix/libstore/store-api.cc b/lix/libstore/store-api.cc index 38100db55..5a4e1fc37 100644 --- a/lix/libstore/store-api.cc +++ b/lix/libstore/store-api.cc @@ -509,7 +509,7 @@ bool Store::PathInfoCacheValue::isKnownNow() } kj::Promise>> -Store::queryStaticPartialDerivationOutputMap(const StorePath & path) +Store::queryStaticDerivationOutputMap(const StorePath & path) try { std::map outputs; auto drv = TRY_AWAIT(readInvalidDerivation(path)); @@ -522,19 +522,11 @@ try { } kj::Promise>> -Store::queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore_) +Store::queryDerivationOutputMap(const StorePath & path, Store * evalStore_) try { auto & evalStore = evalStore_ ? *evalStore_ : *this; - co_return TRY_AWAIT(evalStore.queryStaticPartialDerivationOutputMap(path)); -} catch (...) { - co_return result::current_exception(); -} - -kj::Promise> -Store::queryDerivationOutputMap(const StorePath & path, Store * evalStore) -try { - co_return TRY_AWAIT(queryPartialDerivationOutputMap(path, evalStore)); + co_return TRY_AWAIT(evalStore.queryStaticDerivationOutputMap(path)); } catch (...) { co_return result::current_exception(); } diff --git a/lix/libstore/store-api.hh b/lix/libstore/store-api.hh index eea29f348..90be090a0 100644 --- a/lix/libstore/store-api.hh +++ b/lix/libstore/store-api.hh @@ -448,10 +448,10 @@ public: /** * Query the mapping outputName => outputPath for the given - * derivation. Naming is a historical accident. + * derivation. */ virtual kj::Promise>> - queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr); + queryDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr); /** * Like `queryPartialDerivationOutputMap` but only considers @@ -459,17 +459,10 @@ public: * the derivation itself. * * Just a helper function for implementing - * `queryPartialDerivationOutputMap`. + * `queryDerivationOutputMap`. */ virtual kj::Promise>> - queryStaticPartialDerivationOutputMap(const StorePath & path); - - /** - * Query the mapping outputName=>outputPath for the given derivation. - * Assume every output has a mapping and throw an exception otherwise. - */ - kj::Promise> - queryDerivationOutputMap(const StorePath & path, Store * evalStore = nullptr); + queryStaticDerivationOutputMap(const StorePath & path); /** * Query the full store path given the hash part of a valid store diff --git a/lix/nix/develop.cc b/lix/nix/develop.cc index 07c3506e7..dfbc09b95 100644 --- a/lix/nix/develop.cc +++ b/lix/nix/develop.cc @@ -260,7 +260,7 @@ try { }}, bmNormal, evalStore)); - for (auto & [_0, outPath] : TRY_AWAIT(evalStore->queryPartialDerivationOutputMap(shellDrvPath))) + for (auto & [_0, outPath] : TRY_AWAIT(evalStore->queryDerivationOutputMap(shellDrvPath))) { assert(TRY_AWAIT(store->isValidPath(outPath))); auto outPathS = store->toRealPath(outPath);