You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ju...@apache.org on 2021/03/18 09:40:18 UTC

[buildstream] 03/05: _stream.py: query_cache: Rename `sources` parameter to `only_sources`

This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a commit to branch juerg/build-with-source-push
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 9c16df7b41bf45c54f058f521699f4f4acea0709
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Thu Mar 18 09:50:34 2021 +0100

    _stream.py: query_cache: Rename `sources` parameter to `only_sources`
    
    This is a clarification in preparation for an additional parameter.
---
 src/buildstream/_stream.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 2645171..98ecf3b 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -195,9 +195,9 @@ class Stream:
     #
     # Args:
     #    elements (list of Element): The elements to check
-    #    sources (bool): True to only query the source cache
+    #    only_sources (bool): True to only query the source cache
     #
-    def query_cache(self, elements, *, sources=False):
+    def query_cache(self, elements, *, only_sources=False):
         with self._context.messenger.timed_activity("Query cache", silent_nested=True):
             # Enqueue complete build plan as this is required to determine `buildable` status.
             plan = list(_pipeline.dependencies(elements, _Scope.ALL))
@@ -208,7 +208,7 @@ class Stream:
                     # This is the case for artifact elements, which load the
                     # artifact early on.
                     pass
-                elif not sources and element._get_cache_key(strength=_KeyStrength.WEAK):
+                elif not only_sources and element._get_cache_key(strength=_KeyStrength.WEAK):
                     element._load_artifact(pull=False)
                     if not element._can_query_cache() or not element._cached_success():
                         element._query_source_cache()
@@ -322,7 +322,7 @@ class Stream:
 
         # Ensure we have our sources if we are launching a build shell
         if scope == _Scope.BUILD and not usebuildtree:
-            self.query_cache([element], sources=True)
+            self.query_cache([element], only_sources=True)
             self._fetch([element])
             _pipeline.assert_sources_cached(self._context, [element])
 
@@ -438,7 +438,7 @@ class Stream:
             ignore_project_source_remotes=ignore_project_source_remotes,
         )
 
-        self.query_cache(elements, sources=True)
+        self.query_cache(elements, only_sources=True)
 
         # Delegated to a shared fetch method
         self._fetch(elements, announce_session=True)
@@ -512,7 +512,7 @@ class Stream:
             ignore_project_source_remotes=ignore_project_source_remotes,
         )
 
-        self.query_cache(elements, sources=True)
+        self.query_cache(elements, only_sources=True)
 
         if not self._sourcecache.has_push_remotes():
             raise StreamError("No source caches available for pushing sources")
@@ -897,7 +897,7 @@ class Stream:
         )
 
         # Assert all sources are cached in the source dir
-        self.query_cache(elements, sources=True)
+        self.query_cache(elements, only_sources=True)
         self._fetch(elements)
         _pipeline.assert_sources_cached(self._context, elements)
 
@@ -948,7 +948,7 @@ class Stream:
         # If we're going to checkout, we need at least a fetch,
         #
         if not no_checkout:
-            self.query_cache(elements, sources=True)
+            self.query_cache(elements, only_sources=True)
             self._fetch(elements, fetch_original=True)
 
         expanded_directories = []