summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2018-01-22 17:49:17 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2018-01-22 17:54:18 +0000
commit6eff8f0d0d94c96060d5565425d8c1cfeacde9fe (patch)
treee4f01d0b5ed868de73b86cc7ed5fd4e28e767323
parentd3ad4621ad597a24b05d37df2a145c715d09473f (diff)
downloadbuildstream-6eff8f0d0d94c96060d5565425d8c1cfeacde9fe.tar.gz
element.py: Calculate strict key from cached artifact if available
This code path was previously storing its results in the obsolete __cache_key member, leaving __strict_cache_key unset. This was broken as code relies on __strict_cache_key being set once there is a strict cache key available.
-rw-r--r--buildstream/element.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index abbea929e..f8b388a22 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1409,6 +1409,14 @@ class Element(Plugin):
]
self.__strict_cache_key = self.__calculate_cache_key(dependencies)
+ if self.__strict_cache_key is None and self._cached():
+ # Strict cache key could not be calculated yet, but we can load
+ # it from the artifact. (This happens after we pull using the
+ # weak key).
+ metadir = os.path.join(self.__artifacts.extract(self), 'meta')
+ meta = _yaml.load(os.path.join(metadir, 'artifact.yaml'))
+ self.__strict_cache_key = meta['keys']['strong']
+
if self.__strict_cache_key is None:
# Strict cache key could not be calculated yet
return