This is an automated email from the ASF dual-hosted git repository. not-in-ldap pushed a commit to branch tpollard/artifacttemp in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 9a9ee4102f89e5a360aaf58e14170e24cb9f51ef Author: Tristan Van Berkom <[email protected]> AuthorDate: Mon May 6 19:36:47 2019 +0900 element.py: Reset workspace state if last successful build is missing. If the artifact referred to by the last successful build in the workspace state no longer exists, reset the workspace state and do not attempt to perform an incremental build instead of crashing. This fixes #1017 --- buildstream/element.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/buildstream/element.py b/buildstream/element.py index 8cc25fe..cc31d3f 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -738,8 +738,24 @@ class Element(Plugin): context = self._get_context() if self.__can_build_incrementally() and workspace.last_successful: - last_successful = Artifact(self, context, strong_key=workspace.last_successful) - old_dep_keys = last_successful.get_metadata_dependencies() + + # Try to perform an incremental build if the last successful + # build is still in the artifact cache + # + if self.__artifacts.contains(self, workspace.last_successful): + last_successful = Artifact(self, context, strong_key=workspace.last_successful) + old_dep_keys = last_successful.get_metadata_dependencies() + else: + # Last successful build is no longer in the artifact cache, + # so let's reset it and perform a full build now. + workspace.prepared = False + workspace.last_successful = None + + self.info("Resetting workspace state, last successful build is no longer in the cache") + + # In case we are staging in the main process + if utils._is_main_process(): + context.get_workspaces().save_config() for dep in self.dependencies(scope): # If we are workspaced, and we therefore perform an @@ -764,7 +780,7 @@ class Element(Plugin): # In case we are running `bst shell`, this happens in the # main process and we need to update the workspace config if utils._is_main_process(): - self._get_context().get_workspaces().save_config() + context.get_workspaces().save_config() result = dep.stage_artifact(sandbox, path=path,
