summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-05-03 15:44:06 +0200
committerJürg Billeter <j@bitron.ch>2018-05-03 16:06:55 +0200
commiteceb7c982295b402ab18730796dbb61112f72468 (patch)
treefc70d05696b29f4eadb45ffb9aae7fdb19d9db19
parentf00a435ce51e9fe929615a34be82bbd77d8f1c12 (diff)
downloadbuildstream-juerg/non-strict-buildable.tar.gz
element.py: Fix buildable check in non-strict modejuerg/non-strict-buildable
Ensure that the strong cache key of each build dependency is available before an element is built. Otherwise the strong cache key of the element cannot be calculated and caching the artifact produces an AssertionError. In non-strict mode an element's strong cache key may not be available yet even though an artifact is available in the local cache. This can happen if the pull job is still pending as the remote cache may have an artifact that matches the strict cache key, which is preferred over a locally cached artifact with a weak cache key match. Fixes #383.
-rw-r--r--buildstream/element.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 3c532c716..b49a75692 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -958,7 +958,12 @@ class Element(Plugin):
return False
for dependency in self.dependencies(Scope.BUILD):
- if not dependency._cached():
+ # In non-strict mode an element's strong cache key may not be available yet
+ # even though an artifact is available in the local cache. This can happen
+ # if the pull job is still pending as the remote cache may have an artifact
+ # that matches the strict cache key, which is preferred over a locally
+ # cached artifact with a weak cache key match.
+ if not dependency._cached() or not dependency._get_cache_key(strength=_KeyStrength.STRONG):
return False
if not self.__assemble_scheduled: