summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-06-04 10:19:55 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-08-15 15:33:05 +0100
commit88ccff6e811320e3e77510db5179c570e6ec0995 (patch)
treee183de4ec8398861e0eba0ef848f3e54696804b1
parent007624429f22972a9d2d2620cbbbad18411ff4c9 (diff)
downloadbuildstream-88ccff6e811320e3e77510db5179c570e6ec0995.tar.gz
Convert uses of external_directory to get_underlying_directory()
-rw-r--r--buildstream/sandbox/_mount.py6
-rw-r--r--buildstream/sandbox/_sandboxbwrap.py2
-rw-r--r--buildstream/storage/_filebaseddirectory.py5
3 files changed, 10 insertions, 3 deletions
diff --git a/buildstream/sandbox/_mount.py b/buildstream/sandbox/_mount.py
index 0f96a92b7..49068fe92 100644
--- a/buildstream/sandbox/_mount.py
+++ b/buildstream/sandbox/_mount.py
@@ -32,8 +32,10 @@ from .._fuse import SafeHardlinks
class Mount():
def __init__(self, sandbox, mount_point, safe_hardlinks):
scratch_directory = sandbox._get_scratch_directory()
- # Getting external_directory here is acceptable as we're part of the sandbox code.
- root_directory = sandbox.get_virtual_directory().external_directory
+ # Getting _get_underlying_directory() here is acceptable as
+ # we're part of the sandbox code. This will fail if our
+ # directory is CAS-based.
+ root_directory = sandbox.get_virtual_directory()._get_underlying_directory()
self.mount_point = mount_point
self.safe_hardlinks = safe_hardlinks
diff --git a/buildstream/sandbox/_sandboxbwrap.py b/buildstream/sandbox/_sandboxbwrap.py
index 3ef3d4cb9..efec3748d 100644
--- a/buildstream/sandbox/_sandboxbwrap.py
+++ b/buildstream/sandbox/_sandboxbwrap.py
@@ -58,7 +58,7 @@ class SandboxBwrap(Sandbox):
stdout, stderr = self._get_output()
# Allowable access to underlying storage as we're part of the sandbox
- root_directory = self.get_virtual_directory().external_directory
+ root_directory = self.get_virtual_directory()._get_underlying_directory()
# Fallback to the sandbox default settings for
# the cwd and env.
diff --git a/buildstream/storage/_filebaseddirectory.py b/buildstream/storage/_filebaseddirectory.py
index 5b3da28f4..8f88adc84 100644
--- a/buildstream/storage/_filebaseddirectory.py
+++ b/buildstream/storage/_filebaseddirectory.py
@@ -214,3 +214,8 @@ class FileBasedDirectory(Directory):
# which exposes the sandbox directory; we will have to assume for the time being
# that people will not abuse __str__.
return self.external_directory
+
+ def _get_underlying_directory(self) -> str:
+ """ Returns the underlying (real) file system directory this
+ object refers to. """
+ return self.external_directory