summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-01-21 19:07:53 +0100
committerJürg Billeter <j@bitron.ch>2020-02-11 21:08:57 +0100
commit7cd62cbc6e663890a87fad50b224671297e950c3 (patch)
tree4d28df4123e80bcf6c5d51a0d21d2f6f02dad1ff
parent2d0ef3aa9edb9794ac79abda98e6350efbee8b57 (diff)
downloadbuildstream-7cd62cbc6e663890a87fad50b224671297e950c3.tar.gz
_workspaces.py: Drop `running_files`
This will no longer be used in incremental builds. As source and build files are separated now, we can trigger a clean rebuild when dependencies change.
-rw-r--r--src/buildstream/_workspaces.py39
-rw-r--r--src/buildstream/element.py53
-rw-r--r--tests/frontend/workspace.py7
3 files changed, 6 insertions, 93 deletions
diff --git a/src/buildstream/_workspaces.py b/src/buildstream/_workspaces.py
index 3035411d6..78ae962b6 100644
--- a/src/buildstream/_workspaces.py
+++ b/src/buildstream/_workspaces.py
@@ -232,7 +232,7 @@ class WorkspaceProjectCache:
# An object to contain various helper functions and data required for
# workspaces.
#
-# last_successful, path and running_files are intended to be public
+# last_successful and path are intended to be public
# properties, but may be best accessed using this classes' helper
# methods.
#
@@ -240,16 +240,12 @@ class WorkspaceProjectCache:
# toplevel_project (Project): Top project. Will be used for resolving relative workspace paths.
# path (str): The path that should host this workspace
# last_successful (str): The key of the last successful build of this workspace
-# running_files (dict): A dict mapping dependency elements to files
-# changed between failed builds. Should be
-# made obsolete with failed build artifacts.
#
class Workspace:
- def __init__(self, toplevel_project, *, last_successful=None, path=None, prepared=False, running_files=None):
+ def __init__(self, toplevel_project, *, last_successful=None, path=None, prepared=False):
self.prepared = prepared
self.last_successful = last_successful
self._path = path
- self.running_files = running_files if running_files is not None else {}
self._toplevel_project = toplevel_project
self._key = None
@@ -262,7 +258,7 @@ class Workspace:
# (dict) A dict representation of the workspace
#
def to_dict(self):
- ret = {"prepared": self.prepared, "path": self._path, "running_files": self.running_files}
+ ret = {"prepared": self.prepared, "path": self._path}
if self.last_successful is not None:
ret["last_successful"] = self.last_successful
return ret
@@ -299,30 +295,6 @@ class Workspace:
def differs(self, other):
return self.to_dict() != other.to_dict()
- # add_running_files()
- #
- # Append a list of files to the running_files for the given
- # dependency. Duplicate files will be ignored.
- #
- # Args:
- # dep_name (str) - The dependency name whose files to append to
- # files (str) - A list of files to append
- #
- def add_running_files(self, dep_name, files):
- if dep_name in self.running_files:
- # ruamel.py cannot serialize sets in python3.4
- to_add = set(files) - set(self.running_files[dep_name])
- self.running_files[dep_name].extend(to_add)
- else:
- self.running_files[dep_name] = list(files)
-
- # clear_running_files()
- #
- # Clear all running files associated with this workspace.
- #
- def clear_running_files(self):
- self.running_files = {}
-
# get_absolute_path():
#
# Returns: The absolute path of the element's workspace.
@@ -543,15 +515,10 @@ class Workspaces:
# (Workspace): A newly instantiated Workspace
#
def _load_workspace(self, node):
- running_files = node.get_mapping("running_files", default=None)
- if running_files:
- running_files = running_files.strip_node_info()
-
dictionary = {
"prepared": node.get_bool("prepared", default=False),
"path": node.get_str("path"),
"last_successful": node.get_str("last_successful", default=None),
- "running_files": running_files,
}
return Workspace.from_dict(self._toplevel_project, dictionary)
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index af50c230d..d6a3b7cf4 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -747,59 +747,9 @@ class Element(Plugin):
ignored = {}
overlaps = OrderedDict() # type: OrderedDict[str, List[str]]
files_written = {} # type: Dict[str, List[str]]
- old_dep_keys = None
- workspace = self._get_workspace()
- context = self._get_context()
-
- if self.__can_build_incrementally() and workspace.last_successful:
-
- # 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)
- # Get a dict of dependency strong keys
- 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
- # incremental build, we must ensure that we update the mtimes
- # of any files created by our dependencies since the last
- # successful build.
- to_update = None
- if workspace and old_dep_keys:
- dep.__assert_cached()
-
- if dep.name in old_dep_keys:
- key_new = dep._get_cache_key()
- key_old = old_dep_keys[dep.name]
-
- # We only need to worry about modified and added
- # files, since removed files will be picked up by
- # build systems anyway.
- to_update, _, added = self.__artifacts.diff(dep, key_old, key_new)
- workspace.add_running_files(dep.name, to_update + added)
- to_update.extend(workspace.running_files[dep.name])
-
- # 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():
- context.get_workspaces().save_config()
-
- result = dep.stage_artifact(
- sandbox, path=path, include=include, exclude=exclude, orphans=orphans, update_mtimes=to_update
- )
+ result = dep.stage_artifact(sandbox, path=path, include=include, exclude=exclude, orphans=orphans)
if result.overwritten:
for overwrite in result.overwritten:
# Completely new overwrite
@@ -1590,7 +1540,6 @@ class Element(Plugin):
key = self._get_cache_key()
workspace = self._get_workspace()
workspace.last_successful = key
- workspace.clear_running_files()
self._get_context().get_workspaces().save_config()
# _assemble():
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index 5b3ec7b7c..e09dd220a 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -846,13 +846,10 @@ def test_list_unsupported_workspace(cli, datafiles, workspace_cfg):
[
# Test loading version 4
(
- {
- "format-version": 4,
- "workspaces": {"alpha.bst": {"prepared": True, "path": "/workspaces/bravo", "running_files": {}}},
- },
+ {"format-version": 4, "workspaces": {"alpha.bst": {"prepared": True, "path": "/workspaces/bravo"}},},
{
"format-version": BST_WORKSPACE_FORMAT_VERSION,
- "workspaces": {"alpha.bst": {"prepared": True, "path": "/workspaces/bravo", "running_files": {}}},
+ "workspaces": {"alpha.bst": {"prepared": True, "path": "/workspaces/bravo"}},
},
),
],