1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 04:21:16 +02:00

Remove references from fixed output derivation ab syntax

In other words, use a plain `ContentAddress` not
`ContentAddressWithReferences` for `DerivationOutput::CAFixed`.

Supporting fixed output derivations with (fixed) references would be a
cool feature, but it is out of scope at this moment.
This commit is contained in:
John Ericson 2023-04-19 14:48:53 -04:00
parent aba8a8a83a
commit 7103c6da70
9 changed files with 55 additions and 52 deletions

View file

@ -83,26 +83,16 @@ void Store::computeFSClosure(const StorePath & startPath,
}
std::optional<ContentAddress> getDerivationCA(const BasicDerivation & drv)
const ContentAddress * getDerivationCA(const BasicDerivation & drv)
{
auto out = drv.outputs.find("out");
if (out == drv.outputs.end())
return std::nullopt;
return nullptr;
if (auto dof = std::get_if<DerivationOutput::CAFixed>(&out->second)) {
return std::visit(overloaded {
[&](const TextInfo & ti) -> std::optional<ContentAddress> {
if (!ti.references.empty())
return std::nullopt;
return ti.hash;
},
[&](const FixedOutputInfo & fi) -> std::optional<ContentAddress> {
if (!fi.references.empty())
return std::nullopt;
return fi.hash;
},
}, dof->ca.raw);
return &dof->ca;
}
return std::nullopt;
return nullptr;
}
void Store::queryMissing(const std::vector<DerivedPath> & targets,
@ -152,7 +142,13 @@ void Store::queryMissing(const std::vector<DerivedPath> & targets,
if (drvState_->lock()->done) return;
SubstitutablePathInfos infos;
querySubstitutablePathInfos({{outPath, getDerivationCA(*drv)}}, infos);
auto * cap = getDerivationCA(*drv);
querySubstitutablePathInfos({
{
outPath,
cap ? std::optional { *cap } : std::nullopt,
},
}, infos);
if (infos.empty()) {
drvState_->lock()->done = true;