summaryrefslogtreecommitdiff
path: root/src/buildstream/plugins/sources/local.py
diff options
context:
space:
mode:
authorBenjamin Schubert <bschubert15@bloomberg.net>2019-11-27 16:26:37 +0000
committerBenjamin Schubert <bschubert15@bloomberg.net>2020-01-16 16:33:19 +0000
commit4a47af24fca8aeb6c0c0fe6bd754712ecce5211d (patch)
tree08f72ea7bbc2979637900b1bcaeb8aa798d41c52 /src/buildstream/plugins/sources/local.py
parent93ebe4992c32b2588ae213a98c3e05d60c974a00 (diff)
downloadbuildstream-4a47af24fca8aeb6c0c0fe6bd754712ecce5211d.tar.gz
source.py: Add a new 'is_resolved' to get whether a source is resolved.
`get_consistency` is coarse grained and hard to optimize, in addition to being un-userfriendly. This adds a new `is_resolved` that has for default implementation `get_ref() is not None`, which is true for most sources in BuildStream. Sources for which this is not true can override the method to give a more accurate description. Checking for this before looking whether the source is cached can reduce the amount of work necessary in some pipeline and opens the door for more optimizations and the removal of the source state check.
Diffstat (limited to 'src/buildstream/plugins/sources/local.py')
-rw-r--r--src/buildstream/plugins/sources/local.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/buildstream/plugins/sources/local.py b/src/buildstream/plugins/sources/local.py
index 90d8a8f6f..f4a7270e6 100644
--- a/src/buildstream/plugins/sources/local.py
+++ b/src/buildstream/plugins/sources/local.py
@@ -64,6 +64,9 @@ class LocalSource(Source):
def get_consistency(self):
return Consistency.CACHED
+ def is_resolved(self):
+ return True
+
# We dont have a ref, we're a local file...
def load_ref(self, node):
pass