From 88ccff6e811320e3e77510db5179c570e6ec0995 Mon Sep 17 00:00:00 2001 From: Jim MacArthur Date: Mon, 4 Jun 2018 10:19:55 +0100 Subject: Convert uses of external_directory to get_underlying_directory() --- buildstream/sandbox/_mount.py | 6 ++++-- buildstream/sandbox/_sandboxbwrap.py | 2 +- buildstream/storage/_filebaseddirectory.py | 5 +++++ 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 -- cgit v1.2.1