diff options
author | Benjamin Schubert <bschubert15@bloomberg.net> | 2019-11-28 10:59:52 +0000 |
---|---|---|
committer | Benjamin Schubert <bschubert15@bloomberg.net> | 2020-01-16 16:33:19 +0000 |
commit | 3be6d07753599ef54b9e80ac066571632e217ce2 (patch) | |
tree | e14db9bba2d32ddb2840ab5513afde5b1ece2055 /src/buildstream/element.py | |
parent | 4a47af24fca8aeb6c0c0fe6bd754712ecce5211d (diff) | |
download | buildstream-3be6d07753599ef54b9e80ac066571632e217ce2.tar.gz |
source.py: Remove the reliance on consistency to get whether a source is cached
This removes the need to use consistency in Sources, by asking
explicitely whether the source is cached or not.
This introduces a new public method on source: `is_cached` that needs
implementation and that should return whether the source has a local
copy or not.
- On fetch, also reset whether the source was cached or set if as
cached when we know it was.
- Validate the cache's source after fetching it
This doesn't need to be run in the scheduler's process and can be
offloaded to the child, which will allow better multiprocessing
Diffstat (limited to 'src/buildstream/element.py')
-rw-r--r-- | src/buildstream/element.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 44c2bf847..b0a4da928 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -1727,7 +1727,13 @@ class Element(Plugin): # # Indicates that fetching the sources for this element has been done. # - def _fetch_done(self): + # Args: + # fetched_original (bool): Whether the original sources had been asked (and fetched) or not + # + def _fetch_done(self, fetched_original): + for source in self.__sources: + source._fetch_done(fetched_original) + # We are not updating the state recursively here since fetching can # never end up in updating them. |