summaryrefslogtreecommitdiff
path: root/src/buildstream/_gitsourcebase.py
diff options
context:
space:
mode:
authorBenjamin Schubert <bschubert15@bloomberg.net>2019-11-28 10:59:52 +0000
committerBenjamin Schubert <bschubert15@bloomberg.net>2020-01-16 16:33:19 +0000
commit3be6d07753599ef54b9e80ac066571632e217ce2 (patch)
treee14db9bba2d32ddb2840ab5513afde5b1ece2055 /src/buildstream/_gitsourcebase.py
parent4a47af24fca8aeb6c0c0fe6bd754712ecce5211d (diff)
downloadbuildstream-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/_gitsourcebase.py')
-rw-r--r--src/buildstream/_gitsourcebase.py3
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)