aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build-result.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/build-result.cc')
-rw-r--r--src/libstore/build-result.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libstore/build-result.cc b/src/libstore/build-result.cc
index 18f519c5c..de280c13f 100644
--- a/src/libstore/build-result.cc
+++ b/src/libstore/build-result.cc
@@ -15,4 +15,27 @@ GENERATE_CMP_EXT(
me->cpuUser,
me->cpuSystem);
+KeyedBuildResult BuildResult::restrictTo(DerivedPath path) const
+{
+ KeyedBuildResult res{*this, std::move(path)};
+
+ if (auto pbp = std::get_if<DerivedPath::Built>(&res.path)) {
+ auto & bp = *pbp;
+
+ /* Because goals are in general shared between derived paths
+ that share the same derivation, we need to filter their
+ results to get back just the results we care about.
+ */
+
+ for (auto it = res.builtOutputs.begin(); it != res.builtOutputs.end();) {
+ if (bp.outputs.contains(it->first))
+ ++it;
+ else
+ it = res.builtOutputs.erase(it);
+ }
+ }
+
+ return res;
+}
+
}