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/17 16:51:11 UTC

[buildstream] 01/02: element.py: Reorder checks in _buildable()

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

juergbi pushed a commit to branch juerg/non-strict-cache-key
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 772e7868147a4e6ecd8a9f1923310fe854715466
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Wed Mar 17 16:11:11 2021 +0100

    element.py: Reorder checks in _buildable()
    
    Source cache status is not always available for non-build pipelines.
    Don't call `_fetch_needed()` if `__assemble_scheduled` is `False`.
---
 src/buildstream/element.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 6a296bf..eb1b02c 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1264,10 +1264,12 @@ class Element(Plugin):
     #    (bool): Whether this element can currently be built
     #
     def _buildable(self):
-        if self._fetch_needed():
+        # This check must be before `_fetch_needed()` as source cache status
+        # is not always available for non-build pipelines.
+        if not self.__assemble_scheduled:
             return False
 
-        if not self.__assemble_scheduled:
+        if self._fetch_needed():
             return False
 
         return self.__build_deps_uncached == 0