summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.co.uk>2019-05-13 12:16:10 +0100
committerJames Ennis <james.ennis@codethink.co.uk>2019-05-13 12:16:10 +0100
commitd6f958676a3579b0d234842c953f6708ca843af5 (patch)
treeeeedd1ed26b93f51732495a0ba562cd6f817014f
parent9800accc7432c7ac3f375d7fa0c5f8ed28cd47ff (diff)
downloadbuildstream-jennis/subtract_when_required.tar.gz
_stream.py: Don't subtract elements if we have nothing to subtractjennis/subtract_when_required
-rw-r--r--buildstream/_stream.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index d4f26e443..4ed0d681a 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -242,7 +242,8 @@ class Stream():
dynamic_plan=True)
# Remove the tracking elements from the main targets
- elements = self._pipeline.subtract_elements(elements, track_elements)
+ if track_elements:
+ elements = self._pipeline.subtract_elements(elements, track_elements)
# Assert that the elements we're not going to track are consistent
self._pipeline.assert_consistent(elements)
@@ -1230,9 +1231,9 @@ class Stream():
if track_elements is None:
track_elements = []
-
- # Subtract the track elements from the fetch elements, they will be added separately
- fetch_plan = self._pipeline.subtract_elements(elements, track_elements)
+ else:
+ # Subtract the track elements from the fetch elements, they will be added separately
+ fetch_plan = self._pipeline.subtract_elements(elements, track_elements)
# Assert consistency for the fetch elements
self._pipeline.assert_consistent(fetch_plan)
@@ -1241,7 +1242,8 @@ class Stream():
# let the track plan resolve new refs.
cached = [elt for elt in fetch_plan
if not elt._should_fetch(fetch_original)]
- fetch_plan = self._pipeline.subtract_elements(fetch_plan, cached)
+ if cached:
+ fetch_plan = self._pipeline.subtract_elements(fetch_plan, cached)
# Construct queues, enqueue and run
#