diff options
| author | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-06-04 10:57:54 +0100 |
|---|---|---|
| committer | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-06-15 16:42:15 +0100 |
| commit | a14f7fa76b88fb1d8c5c8f74b2173a96a5bd96d2 (patch) | |
| tree | 3e3a89481b8063c475c8e2d814cf8fbedecf742f | |
| parent | 049f3ff19e4ec6fb7111263eadc97a87cd8cf561 (diff) | |
| download | buildstream-a14f7fa76b88fb1d8c5c8f74b2173a96a5bd96d2.tar.gz | |
sandbox.py: Make get_directory return a CasBasedDirectory.
| -rw-r--r-- | buildstream/sandbox/sandbox.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/buildstream/sandbox/sandbox.py b/buildstream/sandbox/sandbox.py index 31d56312d..8cf5fb433 100644 --- a/buildstream/sandbox/sandbox.py +++ b/buildstream/sandbox/sandbox.py @@ -33,6 +33,7 @@ See also: :ref:`sandboxing`. import os from .._exceptions import ImplError, BstError from ..storage._filebaseddirectory import FileBasedDirectory +from ..storage._casbaseddirectory import CasBasedDirectory class SandboxFlags(): @@ -107,6 +108,7 @@ class Sandbox(): self.__scratch = os.path.join(self.__directory, 'scratch') for directory_ in [self._root, self.__scratch]: os.makedirs(directory_, exist_ok=True) + self.__vdir = None def get_directory(self): """Fetches the sandbox root directory @@ -135,8 +137,12 @@ class Sandbox(): (str): The sandbox root directory """ - # For now, just create a new Directory every time we're asked - return FileBasedDirectory(self._root) + if not self.__vdir: + if self.__allow_real_directory: + self.__vdir = FileBasedDirectory(self._root) + else: + self.__vdir = CasBasedDirectory(self.__context, ref=None) + return self.__vdir def get_virtual_toplevel_directory(self): """Fetches the sandbox's toplevel directory |
