summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Salmon <will.salmon@codethink.co.uk>2020-07-03 16:50:18 +0100
committerWilliam Salmon <pointswaves@gmail.com>2020-07-05 12:23:58 +0100
commitef44916b4339a26ff3fb54c04b70f00c36a47dc1 (patch)
tree67022ac1ba1840e79cd12fa53dbd481ca84969c9
parent94dcc28121a57f5e292ce653ef4b760a7ad3b6a4 (diff)
downloadbuildstream-willsalmon/checkout_no_sandbox.tar.gz
Do not use a sandbox when not required for checkoutwillsalmon/checkout_no_sandbox
-rw-r--r--src/buildstream/_stream.py14
-rw-r--r--src/buildstream/buildelement.py2
-rw-r--r--src/buildstream/element.py9
3 files changed, 16 insertions, 9 deletions
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 3d646a756..95832bbc1 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -55,6 +55,7 @@ from .types import _KeyStrength, _PipelineSelection, _SchedulerErrorAction
from .plugin import Plugin
from . import utils, _yaml, _site
from . import Scope
+from .storage._casbaseddirectory import CasBasedDirectory
# Stream()
@@ -553,9 +554,16 @@ class Stream:
_PipelineSelection.NONE: Scope.NONE,
_PipelineSelection.ALL: Scope.ALL,
}
- with target._prepare_sandbox(scope=scope[selection], integrate=integrate) as sandbox:
- # Copy or move the sandbox to the target directory
- virdir = sandbox.get_virtual_directory()
+ if integrate:
+ with target._prepare_sandbox(scope=scope[selection], integrate=integrate) as sandbox:
+ # Copy or move the sandbox to the target directory
+ virdir = sandbox.get_virtual_directory()
+ self._export_artifact(tar, location, compression, target, hardlinks, virdir)
+ else:
+ # This allows for checking out elements when they were build with a non local sandbox
+ virdir = CasBasedDirectory(target._get_context().get_cascache())
+ with target.timed_activity("Staging dependencies", silent_nested=True):
+ target.stage_dependency_artifacts(virdir, scope[selection])
self._export_artifact(tar, location, compression, target, hardlinks, virdir)
except BstError as e:
raise StreamError(
diff --git a/src/buildstream/buildelement.py b/src/buildstream/buildelement.py
index aa427064b..cec807264 100644
--- a/src/buildstream/buildelement.py
+++ b/src/buildstream/buildelement.py
@@ -222,7 +222,7 @@ class BuildElement(Element):
# Stage deps in the sandbox root
with self.timed_activity("Staging dependencies", silent_nested=True):
- self.stage_dependency_artifacts(sandbox, Scope.BUILD)
+ self.stage_dependency_artifacts(sandbox.get_virtual_directory(), Scope.BUILD)
# Run any integration commands provided by the dependencies
# once they are all staged and ready
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 6a0fa5fab..a87ff73fd 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -609,7 +609,7 @@ class Element(Plugin):
def stage_artifact(
self,
- sandbox: "Sandbox",
+ vbasedir: "Directory",
*,
path: str = None,
include: Optional[List[str]] = None,
@@ -668,7 +668,6 @@ class Element(Plugin):
# Hard link it into the staging area
#
- vbasedir = sandbox.get_virtual_directory()
vstagedir = vbasedir if path is None else vbasedir.descend(*path.lstrip(os.sep).split(os.sep), create=True)
split_filter = self.__split_filter_func(include, exclude, orphans)
@@ -681,7 +680,7 @@ class Element(Plugin):
def stage_dependency_artifacts(
self,
- sandbox: "Sandbox",
+ vbasedir: "Directory",
scope: Scope,
*,
path: str = None,
@@ -714,7 +713,7 @@ class Element(Plugin):
files_written = {} # type: Dict[str, List[str]]
for dep in self.dependencies(scope):
- result = dep.stage_artifact(sandbox, path=path, include=include, exclude=exclude, orphans=orphans)
+ result = dep.stage_artifact(vbasedir, path=path, include=include, exclude=exclude, orphans=orphans)
if result.overwritten:
for overwrite in result.overwritten:
# Completely new overwrite
@@ -1286,7 +1285,7 @@ class Element(Plugin):
else:
# Stage deps in the sandbox root
with self.timed_activity("Staging dependencies", silent_nested=True):
- self.stage_dependency_artifacts(sandbox, scope)
+ self.stage_dependency_artifacts(sandbox.get_virtual_directory(), scope)
# Run any integration commands provided by the dependencies
# once they are all staged and ready