summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <angelos.evripiotis@gmail.com>2018-12-20 14:37:38 +0000
committerAngelos Evripiotis <angelos.evripiotis@gmail.com>2018-12-20 14:37:38 +0000
commite0c575c453dbc379e04ff0694d15c836223e5850 (patch)
tree2b83c60b36bc5c545a5e01d0b8f3b69568cbcbc0
parent14da6955f9dd7ed820992a49af3eda8fe8092890 (diff)
parent46efc91dc3c37324903e62648dd1f0dc3b661af1 (diff)
downloadbuildstream-e0c575c453dbc379e04ff0694d15c836223e5850.tar.gz
Merge branch 'aevri/rm-autoinit' into 'master'
BREAK: remove auto-init behaviour Closes #826 See merge request BuildStream/buildstream!1015
-rw-r--r--NEWS10
-rw-r--r--buildstream/_context.py8
-rw-r--r--buildstream/_frontend/app.py14
-rw-r--r--buildstream/_project.py7
-rw-r--r--buildstream/data/userconfig.yaml8
5 files changed, 20 insertions, 27 deletions
diff --git a/NEWS b/NEWS
index 7e6ec8477..7ee63f952 100644
--- a/NEWS
+++ b/NEWS
@@ -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/_project.py b/buildstream/_project.py
index 90ed58e14..ef8d835cf 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -677,8 +677,9 @@ class Project():
#
def _find_project_dir(self, directory):
workspace_element = None
+ config_filenames = [_PROJECT_CONF_FILE, WORKSPACE_PROJECT_FILE]
found_directory, filename = utils._search_upward_for_files(
- directory, [_PROJECT_CONF_FILE, WORKSPACE_PROJECT_FILE]
+ directory, config_filenames
)
if filename == _PROJECT_CONF_FILE:
project_directory = found_directory
@@ -691,8 +692,8 @@ class Project():
else:
raise LoadError(
LoadErrorReason.MISSING_PROJECT_CONF,
- '{} not found in current directory or any of its parent directories'
- .format(_PROJECT_CONF_FILE))
+ "None of {names} found in '{path}' or any of its parent directories"
+ .format(names=config_filenames, path=directory))
return project_directory, workspace_element
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.
#