summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarius Makovsky <traveltissues@protonmail.com>2019-08-19 13:20:38 +0100
committerDarius Makovsky <traveltissues@protonmail.com>2019-09-12 15:35:17 +0100
commit24b88db146abd454df33a27ec41e17e6c8561a3c (patch)
treee67c37a0b4ebaa64df94c1e2ab598af45484f36c
parent093d7a5bb101460edd32de11daa21d65252a8d85 (diff)
downloadbuildstream-24b88db146abd454df33a27ec41e17e6c8561a3c.tar.gz
Remove workspace mounting for sandboxes
-rw-r--r--src/buildstream/_loader/loader.py2
-rw-r--r--src/buildstream/_stream.py2
-rw-r--r--src/buildstream/element.py45
-rw-r--r--src/buildstream/plugins/elements/import.py2
4 files changed, 11 insertions, 40 deletions
diff --git a/src/buildstream/_loader/loader.py b/src/buildstream/_loader/loader.py
index 5599c8b71..eb4b051f6 100644
--- a/src/buildstream/_loader/loader.py
+++ b/src/buildstream/_loader/loader.py
@@ -620,7 +620,7 @@ class Loader():
filename, element._get_cache_key())
if not os.path.exists(basedir):
os.makedirs(basedir, exist_ok=True)
- element._stage_sources_at(basedir, mount_workspaces=False)
+ element._stage_sources_at(basedir)
# Load the project
project_dir = os.path.join(basedir, element.path)
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 293ba051d..0d308bfba 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -1510,7 +1510,7 @@ class Stream():
element_source_dir = self._get_element_dirname(directory, element)
if list(element.sources()):
os.makedirs(element_source_dir)
- element._stage_sources_at(element_source_dir, mount_workspaces=False)
+ element._stage_sources_at(element_source_dir)
# Create a tarball from the content of directory
def _create_tarball(self, directory, tar_name):
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 2efdd3abb..97bff2a16 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1432,21 +1432,18 @@ class Element(Plugin):
# Args:
# sandbox (:class:`.Sandbox`): The build sandbox
# directory (str): An absolute path to stage the sources at
- # mount_workspaces (bool): mount workspaces if True, copy otherwise
#
- def _stage_sources_in_sandbox(self, sandbox, directory, mount_workspaces=True):
+ def _stage_sources_in_sandbox(self, sandbox, directory):
# Only artifact caches that implement diff() are allowed to
# perform incremental builds.
- if mount_workspaces and self.__can_build_incrementally():
- workspace = self._get_workspace()
+ if self.__can_build_incrementally():
sandbox.mark_directory(directory)
- sandbox._set_mount_source(directory, workspace.get_absolute_path())
# Stage all sources that need to be copied
sandbox_vroot = sandbox.get_virtual_directory()
host_vdirectory = sandbox_vroot.descend(*directory.lstrip(os.sep).split(os.sep), create=True)
- self._stage_sources_at(host_vdirectory, mount_workspaces=mount_workspaces, usebuildtree=sandbox._usebuildtree)
+ self._stage_sources_at(host_vdirectory, usebuildtree=sandbox._usebuildtree)
# _stage_sources_at():
#
@@ -1454,10 +1451,9 @@ class Element(Plugin):
#
# Args:
# vdirectory (:class:`.storage.Directory`): A virtual directory object to stage sources into.
- # mount_workspaces (bool): mount workspaces if True, copy otherwise
# usebuildtree (bool): use a the elements build tree as its source.
#
- def _stage_sources_at(self, vdirectory, mount_workspaces=True, usebuildtree=False):
+ def _stage_sources_at(self, vdirectory, usebuildtree=False):
context = self._get_context()
@@ -1473,24 +1469,16 @@ class Element(Plugin):
if not vdirectory.is_empty():
raise ElementError("Staging directory '{}' is not empty".format(vdirectory))
- workspace = self._get_workspace()
- if workspace:
- # If mount_workspaces is set and we're doing incremental builds,
- # the workspace is already mounted into the sandbox.
- if not (mount_workspaces and self.__can_build_incrementally()):
- with self.timed_activity("Staging local files at {}"
- .format(workspace.get_absolute_path())):
- workspace.stage(import_dir)
-
# Check if we have a cached buildtree to use
- elif usebuildtree:
+ if usebuildtree:
import_dir = self.__artifact.get_buildtree()
if import_dir.is_empty():
detail = "Element type either does not expect a buildtree or it was explictily cached without one."
self.warn("WARNING: {} Artifact contains an empty buildtree".format(self.name), detail=detail)
- # No workspace or cached buildtree, stage source from source cache
+ # No cached buildtree, stage source from source cache
else:
+
# Assert sources are cached
assert self._source_cached()
@@ -1505,6 +1493,7 @@ class Element(Plugin):
for source in self.__sources[last_required_previous_ix:]:
source_dir = sourcecache.export(source)
import_dir.import_files(source_dir)
+
except SourceCacheError as e:
raise ElementError("Error trying to export source for {}: {}"
.format(self.name, e))
@@ -1716,24 +1705,6 @@ class Element(Plugin):
# Shelling into a sandbox is useful to debug this error
e.sandbox = True
- # If there is a workspace open on this element, it will have
- # been mounted for sandbox invocations instead of being staged.
- #
- # In order to preserve the correct failure state, we need to
- # copy over the workspace files into the appropriate directory
- # in the sandbox.
- #
- workspace = self._get_workspace()
- if workspace and self.__staged_sources_directory:
- sandbox_vroot = sandbox.get_virtual_directory()
- path_components = self.__staged_sources_directory.lstrip(os.sep).split(os.sep)
- sandbox_vpath = sandbox_vroot.descend(*path_components)
- try:
- sandbox_vpath.import_files(workspace.get_absolute_path())
- except UtilError as e2:
- self.warn("Failed to preserve workspace state for failed build sysroot: {}"
- .format(e2))
-
self.__set_build_result(success=False, description=str(e), detail=e.detail)
self._cache_artifact(rootdir, sandbox, e.collect)
diff --git a/src/buildstream/plugins/elements/import.py b/src/buildstream/plugins/elements/import.py
index 6ae8cef46..3a15aa7d3 100644
--- a/src/buildstream/plugins/elements/import.py
+++ b/src/buildstream/plugins/elements/import.py
@@ -75,7 +75,7 @@ class ImportElement(Element):
# Stage sources into the input directory
# Do not mount workspaces as the files are copied from outside the sandbox
- self._stage_sources_in_sandbox(sandbox, 'input', mount_workspaces=False)
+ self._stage_sources_in_sandbox(sandbox, 'input')
rootdir = sandbox.get_virtual_directory()
inputdir = rootdir.descend('input')