diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2019-07-05 14:23:45 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-07-09 16:54:37 +0000 |
commit | 478d7889ef8ffa927f7ba412bd5dd374032c381d (patch) | |
tree | 18dcd2c38f5f804224223bdc0bce403c69176a5b | |
parent | fcce77761d118fb96a07afa32ae578fb7015a1ad (diff) | |
download | buildstream-478d7889ef8ffa927f7ba412bd5dd374032c381d.tar.gz |
Pipeline: Add a helper for adding lists of elements together
Lists of elements should never contain duplicate elements.
This commit also uses the helper to calculate the list of elements
when pulling missing elements in `bst shell`
-rw-r--r-- | src/buildstream/_pipeline.py | 16 | ||||
-rw-r--r-- | src/buildstream/_stream.py | 3 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/buildstream/_pipeline.py b/src/buildstream/_pipeline.py index 4352df56c..440bd8bd3 100644 --- a/src/buildstream/_pipeline.py +++ b/src/buildstream/_pipeline.py @@ -319,6 +319,22 @@ class Pipeline(): if e not in subtract_set ] + # add_elements() + # + # Add to a list of elements all elements that are not already in it + # + # Args: + # elements (list of Element): The element list + # add (list of Element): List of elements to add + # + # Returns: + # (list): The original elements list, with elements in add that weren't + # already in it added. + def add_elements(self, elements, add): + ret = elements[:] + ret.extend(e for e in add if e not in ret) + return ret + # track_cross_junction_filter() # # Filters out elements which are across junction boundaries, diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index 594da997e..fcd40c3b4 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -180,7 +180,8 @@ class Stream(): self._message(MessageType.INFO, "Attempting to fetch missing or incomplete artifacts") self._scheduler.clear_queues() self._add_queue(PullQueue(self._scheduler)) - self._enqueue_plan([element] + missing_deps) + plan = self._pipeline.add_elements([element], missing_deps) + self._enqueue_plan(plan) self._run() buildtree = False |