diff options
author | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-05-25 15:14:44 +0100 |
---|---|---|
committer | Jim MacArthur <jim@mode7.co.uk> | 2018-05-28 11:31:59 +0100 |
commit | 01b1196fe6189e3e134e0d31047248d54b7b8bf8 (patch) | |
tree | 20a6e86e9f05900c88de3e19e5bd94407a2700bc | |
parent | 17d6ea75f1952e89c27cabc13816a78909adab68 (diff) | |
download | buildstream-01b1196fe6189e3e134e0d31047248d54b7b8bf8.tar.gz |
Temporary unique names for all sandboxes
-rw-r--r-- | buildstream/sandbox/sandbox.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/buildstream/sandbox/sandbox.py b/buildstream/sandbox/sandbox.py index c60a88e94..617914fcd 100644 --- a/buildstream/sandbox/sandbox.py +++ b/buildstream/sandbox/sandbox.py @@ -34,7 +34,7 @@ import os from .._exceptions import ImplError, BstError from ..storage._filebaseddirectory import FileBasedDirectory from ..storage._casbaseddirectory import CasBasedDirectory - +import tempfile class SandboxFlags(): """Flags indicating how the sandbox should be run. @@ -108,6 +108,8 @@ 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 + self.sandboxname=tempfile.NamedTemporaryFile() def get_directory(self): """Fetches the sandbox root directory @@ -136,8 +138,8 @@ class Sandbox(): (str): The sandbox root directory """ - # For now, just create a new Directory every time we're asked - return CasBasedDirectory(self.__context, ref=None, name="sandbox") + savename = self.sandboxname.name.replace(os.path.sep, "") + return CasBasedDirectory(self.__context, ref=None, savename=savename) def get_virtual_toplevel_directory(self): """Fetches the sandbox's toplevel directory |