summaryrefslogtreecommitdiff
path: root/buildstream/element.py
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2018-10-11 11:18:15 +0100
committerJonathan Maw <jonathan.maw@codethink.co.uk>2018-10-30 15:42:05 +0000
commit825963b5cf7e6f2b116c0ed45300e52d178c691a (patch)
treeec35c792c2277737e101fb12abbcab81de65a995 /buildstream/element.py
parentec76cbe1b2c8fb73e3d3b402623715b56ade777f (diff)
downloadbuildstream-825963b5cf7e6f2b116c0ed45300e52d178c691a.tar.gz
element: Make "--sysroot" take a bare directory
i.e. instead of taking a directory that must contain "root" and "scratch", and treating "root" as the root, use the directory directly. In element.py: * __sandbox takes the `bare_sandbox` arg, to pass into the sandbox's constructor In sandbox.py: * If bare_sandbox, `_root` is the passed-in directory, and `__scratch` is None. * Trying to use `__scratch` when bare_sandbox is True is a bug. In _mount.py: * Don't get the value of `__scratch` if it's not needed. This is part of #539
Diffstat (limited to 'buildstream/element.py')
-rw-r--r--buildstream/element.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 83d7f9705..27c5014a3 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1318,7 +1318,9 @@ class Element(Plugin):
@contextmanager
def _prepare_sandbox(self, scope, directory, deps='run', integrate=True):
# bst shell and bst checkout require a local sandbox.
- with self.__sandbox(directory, config=self.__sandbox_config, allow_remote=False) as sandbox:
+ bare_directory = True if directory else False
+ with self.__sandbox(directory, config=self.__sandbox_config, allow_remote=False,
+ bare_directory=bare_directory) as sandbox:
# Configure always comes first, and we need it.
self.configure_sandbox(sandbox)
@@ -2156,12 +2158,14 @@ class Element(Plugin):
# stderr (fileobject): The stream for stderr for the sandbox
# config (SandboxConfig): The SandboxConfig object
# allow_remote (bool): Whether the sandbox is allowed to be remote
+ # bare_directory (bool): Whether the directory is bare i.e. doesn't have
+ # a separate 'root' subdir
#
# Yields:
# (Sandbox): A usable sandbox
#
@contextmanager
- def __sandbox(self, directory, stdout=None, stderr=None, config=None, allow_remote=True):
+ def __sandbox(self, directory, stdout=None, stderr=None, config=None, allow_remote=True, bare_directory=False):
context = self._get_context()
project = self._get_project()
platform = Platform.get_platform()
@@ -2192,6 +2196,7 @@ class Element(Plugin):
stdout=stdout,
stderr=stderr,
config=config,
+ bare_directory=bare_directory,
allow_real_directory=not self.BST_VIRTUAL_DIRECTORY)
yield sandbox
@@ -2201,7 +2206,7 @@ class Element(Plugin):
# Recursive contextmanager...
with self.__sandbox(rootdir, stdout=stdout, stderr=stderr, config=config,
- allow_remote=allow_remote) as sandbox:
+ allow_remote=allow_remote, bare_directory=False) as sandbox:
yield sandbox
# Cleanup the build dir