diff options
Diffstat (limited to 'src/buildstream/_stream.py')
-rw-r--r-- | src/buildstream/_stream.py | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index 0567b3ceb..ca8ca7863 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -29,7 +29,6 @@ import tempfile from contextlib import contextmanager, suppress from fnmatch import fnmatch -from ._artifact import Artifact from ._artifactelement import verify_artifact_ref, ArtifactElement from ._exceptions import StreamError, ImplError, BstError, ArtifactElementError, ArtifactError from ._message import Message, MessageType @@ -559,26 +558,15 @@ class Stream(): self._context.disable_fork() - # Stage deps into a temporary sandbox first - if isinstance(target, ArtifactElement): - try: - key = target._get_cache_key() - artifact = Artifact(target, self._context, strong_key=key) - virdir = artifact.get_files() + try: + with target._prepare_sandbox(scope=scope, directory=None, + integrate=integrate) as sandbox: + # Copy or move the sandbox to the target directory + virdir = sandbox.get_virtual_directory() self._export_artifact(tar, location, compression, target, hardlinks, virdir) - except AttributeError as e: - raise ArtifactError("Artifact reference '{}' seems to be invalid. " - "Note that an Element name can also be used.".format(artifact))from e - else: - try: - with target._prepare_sandbox(scope=scope, directory=None, - integrate=integrate) as sandbox: - # Copy or move the sandbox to the target directory - virdir = sandbox.get_virtual_directory() - self._export_artifact(tar, location, compression, target, hardlinks, virdir) - except BstError as e: - raise StreamError("Error while staging dependencies into a sandbox" - ": '{}'".format(e), detail=e.detail, reason=e.reason) from e + except BstError as e: + raise StreamError("Error while staging dependencies into a sandbox" + ": '{}'".format(e), detail=e.detail, reason=e.reason) from e def _export_artifact(self, tar, location, compression, target, hardlinks, virdir): if not tar: |