diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-04-19 14:48:53 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-04-19 15:00:04 -0400 |
commit | 7103c6da705c8a18fef9e8f8d404e8d0ab5082ff (patch) | |
tree | 53a6fb861243b174292a5d0177fab364461d8de9 /src/libstore/misc.cc | |
parent | aba8a8a83a89d577769a39a69e9b90e3ed0d4f82 (diff) |
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.
Diffstat (limited to 'src/libstore/misc.cc')
-rw-r--r-- | src/libstore/misc.cc | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc index 39bdfec6e..00f629a85 100644 --- a/src/libstore/misc.cc +++ b/src/libstore/misc.cc @@ -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; |