libstore: remove Derivation::hasKnownOutputPaths
it's always true now that floating and deferred outputs are gone. Change-Id: Ie694b9af4d2c247c0fb4fdebadd55a0a487b9828
This commit is contained in:
@@ -346,31 +346,12 @@ connected:
|
||||
}
|
||||
|
||||
|
||||
auto outputHashes = aio.blockOn(staticOutputHashes(*store, drv));
|
||||
std::set<Realisation> missingRealisations;
|
||||
StorePathSet missingPaths;
|
||||
if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations) && !drv.type().hasKnownOutputPaths()) {
|
||||
for (auto & outputName : wantedOutputs) {
|
||||
auto thisOutputHash = outputHashes.at(outputName);
|
||||
auto thisOutputId = DrvOutput{ thisOutputHash, outputName };
|
||||
if (!aio.blockOn(store->queryRealisation(thisOutputId))) {
|
||||
debug("missing output %s", outputName);
|
||||
assert(optResult);
|
||||
auto & result = *optResult;
|
||||
auto i = result.builtOutputs.find(outputName);
|
||||
assert(i != result.builtOutputs.end());
|
||||
auto & newRealisation = i->second;
|
||||
missingRealisations.insert(newRealisation);
|
||||
missingPaths.insert(newRealisation.outPath);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
auto outputPaths = drv.outputsAndOptPaths(*store);
|
||||
for (auto & [outputName, hopefullyOutputPath] : outputPaths) {
|
||||
assert(hopefullyOutputPath.second);
|
||||
if (!aio.blockOn(store->isValidPath(*hopefullyOutputPath.second)))
|
||||
missingPaths.insert(*hopefullyOutputPath.second);
|
||||
}
|
||||
auto outputPaths = drv.outputsAndOptPaths(*store);
|
||||
for (auto & [outputName, hopefullyOutputPath] : outputPaths) {
|
||||
assert(hopefullyOutputPath.second);
|
||||
if (!aio.blockOn(store->isValidPath(*hopefullyOutputPath.second)))
|
||||
missingPaths.insert(*hopefullyOutputPath.second);
|
||||
}
|
||||
|
||||
if (!missingPaths.empty()) {
|
||||
@@ -382,13 +363,6 @@ connected:
|
||||
copyPaths(*sshStore, *store, missingPaths, NoRepair, NoCheckSigs, NoSubstitute)
|
||||
);
|
||||
}
|
||||
// XXX: Should be done as part of `copyPaths`
|
||||
for (auto & realisation : missingRealisations) {
|
||||
// Should hold, because if the feature isn't enabled the set
|
||||
// of missing realisations should be empty
|
||||
experimentalFeatureSettings.require(Xp::CaDerivations);
|
||||
aio.blockOn(store->registerDrvOutput(realisation));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -219,9 +219,6 @@ try {
|
||||
|
||||
parsedDrv = std::make_unique<ParsedDerivation>(drvPath, *drv);
|
||||
|
||||
if (!drv->type().hasKnownOutputPaths())
|
||||
throw UnimplementedError("ca derivations are not supported");
|
||||
|
||||
for (auto & i : drv->outputsAndOptPaths(worker.store))
|
||||
if (i.second.second)
|
||||
TRY_AWAIT(worker.store.addTempRoot(*i.second.second));
|
||||
@@ -1430,39 +1427,20 @@ void DerivationGoal::flushLine()
|
||||
|
||||
kj::Promise<Result<std::map<std::string, std::optional<StorePath>>>> DerivationGoal::queryPartialDerivationOutputMap()
|
||||
try {
|
||||
if (!useDerivation || drv->type().hasKnownOutputPaths()) {
|
||||
std::map<std::string, std::optional<StorePath>> res;
|
||||
for (auto & [name, output] : drv->outputs)
|
||||
res.insert_or_assign(name, output.path(worker.store, drv->name, name));
|
||||
co_return res;
|
||||
} else {
|
||||
for (auto * drvStore : {&worker.evalStore, &worker.store}) {
|
||||
if (TRY_AWAIT(drvStore->isValidPath(drvPath))) {
|
||||
co_return TRY_AWAIT(worker.store.queryPartialDerivationOutputMap(drvPath, drvStore)
|
||||
);
|
||||
}
|
||||
}
|
||||
assert(false);
|
||||
}
|
||||
std::map<std::string, std::optional<StorePath>> res;
|
||||
for (auto & [name, output] : drv->outputs)
|
||||
res.insert_or_assign(name, output.path(worker.store, drv->name, name));
|
||||
co_return res;
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
}
|
||||
|
||||
kj::Promise<Result<OutputPathMap>> DerivationGoal::queryDerivationOutputMap()
|
||||
try {
|
||||
if (!useDerivation || drv->type().hasKnownOutputPaths()) {
|
||||
OutputPathMap res;
|
||||
for (auto & [name, output] : drv->outputsAndOptPaths(worker.store))
|
||||
res.insert_or_assign(name, *output.second);
|
||||
co_return res;
|
||||
} else {
|
||||
for (auto * drvStore : {&worker.evalStore, &worker.store}) {
|
||||
if (TRY_AWAIT(drvStore->isValidPath(drvPath))) {
|
||||
co_return TRY_AWAIT(worker.store.queryDerivationOutputMap(drvPath, drvStore));
|
||||
}
|
||||
}
|
||||
assert(false);
|
||||
}
|
||||
OutputPathMap res;
|
||||
for (auto & [name, output] : drv->outputsAndOptPaths(worker.store))
|
||||
res.insert_or_assign(name, *output.second);
|
||||
co_return res;
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
}
|
||||
|
||||
@@ -65,19 +65,6 @@ bool DerivationType::isFixed() const
|
||||
}, raw);
|
||||
}
|
||||
|
||||
bool DerivationType::hasKnownOutputPaths() const
|
||||
{
|
||||
return std::visit(overloaded {
|
||||
[](const InputAddressed & ia) {
|
||||
return true;
|
||||
},
|
||||
[](const ContentAddressed & ca) {
|
||||
return true;
|
||||
},
|
||||
}, raw);
|
||||
}
|
||||
|
||||
|
||||
bool DerivationType::isSandboxed() const
|
||||
{
|
||||
return std::visit(overloaded {
|
||||
|
||||
@@ -169,13 +169,6 @@ struct DerivationType {
|
||||
* controlled separately. Always true for non-CA derivations.
|
||||
*/
|
||||
bool isSandboxed() const;
|
||||
|
||||
/**
|
||||
* Does the derivation knows its own output paths?
|
||||
* Only true when there's no floating-ca derivation involved in the
|
||||
* closure, or if fixed output.
|
||||
*/
|
||||
bool hasKnownOutputPaths() const;
|
||||
};
|
||||
|
||||
struct BasicDerivation
|
||||
|
||||
@@ -96,8 +96,6 @@ StringSet ParsedDerivation::getRequiredSystemFeatures() const
|
||||
StringSet res;
|
||||
for (auto & i : getStringsAttr("requiredSystemFeatures").value_or(Strings()))
|
||||
res.insert(i);
|
||||
if (!drv.type().hasKnownOutputPaths())
|
||||
res.insert("ca-derivations");
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -1447,18 +1447,6 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
if (!experimentalFeatureSettings.isEnabled(Xp::CaDerivations) || !TRY_AWAIT(isValidPath(path)))
|
||||
co_return path;
|
||||
|
||||
auto drv = TRY_AWAIT(readDerivation(path));
|
||||
if (!drv.type().hasKnownOutputPaths()) {
|
||||
// The build log is actually attached to the corresponding
|
||||
// resolved derivation, so we need to get it first
|
||||
auto resolvedDrv = TRY_AWAIT(drv.tryResolve(*this));
|
||||
if (resolvedDrv)
|
||||
co_return TRY_AWAIT(writeDerivation(*this, *resolvedDrv, NoRepair, true));
|
||||
}
|
||||
|
||||
co_return path;
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
|
||||
Reference in New Issue
Block a user