summaryrefslogtreecommitdiff
path: root/src/buildstream/element.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildstream/element.py')
-rw-r--r--src/buildstream/element.py47
1 files changed, 9 insertions, 38 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 0ad2da17f..4ebb17d09 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -92,7 +92,7 @@ from ._variables import Variables
from ._versions import BST_CORE_ARTIFACT_VERSION
from ._exceptions import BstError, LoadError, LoadErrorReason, ImplError, \
ErrorDomain, SourceCacheError
-from .utils import FileListResult, UtilError
+from .utils import FileListResult
from . import utils
from . import _cachekey
from . import _signals
@@ -1449,21 +1449,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():
#
@@ -1471,10 +1468,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()
@@ -1490,24 +1486,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()
@@ -1522,6 +1510,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))
@@ -1733,24 +1722,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)