diff options
author | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-06-29 12:13:41 +0100 |
---|---|---|
committer | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-06-29 12:13:41 +0100 |
commit | 8e9f459d32b007521e110486adac83bbccd3c260 (patch) | |
tree | 34a9defe11273109b681a9813bb02b10fb25b3c2 | |
parent | 9d3ccc84b65f7169eb8c182614e3c5f8758e9bfa (diff) | |
download | buildstream-8e9f459d32b007521e110486adac83bbccd3c260.tar.gz |
sandbox.py: Add set_output_directory to sandboxes and set it
-rw-r--r-- | buildstream/buildelement.py | 3 | ||||
-rw-r--r-- | buildstream/sandbox/sandbox.py | 15 |
2 files changed, 16 insertions, 2 deletions
diff --git a/buildstream/buildelement.py b/buildstream/buildelement.py index 5f9a856d1..82bbf983c 100644 --- a/buildstream/buildelement.py +++ b/buildstream/buildelement.py @@ -155,6 +155,9 @@ class BuildElement(Element): command_dir = build_root sandbox.set_work_directory(command_dir) + # Tell sandbox which directory is preserved in the finished artifact + sandbox.set_output_directory(install_root) + # Setup environment sandbox.set_environment(self.get_environment()) diff --git a/buildstream/sandbox/sandbox.py b/buildstream/sandbox/sandbox.py index b86feef39..a4db511b5 100644 --- a/buildstream/sandbox/sandbox.py +++ b/buildstream/sandbox/sandbox.py @@ -101,9 +101,11 @@ class Sandbox(): self.__stdout = kwargs['stdout'] self.__stderr = kwargs['stderr'] - # Setup the directories. Root should be available to subclasses, hence - # being single-underscore. The others are private to this class. + # Setup the directories. Root and output_directory should be + # available to subclasses, hence being single-underscore. The + # others are private to this class. self._root = os.path.join(directory, 'root') + self._output_directory = None self.__directory = directory self.__scratch = os.path.join(self.__directory, 'scratch') for directory_ in [self._root, self.__scratch]: @@ -175,6 +177,15 @@ class Sandbox(): """ self.__cwd = directory + def set_output_directory(self, directory): + """Sets the output directory - the directory which is preserved + as an artifact after assembly. + + Args: + directory (str): An absolute path within the sandbox + """ + self._output_directory = directory + def mark_directory(self, directory, *, artifact=False): """Marks a sandbox directory and ensures it will exist |