You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:03:57 UTC
[buildstream] branch issue-413-Add_sources_to_bst_shell created
(now 825f4a0)
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a change to branch issue-413-Add_sources_to_bst_shell
in repository https://gitbox.apache.org/repos/asf/buildstream.git.
at 825f4a0 Element.py: Added stage_sources function to stage the sources in a shell sandbox
This branch includes the following new commits:
new 825f4a0 Element.py: Added stage_sources function to stage the sources in a shell sandbox
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[buildstream] 01/01: Element.py: Added stage_sources function to
stage the sources in a shell sandbox
Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch issue-413-Add_sources_to_bst_shell
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 825f4a013392862b629a873d703e838da539d071
Author: Phillip Smyth <ph...@Nexus-x240.dyn.ducie.codethink.co.uk>
AuthorDate: Wed Jun 6 12:19:42 2018 +0100
Element.py: Added stage_sources function to stage the sources in a shell sandbox
---
buildstream/_stream.py | 7 ++++++-
buildstream/element.py | 15 +++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index 0680f2a..e4455fe 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -150,7 +150,12 @@ class Stream():
raise StreamError("Elements need to be built or downloaded before staging a shell environment",
detail="\n".join(missing_deps))
- return element._shell(scope, directory, mounts=mounts, isolate=isolate, prompt=prompt, command=command)
+ with element._prepare_sandbox(scope, directory) as sandbox:
+ for dep in self._pipeline.dependencies([element], scope):
+ dep.stage_sources(sandbox, dep.get_variable('build-root'))
+
+ return element._shell(scope, directory, mounts=mounts, isolate=isolate,
+ prompt=prompt, command=command, sandbox=sandbox)
# build()
#
diff --git a/buildstream/element.py b/buildstream/element.py
index e876eb1..e181529 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -78,7 +78,7 @@ import re
import stat
import copy
from collections import Mapping, OrderedDict
-from contextlib import contextmanager
+from contextlib import contextmanager, ExitStack
from enum import Enum
import tempfile
import time
@@ -1243,7 +1243,7 @@ class Element(Plugin):
# is used to stage things by the `bst checkout` codepath
#
@contextmanager
- def _prepare_sandbox(self, scope, directory, integrate=True):
+ def _prepare_sandbox(self, scope, directory, integrate=True, dep=False):
with self.__sandbox(directory, config=self.__sandbox_config) as sandbox:
@@ -1263,8 +1263,8 @@ class Element(Plugin):
# once they are all staged and ready
if integrate:
with self.timed_activity("Integrating sandbox"):
- for dep in self.dependencies(scope):
- dep.integrate(sandbox)
+ for depend in self.dependencies(scope):
+ depend.integrate(sandbox)
yield sandbox
@@ -1677,9 +1677,12 @@ class Element(Plugin):
# Returns: Exit code
#
# If directory is not specified, one will be staged using scope
- def _shell(self, scope=None, directory=None, *, mounts=None, isolate=False, prompt=None, command=None):
+ def _shell(self, scope=None, directory=None, *, mounts=None, isolate=False,
+ prompt=None, command=None, sandbox=None):
- with self._prepare_sandbox(scope, directory) as sandbox:
+ with ExitStack() as stack:
+ if sandbox is None:
+ sandbox = stack.enter_context(self._prepare_sandbox(scope, directory))
environment = self.get_environment()
environment = copy.copy(environment)
flags = SandboxFlags.INTERACTIVE | SandboxFlags.ROOT_READ_ONLY