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-14 07:35:03 +0100
commit2a1b85a203dd088f262aaa49c95d880027a4d367 (patch)
tree112707790973c281bf80f39c9b80e1b939b6533e
parent1bcf62cb817ec321a38131dc2a0506609e537f8e (diff)
downloadbuildstream-2a1b85a203dd088f262aaa49c95d880027a4d367.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 0aff5fb94..dc76edad9 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -163,6 +163,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
@@ -614,6 +626,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)
@@ -633,6 +647,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()
@@ -661,6 +677,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()