diff options
author | Jürg Billeter <j@bitron.ch> | 2018-12-05 19:56:19 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-12-20 11:06:11 +0100 |
commit | 2b767fe80c7d75fe0acba4417249535fa8f14d90 (patch) | |
tree | 45aa111cc878c46b698ba793a0768a827dcb5712 | |
parent | aae5e4b309c22af6eb8251a8c75a49d207fb6d6f (diff) | |
download | buildstream-2b767fe80c7d75fe0acba4417249535fa8f14d90.tar.gz |
Move fetch logic from FetchQueue to Element
The queue shouldn't need to know about individual sources. This is in
line with _track() and _get_consistency().
-rw-r--r-- | buildstream/_scheduler/queues/fetchqueue.py | 5 | ||||
-rw-r--r-- | buildstream/element.py | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/buildstream/_scheduler/queues/fetchqueue.py b/buildstream/_scheduler/queues/fetchqueue.py index 446dbbd3b..c58bfdb57 100644 --- a/buildstream/_scheduler/queues/fetchqueue.py +++ b/buildstream/_scheduler/queues/fetchqueue.py @@ -40,10 +40,7 @@ class FetchQueue(Queue): self._skip_cached = skip_cached def process(self, element): - previous_sources = [] - for source in element.sources(): - source._fetch(previous_sources) - previous_sources.append(source) + element._fetch() def status(self, element): # state of dependencies may have changed, recalculate element state diff --git a/buildstream/element.py b/buildstream/element.py index e44a7cc32..e9a0f6f65 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -2022,6 +2022,19 @@ class Element(Plugin): return True + # _fetch() + # + # Fetch the element's sources. + # + # Raises: + # SourceError: If one of the element sources has an error + # + def _fetch(self): + previous_sources = [] + for source in self.sources(): + source._fetch(previous_sources) + previous_sources.append(source) + ############################################################# # Private Local Methods # ############################################################# |