diff options
author | James Ennis <james.ennis@codethink.co.uk> | 2019-08-28 12:37:22 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-09-05 12:14:53 +0000 |
commit | d9e1055d0946a34f9903369522881c8b53f49671 (patch) | |
tree | 343c83727f9198c6e190158aa52eb03b56e71d01 /src/buildstream/_artifactelement.py | |
parent | 6d01f42ec4d05a06a90ceb1113128c6c686ae663 (diff) | |
download | buildstream-d9e1055d0946a34f9903369522881c8b53f49671.tar.gz |
_stream.py: Remove separate handling of ArtifactElements
ArtifactElement inherits Element, both have an Artifact
object as a member, thus we should not need to handle these
separately.
This change has resulted in introducing a configure_sandbox()
method in ArtifactElement. The method is similar to
BuildElement.configure_sandbox() but does not configure the
sandbox to actually be used for building.
Diffstat (limited to 'src/buildstream/_artifactelement.py')
-rw-r--r-- | src/buildstream/_artifactelement.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/buildstream/_artifactelement.py b/src/buildstream/_artifactelement.py index e3bffaf72..48c3d1769 100644 --- a/src/buildstream/_artifactelement.py +++ b/src/buildstream/_artifactelement.py @@ -42,6 +42,10 @@ class ArtifactElement(Element): # A hash of ArtifactElement by ref __instantiated_artifacts = {} # type: Dict[str, ArtifactElement] + # ArtifactElement's require this as the sandbox will use a normal + # directory when we checkout + BST_VIRTUAL_DIRECTORY = True + def __init__(self, context, ref): _, element, key = verify_artifact_ref(ref) @@ -126,6 +130,22 @@ class ArtifactElement(Element): artifact = self._get_artifact() return artifact.get_dependency_refs(deps=scope) + # configure_sandbox() + # + # Configure a sandbox for installing artifacts into + # + # Args: + # sandbox (Sandbox) + # + def configure_sandbox(self, sandbox): + install_root = self.get_variable('install-root') + + # Tell the sandbox to mount the build root and install root + sandbox.mark_directory(install_root) + + # Tell sandbox which directory is preserved in the finished artifact + sandbox.set_output_directory(install_root) + # Override Element._calculate_cache_key def _calculate_cache_key(self, dependencies=None): return self._key |