summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-09-21 15:56:46 +0200
committerJürg Billeter <j@bitron.ch>2020-12-04 16:28:30 +0100
commit6d3518a49b5020b2d40be91bcb75f1f88a6c1b1d (patch)
tree7048df3d91b68de183ad28a60e2b55b32e291660
parent23045bc59b71e0e5e6736452eb1f5b300b7ee5dd (diff)
downloadbuildstream-6d3518a49b5020b2d40be91bcb75f1f88a6c1b1d.tar.gz
_stream.py: Add query_cache() method
This is preparation for explicit cache query.
-rw-r--r--src/buildstream/_frontend/cli.py2
-rw-r--r--src/buildstream/_stream.py18
2 files changed, 20 insertions, 0 deletions
diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index 5e42bda68..3428b3d27 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -551,6 +551,8 @@ def show(app, elements, deps, except_, order, format_):
dependencies = app.stream.load_selection(elements, selection=deps, except_targets=except_)
+ app.stream.query_cache(dependencies)
+
if order == "alpha":
dependencies = sorted(dependencies)
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 91d7cb122..0d2ddfbc3 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -162,6 +162,18 @@ class Stream:
return target_objects
+ # query_cache()
+ #
+ # Query the artifact and source caches to determine the cache status
+ # of the specified elements.
+ #
+ # Args:
+ # elements (list of Element): The elements to check
+ #
+ def query_cache(self, elements):
+ # Cache is implicitly queried on demand
+ pass
+
# shell()
#
# Run a shell
@@ -613,6 +625,8 @@ class Stream:
targets, selection=selection, use_artifact_config=True, load_artifacts=True
)
+ self.query_cache(target_objects)
+
if self._artifacts.has_fetch_remotes():
self._pipeline.check_remotes(target_objects)
@@ -638,6 +652,8 @@ class Stream:
# Return list of Element and/or ArtifactElement objects
target_objects = self.load_selection(targets, selection=_PipelineSelection.NONE, load_artifacts=True)
+ self.query_cache(target_objects)
+
artifact_logs = {}
for obj in target_objects:
ref = obj.get_artifact_name()
@@ -666,6 +682,8 @@ class Stream:
# Return list of Element and/or ArtifactElement objects
target_objects = self.load_selection(targets, selection=_PipelineSelection.NONE, load_artifacts=True)
+ self.query_cache(target_objects)
+
elements_to_files = {}
for obj in target_objects:
ref = obj.get_artifact_name()