summaryrefslogtreecommitdiff
path: root/src/buildstream/_frontend
diff options
context:
space:
mode:
authorTom Pollard <tom.pollard@codethink.co.uk>2019-06-11 10:47:37 +0100
committerTom Pollard <tom.pollard@codethink.co.uk>2019-06-19 13:33:44 +0100
commita02cf9c14022b49d26bde7cf73369e11158d3d6b (patch)
tree66aa97003eb14de9c75577620bb0750b1aea3e65 /src/buildstream/_frontend
parent9d593e1f3449dc8f24fb6855264f78882b182e3c (diff)
downloadbuildstream-a02cf9c14022b49d26bde7cf73369e11158d3d6b.tar.gz
_frontend/cli.py: Tweak 'try' & 'always' bst shell buildtree handling
If the cached Artifact wasn't originally generated with a buildtree, then there's no need to attempt to find it in remotes by entering Stream(). In interactive mode we only present the user the option to attempt the pull with the above assumption on buildtree_exists, so apply the same to applicable non interactive choices. This also includes some tweaks in integration/shellbuildtrees.py to reflect changes and cover cases that were missing.
Diffstat (limited to 'src/buildstream/_frontend')
-rw-r--r--src/buildstream/_frontend/cli.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/buildstream/_frontend/cli.py b/src/buildstream/_frontend/cli.py
index cc8cd5e54..2301fcb78 100644
--- a/src/buildstream/_frontend/cli.py
+++ b/src/buildstream/_frontend/cli.py
@@ -559,11 +559,20 @@ def shell(app, element, sysroot, mount, isolate, build_, cli_buildtree, command)
cached = element._cached_buildtree()
buildtree_exists = element._buildtree_exists()
+
if cli_buildtree in ("always", "try"):
- use_buildtree = cli_buildtree
- if not cached and buildtree_exists and use_buildtree == "always":
- click.echo("WARNING: buildtree is not cached locally, will attempt to pull from available remotes",
- err=True)
+ if buildtree_exists:
+ use_buildtree = cli_buildtree
+ if not cached and use_buildtree == "always":
+ click.echo("WARNING: buildtree is not cached locally, will attempt to pull from available remotes",
+ err=True)
+ else:
+ if cli_buildtree == "always":
+ # Exit early if it won't be possible to even fetch a buildtree with always option
+ raise AppError("Artifact was created without buildtree, unable to launch shell with it")
+ else:
+ click.echo("WARNING: Artifact created without buildtree, shell will be loaded without it",
+ err=True)
else:
# If the value has defaulted to ask and in non interactive mode, don't consider the buildtree, this
# being the default behaviour of the command