nathanwilliams-ct commented on code in PR #2147:
URL: https://github.com/apache/buildstream/pull/2147#discussion_r3903235596
##########
src/buildstream/element.py:
##########
@@ -2076,6 +2091,17 @@ def _shell(self, scope=None, *, mounts=None,
isolate=False, prompt=None, command
if prompt is not None:
environment["PS1"] = prompt
+ with self.timed_activity("Staging other_targets",
silent_nested=True), self.__collect_overlaps(sandbox):
+ self.stage_dependency_artifacts(sandbox, other_elements)
+
+ if other_elements:
+ # Stage artifacts from other_elements into the sandbox.
+ for element in other_elements:
+ # Stage deps in the sandbox root
+ with element.timed_activity("Integrating sandbox"),
sandbox.batch():
+ for dep in element._dependencies(_Scope.RUN):
+ dep.integrate(sandbox)
Review Comment:
Temporary stack element for runtime shell would be possible I did try it
out, but because build shells don't work with that approach and with the aim to
keep maintenance cost down: I didn't want two separate implementations if we
can help it.
I tried a few ways to inject dependencies in-memory, but part the problem I
found was a lot of dependency loading and resolving work is done at the early
stages immediately after loading the yaml and parsing, where it's basically
impossible to inject the dependencies in a sensible way. Doing it at a later
stage e.g. in the Stream.shell or the Element.execute_shell method and or
trying to add a inject_extra_deps method to the Element class, I couldn't get
it to work. Partly due to the complexity of the shell construction, especially
where it involves the cached buildtrees being used which means the whole shell
construction process is skipped. The lack of type hints to actually understand
the control flow also doesn’t
help(https://github.com/apache/buildstream/pull/2167).
I will have a play with adjusting the tempfile approach to hide it a bit
better like you suggest.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]