From 9c82bc8d352d8d94bdd6e27da0d93a65dbdb51f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Wed, 17 Mar 2021 16:11:11 +0100 Subject: [PATCH 1/2] 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 584dc6231..4cd3ba798 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -1264,10 +1264,12 @@ def _cached_failure(self): # (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 From 7b5a125db3c7ccc5e81000bfef040fae8e6f9c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Wed, 17 Mar 2021 14:54:57 +0100 Subject: [PATCH 2/2] element.py: Compute cache key also for rdep without buildable callback The reverse dependency may not be in the build queue yet and thus, the buildable callback may be `None`. However, it's still necessary to update the cache key in non-strict mode. Fixes #1452. Fixes: 8d9bf024 ("element.py: Stop computing cache keys when...") --- src/buildstream/element.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 4cd3ba798..0cfa81236 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -2412,10 +2412,12 @@ def _update_ready_for_runtime_and_cached(self): rdep.__build_deps_uncached -= 1 assert not rdep.__build_deps_uncached < 0 - if rdep.__buildable_callback is not None and rdep._buildable(): + if rdep._buildable(): rdep.__update_cache_key_non_strict() - rdep.__buildable_callback(rdep) - rdep.__buildable_callback = None + + if rdep.__buildable_callback is not None: + rdep.__buildable_callback(rdep) + rdep.__buildable_callback = None # _walk_artifact_files() #