diff options
author | James Ennis <james.ennis@codethink.co.uk> | 2019-06-10 16:46:28 +0100 |
---|---|---|
committer | James Ennis <james.ennis@codethink.co.uk> | 2019-06-10 16:46:28 +0100 |
commit | b3371fd8ce271424fe5f95669f62e3a47f06f91a (patch) | |
tree | ea4c64310e40d7af2301029146be6ecc90e5c00d | |
parent | 2c9825918e0d56663779b6da727bfb3527a33538 (diff) | |
download | buildstream-jennis/die_update_state.tar.gz |
element.py: Separate initial resolving of elements from _update_statejennis/die_update_state
A new _resolve_cache_keys_and_state() method has been added to
Element. This ensures that sources are consistent, calculates
the cache keys and then determines the artifact state.
-rw-r--r-- | src/buildstream/_pipeline.py | 7 | ||||
-rw-r--r-- | src/buildstream/element.py | 26 |
2 files changed, 31 insertions, 2 deletions
diff --git a/src/buildstream/_pipeline.py b/src/buildstream/_pipeline.py index d44813348..427836a40 100644 --- a/src/buildstream/_pipeline.py +++ b/src/buildstream/_pipeline.py @@ -135,8 +135,11 @@ class Pipeline(): # Preflight element._preflight() - # Determine initial element state. - element._update_state() + element._resolve_cache_keys_and_state() + + # EWWW + if element._get_workspace() and not element._cached_success(): + element._set_required() # dependencies() # diff --git a/src/buildstream/element.py b/src/buildstream/element.py index a448b867c..fdbddc10c 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -1170,6 +1170,32 @@ class Element(Plugin): # cache cannot be queried until strict cache key is available return self.__strict_cache_key is not None + def _resolve_cache_keys_and_state(self): + context = self._get_context() + + # Ensure the element's sources are resolved + self.__update_source_state() + if self._get_consistency() == Consistency.INCONSISTENT: + return + + # Update the cache keys + # Note that for non-strict mode, the strong cache key cannot be + # calculated until we have updated the artifact state + self.__update_cache_keys() + + # update the artifact state + self.__update_artifact_state() + + if not context.get_strict(): + self.__update_cache_key_non_strict() + + # If the element is workspaced, it could potentially already be cached, + # therefore, determine the artifact data of the workspaced element + # immediately and check if it's cached. + # If not, reset the data + if self._get_workspace() and not self._cached_success(): + self.__reset_cache_data() + # _update_state() # # Keep track of element state. Calculate cache keys if possible and |