aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/misc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/misc.cc')
-rw-r--r--src/libstore/misc.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc
index 87f85c3cc..9a38a0713 100644
--- a/src/libstore/misc.cc
+++ b/src/libstore/misc.cc
@@ -85,9 +85,21 @@ void Store::computeFSClosure(const StorePath & startPath,
std::optional<ContentAddress> getDerivationCA(const BasicDerivation & drv)
{
auto out = drv.outputs.find("out");
- if (out != drv.outputs.end()) {
- if (const auto * v = std::get_if<DerivationOutput::CAFixed>(&out->second.raw()))
- return v->hash;
+ if (out == drv.outputs.end())
+ return std::nullopt;
+ 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 static_cast<TextHash>(ti);
+ },
+ [&](const FixedOutputInfo & fi) -> std::optional<ContentAddress> {
+ if (!fi.references.empty())
+ return std::nullopt;
+ return static_cast<FixedOutputHash>(fi);
+ },
+ }, dof->ca);
}
return std::nullopt;
}