libstore: drop feature-gated realisation queries

these will never run without the ability to enable the feature.

Change-Id: I917024e8c3c5b1f422c9e5a509130998bee4e511
This commit is contained in:
eldritch horrors
2025-05-20 17:43:46 +00:00
parent dc47f9aa72
commit aa69d39c0f
4 changed files with 9 additions and 76 deletions
-14
View File
@@ -112,22 +112,8 @@ try {
staticOutputHashes(store, TRY_AWAIT(store.readDerivation(p.drvPath.path)))
);
for (auto& [outputName, outputPath] : p.outputs) {
if (experimentalFeatureSettings.isEnabled(
Xp::CaDerivations)) {
auto drvOutput = get(drvHashes, outputName);
if (!drvOutput)
throw Error(
"the derivation '%s' has unrealised output '%s' (derived-path.cc/toRealisedPaths)",
store.printStorePath(p.drvPath.path), outputName);
auto thisRealisation = TRY_AWAIT(store.queryRealisation(
DrvOutput{*drvOutput, outputName}));
assert(thisRealisation); // Weve built it, so we must
// have the realisation
res.insert(*thisRealisation);
} else {
res.insert(outputPath);
}
}
co_return result::success();
} catch (...) {
co_return result::current_exception();
+1 -27
View File
@@ -259,33 +259,7 @@ struct QueryMissingContext
ParsedDerivation parsedDrv(StorePath(drvPath), *drv);
if (!knownOutputPaths && settings.useSubstitutes && parsedDrv.substitutesAllowed()) {
experimentalFeatureSettings.require(Xp::CaDerivations);
// If there are unknown output paths, attempt to find if the
// paths are known to substituters through a realisation.
auto outputHashes = aio.blockOn(staticOutputHashes(store, *drv));
knownOutputPaths = true;
for (auto [outputName, hash] : outputHashes) {
if (!bfd.outputs.contains(outputName))
continue;
bool found = false;
for (auto &sub : aio.blockOn(getDefaultSubstituters())) {
auto realisation = aio.blockOn(sub->queryRealisation({hash, outputName}));
if (!realisation)
continue;
found = true;
if (!aio.blockOn(store.isValidPath(realisation->outPath)))
invalid.insert(realisation->outPath);
break;
}
if (!found) {
// Some paths did not have a realisation, this must be built.
knownOutputPaths = false;
break;
}
}
throw UnimplementedError("ca derivations are not supported");
}
if (knownOutputPaths && settings.useSubstitutes && parsedDrv.substitutesAllowed()) {
-8
View File
@@ -743,13 +743,6 @@ try {
"the derivation '%s' doesn't have an output named '%s'",
printStorePath(drvPath), output);
auto outputId = DrvOutput{ *outputHash, output };
if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) {
auto realisation =
TRY_AWAIT(queryRealisation(outputId));
if (!realisation)
throw MissingRealisation(outputId);
res.builtOutputs.emplace(output, *realisation);
} else {
res.builtOutputs.emplace(
output,
Realisation {
@@ -757,7 +750,6 @@ try {
.outPath = outputPath,
});
}
}
results.push_back(res);
co_return result::success();
+1 -20
View File
@@ -526,26 +526,7 @@ Store::queryPartialDerivationOutputMap(const StorePath & path, Store * evalStore
try {
auto & evalStore = evalStore_ ? *evalStore_ : *this;
auto outputs = TRY_AWAIT(evalStore.queryStaticPartialDerivationOutputMap(path));
if (!experimentalFeatureSettings.isEnabled(Xp::CaDerivations))
co_return outputs;
auto drv = TRY_AWAIT(evalStore.readInvalidDerivation(path));
auto drvHashes = TRY_AWAIT(staticOutputHashes(*this, drv));
for (auto & [outputName, hash] : drvHashes) {
auto realisation = TRY_AWAIT(queryRealisation(DrvOutput{hash, outputName}));
if (realisation) {
outputs.insert_or_assign(outputName, realisation->outPath);
} else {
// queryStaticPartialDerivationOutputMap is not guaranteed
// to return std::nullopt for outputs which are not
// statically known.
outputs.insert({outputName, std::nullopt});
}
}
co_return outputs;
co_return TRY_AWAIT(evalStore.queryStaticPartialDerivationOutputMap(path));
} catch (...) {
co_return result::current_exception();
}