aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-24 21:02:51 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-24 21:14:06 +0000
commit2c7557481b4c9d5113a65cc7a75c8acc18031f4e (patch)
tree11670e25941c01ffe9a45162753813120348c326 /src/libstore/store-api.cc
parent2292814049256980c6e809ab364ebe0da3c9d76a (diff)
`queryDerivationOutputMap` no longer assumes all outputs have a mapping
This assumption is broken by CA derivations. Making a PR now to do the breaking daemon change as soon as possible (if it is already too late, we can bump protocol intead).
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index ab21b0bd5..a624fafdd 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -330,9 +330,20 @@ bool Store::PathInfoCacheValue::isKnownNow()
return std::chrono::steady_clock::now() < time_point + ttl;
}
+OutputPathMap Store::queryDerivationOutputMapAssumeTotal(const StorePath & path) {
+ auto resp = queryDerivationOutputMap(path);
+ OutputPathMap result;
+ for (auto & [outName, optOutPath] : resp) {
+ if (!optOutPath)
+ throw Error("output '%s' has no store path mapped to it", outName);
+ result.insert_or_assign(outName, *optOutPath);
+ }
+ return result;
+}
+
StorePathSet Store::queryDerivationOutputs(const StorePath & path)
{
- auto outputMap = this->queryDerivationOutputMap(path);
+ auto outputMap = this->queryDerivationOutputMapAssumeTotal(path);
StorePathSet outputPaths;
for (auto & i: outputMap) {
outputPaths.emplace(std::move(i.second));