summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-08-28 10:46:56 +0200
committerJürg Billeter <j@bitron.ch>2018-08-28 10:56:06 +0200
commitddbf7bc2381ae3b0955f64505b2515533b5c1a7a (patch)
tree10b2844be43b786f8eeea37603525b5b9ba14bae
parent8c7fadd81f39a157bc2efe5ce605d199396f4791 (diff)
downloadbuildstream-ddbf7bc2381ae3b0955f64505b2515533b5c1a7a.tar.gz
element.py: Schedule assemble for key of workspaced elements
For uncached workspaced elements, assemble is required even just to calculate the cache key. As dynamic scheduling relies on cache keys, schedule assemble for uncached workspace elements even if they have not been marked as required yet. Fixes #461.
-rw-r--r--buildstream/element.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index d9c096992..2c26999c7 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1101,9 +1101,12 @@ class Element(Plugin):
# until the full cache query below.
if (not self.__assemble_scheduled and not self.__assemble_done and
not self.__cached_success(keystrength=_KeyStrength.WEAK) and
- not self._pull_pending() and self._is_required()):
- self._schedule_assemble()
- return
+ not self._pull_pending()):
+ # For uncached workspaced elements, assemble is required
+ # even if we only need the cache key
+ if self._is_required() or self._get_workspace():
+ self._schedule_assemble()
+ return
if self.__strict_cache_key is None:
dependencies = [
@@ -1126,13 +1129,17 @@ class Element(Plugin):
self.__weak_cached = self.__artifacts.contains(self, self.__weak_cache_key)
if (not self.__assemble_scheduled and not self.__assemble_done and
- not self._cached_success() and not self._pull_pending() and self._is_required()):
+ not self._cached_success() and not self._pull_pending()):
# Workspaced sources are considered unstable if a build is pending
# as the build will modify the contents of the workspace.
# Determine as early as possible if a build is pending to discard
# unstable cache keys.
- self._schedule_assemble()
- return
+
+ # For uncached workspaced elements, assemble is required
+ # even if we only need the cache key
+ if self._is_required() or self._get_workspace():
+ self._schedule_assemble()
+ return
if self.__cache_key is None:
# Calculate strong cache key
@@ -1430,7 +1437,6 @@ class Element(Plugin):
# in a subprocess.
#
def _schedule_assemble(self):
- assert self._is_required()
assert not self.__assemble_scheduled
self.__assemble_scheduled = True
@@ -1438,6 +1444,8 @@ class Element(Plugin):
for dep in self.dependencies(Scope.BUILD, recurse=False):
dep._set_required()
+ self._set_required()
+
# Invalidate workspace key as the build modifies the workspace directory
workspace = self._get_workspace()
if workspace: