Skip to content

Commit

Permalink
Don't anticipate multiple CA outputs for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed Jun 3, 2020
1 parent 3a9e4c3 commit 74b251b
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions src/libstore/local-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -552,29 +552,21 @@ void LocalStore::checkDerivationOutputs(const StorePath & drvPath, const Derivat
};


// Don't need the answer, but do this anyways to assert is proper
// combination. The code below is more general and naturally allows
// combinations that are currently prohibited.
drv.type();

std::optional<Hash> h;
for (auto & i : drv.outputs) {
if (i.second.hashAlgo == "") {
if (!h) {
// somewhat expensive so we do lazily
h = hashDerivationModulo(*this, drv, true);
}
StorePath path = makeOutputPath(i.first, *h, drvName);
check(path, i.second.path, i.first);
} else {
if (i.second.hash == "") {
throw Error("Fixed output derivation needs hash");
}
FileIngestionMethod recursive; Hash h;
i.second.parseHashInfo(recursive, h);
StorePath path = makeFixedOutputPath(recursive, h, drvName);
check(path, i.second.path, i.first);
}
if (derivationIsFixed(drv.type())) {
DerivationOutputs::const_iterator out = drv.outputs.find("out");
if (out == drv.outputs.end())
throw Error("derivation '%s' does not have an output named 'out'", printStorePath(drvPath));

FileIngestionMethod method; Hash h;
out->second.parseHashInfo(method, h);

check(makeFixedOutputPath(method, h, drvName), out->second.path, "out");
}

else {
Hash h = hashDerivationModulo(*this, drv, true);
for (auto & i : drv.outputs)
check(makeOutputPath(i.first, h, drvName), i.second.path, i.first);
}
}

Expand Down

0 comments on commit 74b251b

Please sign in to comment.