diff --git a/lix/libstore/log-store.cc b/lix/libstore/log-store.cc index 5911c84d5..eeb07d737 100644 --- a/lix/libstore/log-store.cc +++ b/lix/libstore/log-store.cc @@ -4,7 +4,7 @@ namespace nix { kj::Promise>> LogStore::getBuildLog(const StorePath & path) try { - auto maybePath = getBuildDerivationPath(path); + auto maybePath = TRY_AWAIT(getBuildDerivationPath(path)); if (!maybePath) co_return std::nullopt; co_return getBuildLogExact(maybePath.value()); diff --git a/lix/libstore/store-api.cc b/lix/libstore/store-api.cc index c36a94e8f..4fda8d4ac 100644 --- a/lix/libstore/store-api.cc +++ b/lix/libstore/store-api.cc @@ -1412,20 +1412,20 @@ Derivation readDerivationCommon(Store& store, const StorePath& drvPath, bool req } } -std::optional Store::getBuildDerivationPath(const StorePath & path) -{ +kj::Promise>> Store::getBuildDerivationPath(const StorePath & path) +try { if (!path.isDerivation()) { try { auto info = queryPathInfo(path); - return info->deriver; + co_return info->deriver; } catch (InvalidPath &) { - return std::nullopt; + co_return std::nullopt; } } if (!experimentalFeatureSettings.isEnabled(Xp::CaDerivations) || !isValidPath(path)) - return path; + co_return path; auto drv = readDerivation(path); if (!drv.type().hasKnownOutputPaths()) { @@ -1433,10 +1433,12 @@ std::optional Store::getBuildDerivationPath(const StorePath & path) // resolved derivation, so we need to get it first auto resolvedDrv = drv.tryResolve(*this); if (resolvedDrv) - return writeDerivation(*this, *resolvedDrv, NoRepair, true); + co_return writeDerivation(*this, *resolvedDrv, NoRepair, true); } - return path; + co_return path; +} catch (...) { + co_return result::current_exception(); } Derivation Store::readDerivation(const StorePath & drvPath) diff --git a/lix/libstore/store-api.hh b/lix/libstore/store-api.hh index f5399c2d8..bf82ba8c1 100644 --- a/lix/libstore/store-api.hh +++ b/lix/libstore/store-api.hh @@ -831,7 +831,7 @@ public: * - If the path is a content-addressed derivation, try to resolve it * - Otherwise, find one of its derivers */ - std::optional getBuildDerivationPath(const StorePath &); + kj::Promise>> getBuildDerivationPath(const StorePath &); /** * Hack to allow long-running processes like hydra-queue-runner to