libstore: asyncify drvOutputReferences

Change-Id: I68bc77eadb1ddf3d0e257e773f8b9b29289ea2bc
This commit is contained in:
eldritch horrors
2025-02-16 15:00:10 +00:00
parent 3b9020d37c
commit 993cc99f0d
3 changed files with 18 additions and 10 deletions
+5 -3
View File
@@ -1159,7 +1159,9 @@ try {
auto & drvStore = worker.evalStore.isValidPath(drvPath)
? worker.evalStore
: worker.store;
newRealisation.dependentRealisations = drvOutputReferences(worker.store, *drv, realisation.outPath, &drvStore);
newRealisation.dependentRealisations = TRY_AWAIT(
drvOutputReferences(worker.store, *drv, realisation.outPath, &drvStore)
);
}
signRealisation(newRealisation);
worker.store.registerDrvOutput(newRealisation);
@@ -1180,9 +1182,9 @@ try {
if (status == BuildResult::AlreadyValid)
status = BuildResult::ResolvesToAlreadyValid;
return {done(status, std::move(builtOutputs))};
co_return done(status, std::move(builtOutputs));
} catch (...) {
return {result::current_exception()};
co_return result::current_exception();
}
HookReply DerivationGoal::tryBuildHook()
+12 -6
View File
@@ -352,10 +352,10 @@ StorePaths Store::topoSortPaths(const StorePathSet & paths)
}});
}
std::map<DrvOutput, StorePath> drvOutputReferences(
static kj::Promise<Result<std::map<DrvOutput, StorePath>>> drvOutputReferences(
const std::set<Realisation> & inputRealisations,
const StorePathSet & pathReferences)
{
try {
std::map<DrvOutput, StorePath> res;
for (const auto & input : inputRealisations) {
@@ -364,15 +364,17 @@ std::map<DrvOutput, StorePath> drvOutputReferences(
}
}
return res;
co_return res;
} catch (...) {
co_return result::current_exception();
}
std::map<DrvOutput, StorePath> drvOutputReferences(
kj::Promise<Result<std::map<DrvOutput, StorePath>>> drvOutputReferences(
Store & store,
const Derivation & drv,
const StorePath & outputPath,
Store * evalStore_)
{
try {
auto & evalStore = evalStore_ ? *evalStore_ : store;
std::set<Realisation> inputRealisations;
@@ -415,7 +417,11 @@ std::map<DrvOutput, StorePath> drvOutputReferences(
auto info = store.queryPathInfo(outputPath);
return drvOutputReferences(Realisation::closure(store, inputRealisations), info->references);
co_return TRY_AWAIT(
drvOutputReferences(Realisation::closure(store, inputRealisations), info->references)
);
} catch (...) {
co_return result::current_exception();
}
OutputPathMap resolveDerivedPath(Store & store, const DerivedPath::Built & bfd, Store * evalStore_)
+1 -1
View File
@@ -1074,7 +1074,7 @@ std::pair<std::string, StoreConfig::Params> splitUriAndParams(const std::string
const ContentAddress * getDerivationCA(const BasicDerivation & drv);
std::map<DrvOutput, StorePath> drvOutputReferences(
kj::Promise<Result<std::map<DrvOutput, StorePath>>> drvOutputReferences(
Store & store,
const Derivation & drv,
const StorePath & outputPath,