From 8d9bf0249cf5293402304aacb5af98ddd4b23c24 Mon Sep 17 00:00:00 2001 From: Benjamin Schubert Date: Thu, 1 Oct 2020 09:51:18 +0000 Subject: element.py: Stop computing cache keys when caching, we should have them This removes a call to `__update_cache_key_non_strict()` in the job for non strict builds. This call has an impact on other elements and should never be done beforehand. This however means we need to compute cache keys before, and we therefore need to re-compute the cache keys as an element become buildable --- src/buildstream/element.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/buildstream/element.py') diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 81e55a01b..7b3b704d2 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -1850,8 +1850,9 @@ class Element(Plugin): except VirtualDirectoryError: pass - # ensure we have cache keys - self.__update_cache_key_non_strict() + # We should always have cache keys already set when caching an artifact + assert self.__cache_key is not None + assert self.__artifact._cache_key is not None with self.timed_activity("Caching artifact"): artifact_size = self.__artifact.cache(sandbox_build_dir, collectvdir, sourcesvdir, buildresult, publicdata) @@ -2410,6 +2411,7 @@ class Element(Plugin): assert not rdep.__build_deps_uncached < 0 if rdep.__buildable_callback is not None and rdep._buildable(): + rdep.__update_cache_key_non_strict() rdep.__buildable_callback(rdep) rdep.__buildable_callback = None -- cgit v1.2.1