diff options
author | Benjamin Schubert <bschubert15@bloomberg.net> | 2019-11-28 10:59:52 +0000 |
---|---|---|
committer | Benjamin Schubert <bschubert15@bloomberg.net> | 2020-01-15 11:54:58 +0000 |
commit | f6b40474ec7470beffce5600e1a6266b2b352774 (patch) | |
tree | fa7226867cf32c42e53ef706b8d68280df51069a /src/buildstream/_gitsourcebase.py | |
parent | 7a8772b7872363d867ce1963ab6d0e7a587b3d05 (diff) | |
download | buildstream-f6b40474ec7470beffce5600e1a6266b2b352774.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/_gitsourcebase.py')
-rw-r--r-- | src/buildstream/_gitsourcebase.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/buildstream/_gitsourcebase.py b/src/buildstream/_gitsourcebase.py index ce2ef9731..125d34df4 100644 --- a/src/buildstream/_gitsourcebase.py +++ b/src/buildstream/_gitsourcebase.py @@ -527,6 +527,9 @@ class _GitSourceBase(Source): def is_resolved(self): return self.mirror.ref is not None + def is_cached(self): + return self._have_all_refs() + def load_ref(self, node): self.mirror.ref = node.get_str("ref", None) self.mirror.tags = self._load_tags(node) |