diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2018-12-19 17:48:08 +0000 |
---|---|---|
committer | Angelos Evripiotis <angelos.evripiotis@gmail.com> | 2018-12-20 13:59:23 +0000 |
commit | 46efc91dc3c37324903e62648dd1f0dc3b661af1 (patch) | |
tree | 2b83c60b36bc5c545a5e01d0b8f3b69568cbcbc0 | |
parent | 7368f569e1fcb0dc8b765e43c811ac314ca5bfbd (diff) | |
download | buildstream-46efc91dc3c37324903e62648dd1f0dc3b661af1.tar.gz |
BREAK: remove auto-init behaviour
In the event that the project could not be found, stop BuildStream from
asking if the user would like to create a new project. Exit with error
instead, and give a hint to the user in case they're new.
As proposed on the mailing list here:
https://mail.gnome.org/archives/buildstream-list/2018-December/msg00082.html
The new interaction looks like this:
$ bst show nonsuch.bst
No project found. You can create a new project like so:
bst init
Error loading project: None of ['project.conf', '.bstproject.yaml']
found in '/src/temp/blah' or any of its parent directories
Fixes #826
-rw-r--r-- | NEWS | 10 | ||||
-rw-r--r-- | buildstream/_context.py | 8 | ||||
-rw-r--r-- | buildstream/_frontend/app.py | 14 | ||||
-rw-r--r-- | buildstream/data/userconfig.yaml | 8 |
4 files changed, 16 insertions, 24 deletions
@@ -30,6 +30,12 @@ buildstream 1.3.1 make changes to their .bst files if they are expecting these environment variables to be set. + o BREAKING CHANGE: The 'auto-init' functionality has been removed. This would + offer to create a project in the event that bst was run against a directory + without a project, to be friendly to new users. It has been replaced with + an error message and a hint instead, to avoid bothering folks that just + made a mistake. + o Failed builds are included in the cache as well. `bst checkout` will provide anything in `%{install-root}`. A build including cached fails will cause any dependant elements @@ -67,8 +73,8 @@ buildstream 1.3.1 instead of just a specially-formatted build-root with a `root` and `scratch` subdirectory. - o The buildstream.conf file learned new 'prompt.auto-init', - 'prompt.really-workspace-close-remove-dir', and + o The buildstream.conf file learned new + 'prompt.really-workspace-close-remove-dir' and 'prompt.really-workspace-reset-hard' options. These allow users to suppress certain confirmation prompts, e.g. double-checking that the user meant to run the command as typed. diff --git a/buildstream/_context.py b/buildstream/_context.py index a3487a794..e0eea99ff 100644 --- a/buildstream/_context.py +++ b/buildstream/_context.py @@ -117,10 +117,6 @@ class Context(): # Whether or not to attempt to pull build trees globally self.pull_buildtrees = None - # Boolean, whether to offer to create a project for the user, if we are - # invoked outside of a directory where we can resolve the project. - self.prompt_auto_init = None - # Boolean, whether we double-check with the user that they meant to # remove a workspace directory. self.prompt_workspace_close_remove_dir = None @@ -258,12 +254,10 @@ class Context(): prompt = _yaml.node_get( defaults, Mapping, 'prompt') _yaml.node_validate(prompt, [ - 'auto-init', 'really-workspace-close-remove-dir', + 'really-workspace-close-remove-dir', 'really-workspace-close-project-inaccessible', 'really-workspace-reset-hard', ]) - self.prompt_auto_init = _node_get_option_str( - prompt, 'auto-init', ['ask', 'no']) == 'ask' self.prompt_workspace_close_remove_dir = _node_get_option_str( prompt, 'really-workspace-close-remove-dir', ['ask', 'yes']) == 'ask' self.prompt_workspace_close_project_inaccessible = _node_get_option_str( diff --git a/buildstream/_frontend/app.py b/buildstream/_frontend/app.py index 87b85cd37..96e3c60ae 100644 --- a/buildstream/_frontend/app.py +++ b/buildstream/_frontend/app.py @@ -219,13 +219,13 @@ class App(): default_mirror=self._main_options.get('default_mirror')) except LoadError as e: - # Let's automatically start a `bst init` session in this case - if e.reason == LoadErrorReason.MISSING_PROJECT_CONF and self.interactive: - click.echo("A project was not detected in the directory: {}".format(directory), err=True) - if self.context.prompt_auto_init: - click.echo("", err=True) - if click.confirm("Would you like to create a new project here?"): - self.init_project(None) + # Help users that are new to BuildStream by suggesting 'init'. + # We don't want to slow down users that just made a mistake, so + # don't stop them with an offer to create a project for them. + if e.reason == LoadErrorReason.MISSING_PROJECT_CONF: + click.echo("No project found. You can create a new project like so:", err=True) + click.echo("", err=True) + click.echo(" bst init", err=True) self._error_exit(e, "Error loading project") diff --git a/buildstream/data/userconfig.yaml b/buildstream/data/userconfig.yaml index 4429d1f6d..6351619aa 100644 --- a/buildstream/data/userconfig.yaml +++ b/buildstream/data/userconfig.yaml @@ -112,14 +112,6 @@ logging: # prompt: - # Whether to create a project with 'bst init' if we are invoked outside of a - # directory where we can resolve the project. - # - # ask - Prompt the user to choose. - # no - Never create the project. - # - auto-init: ask - # Whether to really proceed with 'bst workspace close --remove-dir' removing # a workspace directory, potentially losing changes. # |