summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-05-08 16:17:50 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-07-24 12:32:59 +0100
commit9aa7db211c7551f97728ca13527bd3c7496511a9 (patch)
tree4324d341ec0f20d63901c4342bad3440c7ecaa69
parent227bc2042b4c4edfd853a995ebca8967307e3e1a (diff)
downloadbuildstream-9aa7db211c7551f97728ca13527bd3c7496511a9.tar.gz
sandbox.py: Two functions to get virtual directories
Add get_virtual_directory and get_virtual_toplevel_directory().
-rw-r--r--buildstream/sandbox/sandbox.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/buildstream/sandbox/sandbox.py b/buildstream/sandbox/sandbox.py
index 90b80af2a..f3cab41ec 100644
--- a/buildstream/sandbox/sandbox.py
+++ b/buildstream/sandbox/sandbox.py
@@ -30,6 +30,7 @@ See also: :ref:`sandboxing`.
import os
from .._exceptions import ImplError, BstError
+from ..storage._filebaseddirectory import FileBasedDirectory
class SandboxFlags():
@@ -121,6 +122,33 @@ class Sandbox():
else:
raise BstError("You can't use get_directory")
+ def get_virtual_directory(self):
+ """Fetches the sandbox root directory
+
+ The root directory is where artifacts for the base
+ runtime environment should be staged. Only works if
+ BST_VIRTUAL_DIRECTORY is not set.
+
+ Returns:
+ (str): The sandbox root directory
+
+ """
+ # For now, just create a new Directory every time we're asked
+ return FileBasedDirectory(self._root)
+
+ def get_virtual_toplevel_directory(self):
+ """Fetches the sandbox's toplevel directory
+
+ The toplevel directory contains 'root', 'scratch' and later
+ 'artifact' where output is copied to.
+
+ Returns:
+ (str): The sandbox toplevel directory
+
+ """
+ # For now, just create a new Directory every time we're asked
+ return FileBasedDirectory(self.__directory)
+
def set_environment(self, environment):
"""Sets the environment variables for the sandbox