diff options
author | James Ennis <james.ennis@codethink.co.uk> | 2019-04-18 13:01:06 +0100 |
---|---|---|
committer | James Ennis <james.ennis@codethink.co.uk> | 2019-04-18 13:01:06 +0100 |
commit | 92dbd508c6d538aebdc430210f0b5883a323a8ce (patch) | |
tree | 01561eb4281e8b84bf0a61cf6fbc14ac6931b1a5 | |
parent | fb68057dd2f9bc460c4d23760e973ac5f75d7c6e (diff) | |
download | buildstream-jennis/rebase_fixups.tar.gz |
fixupsjennis/rebase_fixups
-rw-r--r-- | buildstream/_cachekey/cachekey.py | 4 | ||||
-rw-r--r-- | buildstream/_cachekey/strictcachekey.py | 9 | ||||
-rw-r--r-- | buildstream/element.py | 20 |
3 files changed, 24 insertions, 9 deletions
diff --git a/buildstream/_cachekey/cachekey.py b/buildstream/_cachekey/cachekey.py index d3ae19042..15b0df0f7 100644 --- a/buildstream/_cachekey/cachekey.py +++ b/buildstream/_cachekey/cachekey.py @@ -71,11 +71,11 @@ class CacheKey(): def _update_weak_cached(self): if self._weak_key and not self._weak_cached: - self._weak_cached = self._element._is_key_cached(self._weak_key) + self._weak_cached = self._element._is_weak_cached() def _update_strong_cached(self): if self._strict_key and not self._strong_cached: - self._strong_cached = self._element._is_key_cached(self._strict_key) + self._strong_cached = self._element._is_strong_cached() # Set the weak key def _calculate_weak_key(self): diff --git a/buildstream/_cachekey/strictcachekey.py b/buildstream/_cachekey/strictcachekey.py index e87fb548e..e984886a7 100644 --- a/buildstream/_cachekey/strictcachekey.py +++ b/buildstream/_cachekey/strictcachekey.py @@ -40,6 +40,12 @@ class StrictCacheKey(CacheKey): # and not cached return + # Assemble the strict artifact + self._element._assemble_strict_artifact() + + if self._strong_key is None: + self._strong_key = self._strict_key + self._update_strong_cached() # TODO: Figure out why _weak_cached is only set if it's identical @@ -47,9 +53,6 @@ class StrictCacheKey(CacheKey): if self._strict_key == self._weak_key: self._update_weak_cached() - if self._strong_key is None: - self._strong_key = self._strict_key - self._element._check_ready_for_runtime() def get_key(self, strength): diff --git a/buildstream/element.py b/buildstream/element.py index bd9ccbdf1..944110246 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -1308,6 +1308,15 @@ class Element(Plugin): self._check_ready_for_runtime() + def _assemble_strict_artifact(self): + context = self._get_context() + strict = self._get_cache_key(strength=_KeyStrength.STRICT) + weak = self._get_cache_key(strength=_KeyStrength.WEAK) + self.__strict_artifact = Artifact(self, context, strong_key=strict, + weak_key=weak) + self.__artifact = self.__strict_artifact + + # _get_display_key(): # # Returns cache keys for display purposes @@ -2373,13 +2382,16 @@ class Element(Plugin): self.__ready_for_runtime = all( dep.__ready_for_runtime for dep in self.__runtime_dependencies) - # _is_key_cached(): + # _is_strong_cached(): # # TODO: DOCSTRING # - def _is_key_cached(self, key): - assert key - return self.__artifact.cached(key) + def _is_strong_cached(self): + return self.__strict_artifact.cached() + + def _is_weak_cached(self): + return self.__artifact.cached() + # _is_pending_assembly(): # |