summaryrefslogtreecommitdiff
path: root/buildstream/sandbox/sandbox.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/sandbox/sandbox.py')
-rw-r--r--buildstream/sandbox/sandbox.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/buildstream/sandbox/sandbox.py b/buildstream/sandbox/sandbox.py
index 83714efdd..eabe57d75 100644
--- a/buildstream/sandbox/sandbox.py
+++ b/buildstream/sandbox/sandbox.py
@@ -98,16 +98,23 @@ class Sandbox():
self.__config = kwargs['config']
self.__stdout = kwargs['stdout']
self.__stderr = kwargs['stderr']
+ self.__bare_directory = kwargs['bare_directory']
# Setup the directories. Root and output_directory should be
# available to subclasses, hence being single-underscore. The
# others are private to this class.
- self._root = os.path.join(directory, 'root')
+ # If the directory is bare, it probably doesn't need scratch
+ if self.__bare_directory:
+ self._root = directory
+ self.__scratch = None
+ os.makedirs(self._root, exist_ok=True)
+ else:
+ self._root = os.path.join(directory, 'root')
+ self.__scratch = os.path.join(directory, 'scratch')
+ for directory_ in [self._root, self.__scratch]:
+ os.makedirs(directory_, exist_ok=True)
+
self._output_directory = None
- self.__directory = directory
- self.__scratch = os.path.join(self.__directory, 'scratch')
- for directory_ in [self._root, self.__scratch]:
- os.makedirs(directory_, exist_ok=True)
self._vdir = None
# This is set if anyone requests access to the underlying
@@ -334,6 +341,7 @@ class Sandbox():
# Returns:
# (str): The sandbox scratch directory
def _get_scratch_directory(self):
+ assert not self.__bare_directory, "Scratch is not going to work with bare directories"
return self.__scratch
# _get_output()