forked from lix-project/lix
Revert "Don't anticipate multiple CA outputs for now"
This reverts commit 74b251b2f3
.
This commit is contained in:
parent
1feb8981df
commit
205dcd140d
|
@ -544,11 +544,8 @@ void LocalStore::checkDerivationOutputs(const StorePath & drvPath, const Derivat
|
||||||
std::string drvName(drvPath.name());
|
std::string drvName(drvPath.name());
|
||||||
drvName = string(drvName, 0, drvName.size() - drvExtension.size());
|
drvName = string(drvName, 0, drvName.size() - drvExtension.size());
|
||||||
|
|
||||||
auto check = [&](const StorePath & expected, const StorePath & actual, const std::string & varName)
|
auto envHasRightPath = [&](const StorePath & actual, const std::string & varName)
|
||||||
{
|
{
|
||||||
if (actual != expected)
|
|
||||||
throw Error("derivation '%s' has incorrect output '%s', should be '%s'",
|
|
||||||
printStorePath(drvPath), printStorePath(actual), printStorePath(expected));
|
|
||||||
auto j = drv.env.find(varName);
|
auto j = drv.env.find(varName);
|
||||||
if (j == drv.env.end() || parseStorePath(j->second) != actual)
|
if (j == drv.env.end() || parseStorePath(j->second) != actual)
|
||||||
throw Error("derivation '%s' has incorrect environment variable '%s', should be '%s'",
|
throw Error("derivation '%s' has incorrect environment variable '%s', should be '%s'",
|
||||||
|
@ -556,18 +553,34 @@ void LocalStore::checkDerivationOutputs(const StorePath & drvPath, const Derivat
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (derivationIsFixed(drv.type())) {
|
// Don't need the answer, but do this anyways to assert is proper
|
||||||
DerivationOutputs::const_iterator out = drv.outputs.find("out");
|
// combination. The code below is more general and naturally allows
|
||||||
if (out == drv.outputs.end())
|
// combinations that are currently prohibited.
|
||||||
throw Error("derivation '%s' does not have an output named 'out'", printStorePath(drvPath));
|
drv.type();
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
std::optional<Hash> h;
|
||||||
// Regular, non-CA derivation should always return a single hash and not
|
for (auto & i : drv.outputs) {
|
||||||
// hash per output.
|
std::visit(overloaded {
|
||||||
Hash h = std::get<0>(hashDerivationModulo(*this, drv, true));
|
[&](DerivationOutputInputAddressed doia) {
|
||||||
for (auto & i : drv.outputs)
|
if (!h) {
|
||||||
check(makeOutputPath(i.first, h, drvName), i.second.path(*this, drv.name), i.first);
|
// somewhat expensive so we do lazily
|
||||||
|
auto temp = hashDerivationModulo(*this, drv, true);
|
||||||
|
h = std::get<Hash>(temp);
|
||||||
|
}
|
||||||
|
StorePath recomputed = makeOutputPath(i.first, *h, drvName);
|
||||||
|
if (doia.path != recomputed)
|
||||||
|
throw Error("derivation '%s' has incorrect output '%s', should be '%s'",
|
||||||
|
printStorePath(drvPath), printStorePath(doia.path), printStorePath(recomputed));
|
||||||
|
envHasRightPath(doia.path, i.first);
|
||||||
|
},
|
||||||
|
[&](DerivationOutputFixed dof) {
|
||||||
|
StorePath path = makeFixedOutputPath(dof.hash.method, dof.hash.hash, drvName);
|
||||||
|
envHasRightPath(path, i.first);
|
||||||
|
},
|
||||||
|
[&](DerivationOutputFloating _) {
|
||||||
|
throw Error("Floating CA output derivations are not yet implemented");
|
||||||
|
},
|
||||||
|
}, i.second.output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue