diff options
author | James Ennis <james.ennis@codethink.co.uk> | 2019-05-20 14:59:14 +0100 |
---|---|---|
committer | James Ennis <james.ennis@codethink.co.uk> | 2019-06-07 14:47:16 +0100 |
commit | acdad4612477ebf688b5985f3b2b2380e7124b0e (patch) | |
tree | 8aa641be4eddc6e6f12027dc21ef6b39ac6f1399 | |
parent | 640f0ca5a17a144448a48de2a80e1f7a655eb9b2 (diff) | |
download | buildstream-acdad4612477ebf688b5985f3b2b2380e7124b0e.tar.gz |
element.py: Introduce __ready_for_runtime_and_cached
In order to know whether an element is buildable, we need to know
whether it's dependencies are cached as well as whether they have
been marked as ready for runtime. This patch introduces a second
"ready_for_runtime" check.
-rw-r--r-- | src/buildstream/element.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 909a0e851..4d295f455 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -207,7 +207,8 @@ class Element(Plugin): self.__runtime_dependencies = [] # Direct runtime dependency Elements self.__build_dependencies = [] # Direct build dependency Elements self.__reverse_dependencies = set() # Direct reverse dependency Elements - self.__ready_for_runtime = False # Wether the element has all its dependencies ready and has a cache key + self.__ready_for_runtime = False # Whether the element has all dependencies ready and has a cache key + self.__ready_for_runtime_and_cached = False # Whether the element has all deps ready for runtime and cached self.__sources = [] # List of Sources self.__weak_cache_key = None # Our cached weak cache key self.__strict_cache_key = None # Our cached cache key for strict builds @@ -1219,6 +1220,13 @@ class Element(Plugin): self.__ready_for_runtime = all( dep.__ready_for_runtime for dep in self.__runtime_dependencies) + if self.__ready_for_runtime: + # ready_for_runtime_and_cached is stronger than ready_for_runtime, so don't + # check the former if the latter is False + if not self.__ready_for_runtime_and_cached and self._cached_success(): + self.__ready_for_runtime_and_cached = all( + dep.__ready_for_runtime_and_cached for dep in self.__runtime_dependencies) + # _get_display_key(): # # Returns cache keys for display purposes @@ -2873,10 +2881,12 @@ class Element(Plugin): element = queue.pop() old_ready_for_runtime = element.__ready_for_runtime + old_ready_for_runtime_and_cached = element.__ready_for_runtime_and_cached old_strict_cache_key = element.__strict_cache_key element._update_state() if element.__ready_for_runtime != old_ready_for_runtime or \ + element.__ready_for_runtime_and_cached != old_ready_for_runtime_and_cached or \ element.__strict_cache_key != old_strict_cache_key: for rdep in element.__reverse_dependencies: queue.push(rdep._unique_id, rdep) |