diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-04-09 17:35:29 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2018-04-09 10:25:36 +0000 |
commit | 0fbb550e4d0ddaa96b7d9fa82e848924910939e5 (patch) | |
tree | 235c5b540aefa2d580b088a7d66094fdf48ca24c | |
parent | 62346702d28c0d5cf6c487ec250c6ee810904216 (diff) | |
download | buildstream-0fbb550e4d0ddaa96b7d9fa82e848924910939e5.tar.gz |
element.py, source.py: Removing knowledge of assemble scheduling state from source
And considering the workspace related edge cases in Element instead of Source.
-rw-r--r-- | buildstream/element.py | 16 | ||||
-rw-r--r-- | buildstream/source.py | 33 |
2 files changed, 8 insertions, 41 deletions
diff --git a/buildstream/element.py b/buildstream/element.py index 867937115..13d13a861 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -856,8 +856,10 @@ class Element(Plugin): assert not self.__assemble_scheduled self.__assemble_scheduled = True - for source in self.__sources: - source._schedule_assemble() + # Invalidate workspace key as the build modifies the workspace directory + workspace = self._get_workspace() + if workspace: + workspace.invalidate_key() self._update_state() @@ -871,9 +873,6 @@ class Element(Plugin): def _assemble_done(self): assert self.__assemble_scheduled - for source in self.__sources: - source._assemble_done() - self.__assemble_scheduled = False self.__assemble_done = True @@ -1663,9 +1662,10 @@ class Element(Plugin): # Tracking may still be pending return - if any([not source._stable() for source in self.__sources]): - # If any source is not stable, discard current cache key values - # as their correct values can only be calculated once the build is complete + if self._get_workspace() and self.__assemble_scheduled: + # If we have an active workspace and are going to build, then + # discard current cache key values as their correct values can only + # be calculated once the build is complete self.__cache_key_dict = None self.__cache_key = None self.__weak_cache_key = None diff --git a/buildstream/source.py b/buildstream/source.py index 286db5707..e6ca99735 100644 --- a/buildstream/source.py +++ b/buildstream/source.py @@ -88,7 +88,6 @@ class Source(Plugin): self.__element_index = meta.element_index # The index of the source in the owning element's source list self.__directory = meta.directory # Staging relative directory self.__consistency = Consistency.INCONSISTENT # Cached consistency state - self.__assemble_scheduled = False # Source is scheduled to be assembled self.__workspace = None # Directory of the currently active workspace # Collect the composited element configuration and @@ -323,37 +322,6 @@ class Source(Plugin): def _get_consistency(self): return self.__consistency - # _schedule_assemble(): - # - # This is called in the main process before the element is assembled - # in a subprocess. - # - def _schedule_assemble(self): - assert not self.__assemble_scheduled - self.__assemble_scheduled = True - - # Invalidate workspace key as the build modifies the workspace directory - if self._has_workspace(): - self.__workspace.invalidate_key() - - # _assemble_done(): - # - # This is called in the main process after the element has been assembled - # in a subprocess. - # - def _assemble_done(self): - assert self.__assemble_scheduled - self.__assemble_scheduled = False - - # _stable(): - # - # Unstable sources are mounted read/write and thus cannot produce a - # (stable) cache key before the build is complete. - # - def _stable(self): - # Source directory is modified by workspace build process - return not (self._has_workspace() and self.__assemble_scheduled) - # Wrapper function around plugin provided fetch method # def _fetch(self): @@ -406,7 +374,6 @@ class Source(Plugin): key['directory'] = self.__directory if self._has_workspace(): - assert not self.__assemble_scheduled key['workspace'] = self.__workspace.get_key() else: key['unique'] = self.get_unique_key() |