summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Pollard <tom.pollard@codethink.co.uk>2019-10-02 14:09:44 +0100
committerTom Pollard <tom.pollard@codethink.co.uk>2019-10-02 15:40:19 +0100
commitbeb8dc7397378bab726e405531e816c99c500996 (patch)
tree016e65f54da29ab14f51f1e1ebdc4140bf19e709
parenta58996467542be85ffc1200729bac1b2211b4d41 (diff)
downloadbuildstream-beb8dc7397378bab726e405531e816c99c500996.tar.gz
Failed shell to load via name if no plugintable state
-rw-r--r--src/buildstream/_frontend/app.py2
-rw-r--r--src/buildstream/_stream.py11
2 files changed, 10 insertions, 3 deletions
diff --git a/src/buildstream/_frontend/app.py b/src/buildstream/_frontend/app.py
index 45160afbc..4fd632d41 100644
--- a/src/buildstream/_frontend/app.py
+++ b/src/buildstream/_frontend/app.py
@@ -643,7 +643,7 @@ class App():
unique_id, element_key = element
prompt = self.shell_prompt(full_name, element_key)
self.stream.shell(None, Scope.BUILD, prompt, isolate=True,
- usebuildtree='always', unique_id=unique_id)
+ usebuildtree='always', unique_id=unique_id, full_name=full_name)
except BstError as e:
click.echo("Error while attempting to create interactive shell: {}".format(e), err=True)
elif choice == 'log':
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 839636cd8..74f7755e0 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -230,6 +230,7 @@ class Stream():
# usebuildtree (str): Whether to use a buildtree as the source, given cli option
# pull_dependencies ([Element]|None): Elements to attempt to pull
# unique_id: (str): Whether to use a unique_id to load an Element instance
+ # full_name: (str): The elements full name, used if unique_id lookup fails
#
# Returns:
# (int): The exit code of the launched shell
@@ -241,11 +242,17 @@ class Stream():
command=None,
usebuildtree=None,
pull_dependencies=None,
- unique_id=None):
+ unique_id=None,
+ full_name=None):
# Load the Element via the unique_id if given
if unique_id and element is None:
- element = Plugin._lookup(unique_id)
+ try:
+ element = Plugin._lookup(unique_id)
+ except AssertionError:
+ # Could not be loaded from plugintable, load forcefully
+ element_list = self.load_selection([full_name], selection=PipelineSelection.NONE)
+ element = element_list[0]
# Assert we have everything we need built, unless the directory is specified
# in which case we just blindly trust the directory, using the element