Angelos Evripiotis pushed to branch aevri/are_you_sure at BuildStream / buildstream
Commits:
-
5df4105a
by Angelos Evripiotis at 2019-01-28T10:13:40Z
-
9c981eff
by Angelos Evripiotis at 2019-01-28T10:17:57Z
-
bef80291
by Angelos Evripiotis at 2019-01-28T10:19:17Z
-
564cb245
by Angelos Evripiotis at 2019-01-28T11:36:16Z
-
bfcc5281
by Angelos Evripiotis at 2019-01-28T13:37:25Z
16 changed files:
- NEWS
- buildstream/_context.py
- buildstream/_frontend/cli.py
- buildstream/_gitsourcebase.py
- buildstream/_loader/loader.py
- buildstream/_pipeline.py
- buildstream/data/userconfig.yaml
- buildstream/plugins/elements/junction.py
- buildstream/plugins/sources/bzr.py
- buildstream/plugins/sources/deb.py
- buildstream/plugins/sources/git.py
- buildstream/plugins/sources/remote.py
- buildstream/plugins/sources/tar.py
- buildstream/plugins/sources/zip.py
- doc/source/format_project_refs.rst
- tests/frontend/completions.py
Changes:
... | ... | @@ -20,7 +20,7 @@ buildstream 1.3.1 |
20 | 20 |
an element's sources and generated build scripts you can do the command
|
21 | 21 |
`bst source-checkout --include-build-scripts --tar foo.bst some-file.tar`
|
22 | 22 |
|
23 |
- o BREAKING CHANGE: `bst track` and `bst fetch` commands are now osbolete.
|
|
23 |
+ o BREAKING CHANGE: `bst track` and `bst fetch` commands are now obsolete.
|
|
24 | 24 |
Their functionality is provided by `bst source track` and
|
25 | 25 |
`bst source fetch` respectively.
|
26 | 26 |
|
... | ... | @@ -50,6 +50,11 @@ buildstream 1.3.1 |
50 | 50 |
an error message and a hint instead, to avoid bothering folks that just
|
51 | 51 |
made a mistake.
|
52 | 52 |
|
53 |
+ o BREAKING CHANGE: The unconditional 'Are you sure?' prompts have been
|
|
54 |
+ removed. These would always ask you if you were sure when running
|
|
55 |
+ 'bst workspace close --remove-dir' or 'bst workspace reset'. They got in
|
|
56 |
+ the way too often.
|
|
57 |
+ |
|
53 | 58 |
o Failed builds are included in the cache as well.
|
54 | 59 |
`bst checkout` will provide anything in `%{install-root}`.
|
55 | 60 |
A build including cached fails will cause any dependant elements
|
... | ... | @@ -87,12 +92,6 @@ buildstream 1.3.1 |
87 | 92 |
instead of just a specially-formatted build-root with a `root` and `scratch`
|
88 | 93 |
subdirectory.
|
89 | 94 |
|
90 |
- o The buildstream.conf file learned new
|
|
91 |
- 'prompt.really-workspace-close-remove-dir' and
|
|
92 |
- 'prompt.really-workspace-reset-hard' options. These allow users to suppress
|
|
93 |
- certain confirmation prompts, e.g. double-checking that the user meant to
|
|
94 |
- run the command as typed.
|
|
95 |
- |
|
96 | 95 |
o Due to the element `build tree` being cached in the respective artifact their
|
97 | 96 |
size in some cases has significantly increased. In *most* cases the build trees
|
98 | 97 |
are not utilised when building targets, as such by default bst 'pull' & 'build'
|
... | ... | @@ -121,18 +121,10 @@ class Context(): |
121 | 121 |
# Whether or not to attempt to pull build trees globally
|
122 | 122 |
self.pull_buildtrees = None
|
123 | 123 |
|
124 |
- # Boolean, whether we double-check with the user that they meant to
|
|
125 |
- # remove a workspace directory.
|
|
126 |
- self.prompt_workspace_close_remove_dir = None
|
|
127 |
- |
|
128 | 124 |
# Boolean, whether we double-check with the user that they meant to
|
129 | 125 |
# close the workspace when they're using it to access the project.
|
130 | 126 |
self.prompt_workspace_close_project_inaccessible = None
|
131 | 127 |
|
132 |
- # Boolean, whether we double-check with the user that they meant to do
|
|
133 |
- # a hard reset of a workspace, potentially losing changes.
|
|
134 |
- self.prompt_workspace_reset_hard = None
|
|
135 |
- |
|
136 | 128 |
# Whether elements must be rebuilt when their dependencies have changed
|
137 | 129 |
self._strict_build_plan = None
|
138 | 130 |
|
... | ... | @@ -260,16 +252,10 @@ class Context(): |
260 | 252 |
prompt = _yaml.node_get(
|
261 | 253 |
defaults, Mapping, 'prompt')
|
262 | 254 |
_yaml.node_validate(prompt, [
|
263 |
- 'really-workspace-close-remove-dir',
|
|
264 | 255 |
'really-workspace-close-project-inaccessible',
|
265 |
- 'really-workspace-reset-hard',
|
|
266 | 256 |
])
|
267 |
- self.prompt_workspace_close_remove_dir = _node_get_option_str(
|
|
268 |
- prompt, 'really-workspace-close-remove-dir', ['ask', 'yes']) == 'ask'
|
|
269 | 257 |
self.prompt_workspace_close_project_inaccessible = _node_get_option_str(
|
270 | 258 |
prompt, 'really-workspace-close-project-inaccessible', ['ask', 'yes']) == 'ask'
|
271 |
- self.prompt_workspace_reset_hard = _node_get_option_str(
|
|
272 |
- prompt, 'really-workspace-reset-hard', ['ask', 'yes']) == 'ask'
|
|
273 | 259 |
|
274 | 260 |
# Load per-projects overrides
|
275 | 261 |
self._project_overrides = _yaml.node_get(defaults, Mapping, 'projects', default_value={})
|
... | ... | @@ -829,11 +829,6 @@ def workspace_close(app, remove_dir, all_, elements): |
829 | 829 |
if nonexisting:
|
830 | 830 |
raise AppError("Workspace does not exist", detail="\n".join(nonexisting))
|
831 | 831 |
|
832 |
- if app.interactive and remove_dir and app.context.prompt_workspace_close_remove_dir:
|
|
833 |
- if not click.confirm('This will remove all your changes, are you sure?'):
|
|
834 |
- click.echo('Aborting', err=True)
|
|
835 |
- sys.exit(-1)
|
|
836 |
- |
|
837 | 832 |
for element_name in elements:
|
838 | 833 |
app.stream.workspace_close(element_name, remove_dir=remove_dir)
|
839 | 834 |
|
... | ... | @@ -867,11 +862,6 @@ def workspace_reset(app, soft, track_, all_, elements): |
867 | 862 |
if all_ and not app.stream.workspace_exists():
|
868 | 863 |
raise AppError("No open workspaces to reset")
|
869 | 864 |
|
870 |
- if app.interactive and not soft and app.context.prompt_workspace_reset_hard:
|
|
871 |
- if not click.confirm('This will remove all your changes, are you sure?'):
|
|
872 |
- click.echo('Aborting', err=True)
|
|
873 |
- sys.exit(-1)
|
|
874 |
- |
|
875 | 865 |
if all_:
|
876 | 866 |
elements = tuple(element_name for element_name, _ in app.context.get_workspaces().list())
|
877 | 867 |
|
... | ... | @@ -605,7 +605,7 @@ class _GitSourceBase(Source): |
605 | 605 |
detail = "The ref provided for the element does not exist locally " + \
|
606 | 606 |
"in the provided track branch / tag '{}'.\n".format(self.tracking) + \
|
607 | 607 |
"You may wish to track the element to update the ref from '{}' ".format(self.tracking) + \
|
608 |
- "with `bst track`,\n" + \
|
|
608 |
+ "with `bst source track`,\n" + \
|
|
609 | 609 |
"or examine the upstream at '{}' for the specific ref.".format(self.mirror.url)
|
610 | 610 |
|
611 | 611 |
self.warn("{}: expected ref '{}' was not found in given track '{}' for staged repository: '{}'\n"
|
... | ... | @@ -557,7 +557,7 @@ class Loader(): |
557 | 557 |
ticker(filename, 'Fetching subproject from {} source'.format(source.get_kind()))
|
558 | 558 |
source._fetch(sources[0:idx])
|
559 | 559 |
else:
|
560 |
- detail = "Try fetching the project with `bst fetch {}`".format(filename)
|
|
560 |
+ detail = "Try fetching the project with `bst source fetch {}`".format(filename)
|
|
561 | 561 |
raise LoadError(LoadErrorReason.SUBPROJECT_FETCH_NEEDED,
|
562 | 562 |
"Subproject fetch needed for junction: {}".format(filename),
|
563 | 563 |
detail=detail)
|
... | ... | @@ -565,7 +565,7 @@ class Loader(): |
565 | 565 |
# Handle the case where a subproject has no ref
|
566 | 566 |
#
|
567 | 567 |
elif source.get_consistency() == Consistency.INCONSISTENT:
|
568 |
- detail = "Try tracking the junction element with `bst track {}`".format(filename)
|
|
568 |
+ detail = "Try tracking the junction element with `bst source track {}`".format(filename)
|
|
569 | 569 |
raise LoadError(LoadErrorReason.SUBPROJECT_INCONSISTENT,
|
570 | 570 |
"Subproject has no ref for junction: {}".format(filename),
|
571 | 571 |
detail=detail)
|
... | ... | @@ -373,7 +373,7 @@ class Pipeline(): |
373 | 373 |
if source._get_consistency() == Consistency.INCONSISTENT:
|
374 | 374 |
detail += " {} is missing ref\n".format(source)
|
375 | 375 |
detail += '\n'
|
376 |
- detail += "Try tracking these elements first with `bst track`\n"
|
|
376 |
+ detail += "Try tracking these elements first with `bst source track`\n"
|
|
377 | 377 |
|
378 | 378 |
raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline")
|
379 | 379 |
|
... | ... | @@ -406,7 +406,7 @@ class Pipeline(): |
406 | 406 |
if source._get_consistency() != Consistency.CACHED:
|
407 | 407 |
detail += " {}\n".format(source)
|
408 | 408 |
detail += '\n'
|
409 |
- detail += "Try fetching these elements first with `bst fetch`,\n" + \
|
|
409 |
+ detail += "Try fetching these elements first with `bst source fetch`,\n" + \
|
|
410 | 410 |
"or run this command with `--fetch` option\n"
|
411 | 411 |
|
412 | 412 |
raise PipelineError("Uncached sources", detail=detail, reason="uncached-sources")
|
... | ... | @@ -112,14 +112,6 @@ logging: |
112 | 112 |
#
|
113 | 113 |
prompt:
|
114 | 114 |
|
115 |
- # Whether to really proceed with 'bst workspace close --remove-dir' removing
|
|
116 |
- # a workspace directory, potentially losing changes.
|
|
117 |
- #
|
|
118 |
- # ask - Ask the user if they are sure.
|
|
119 |
- # yes - Always remove, without asking.
|
|
120 |
- #
|
|
121 |
- really-workspace-close-remove-dir: ask
|
|
122 |
- |
|
123 | 115 |
# Whether to really proceed with 'bst workspace close' when doing so would
|
124 | 116 |
# stop them from running bst commands in this workspace.
|
125 | 117 |
#
|
... | ... | @@ -127,11 +119,3 @@ prompt: |
127 | 119 |
# yes - Always close, without asking.
|
128 | 120 |
#
|
129 | 121 |
really-workspace-close-project-inaccessible: ask
|
130 |
- |
|
131 |
- # Whether to really proceed with 'bst workspace reset' doing a hard reset of
|
|
132 |
- # a workspace, potentially losing changes.
|
|
133 |
- #
|
|
134 |
- # ask - Ask the user if they are sure.
|
|
135 |
- # yes - Always hard reset, without asking.
|
|
136 |
- #
|
|
137 |
- really-workspace-reset-hard: ask
|
... | ... | @@ -79,7 +79,7 @@ depend on a junction element itself. |
79 | 79 |
|
80 | 80 |
Therefore, if you require the most up-to-date version of a subproject,
|
81 | 81 |
you must explicitly track the junction element by invoking:
|
82 |
- `bst track JUNCTION_ELEMENT`.
|
|
82 |
+ `bst source track JUNCTION_ELEMENT`.
|
|
83 | 83 |
|
84 | 84 |
Furthermore, elements within the subproject are also not tracked by default.
|
85 | 85 |
For this, we must specify the `--track-cross-junctions` option. This option
|
... | ... | @@ -93,7 +93,7 @@ cached yet. However, they can be fetched explicitly: |
93 | 93 |
|
94 | 94 |
.. code::
|
95 | 95 |
|
96 |
- bst fetch junction.bst
|
|
96 |
+ bst source fetch junction.bst
|
|
97 | 97 |
|
98 | 98 |
Other commands such as ``bst build`` implicitly fetch junction sources.
|
99 | 99 |
|
... | ... | @@ -146,7 +146,7 @@ class JunctionElement(Element): |
146 | 146 |
|
147 | 147 |
def get_unique_key(self):
|
148 | 148 |
# Junctions do not produce artifacts. get_unique_key() implementation
|
149 |
- # is still required for `bst fetch`.
|
|
149 |
+ # is still required for `bst source fetch`.
|
|
150 | 150 |
return 1
|
151 | 151 |
|
152 | 152 |
def configure_sandbox(self, sandbox):
|
... | ... | @@ -46,7 +46,7 @@ bzr - stage files from a bazaar repository |
46 | 46 |
# but revisions on a branch are of the form
|
47 | 47 |
# <revision-branched-from>.<branch-number>.<revision-since-branching>
|
48 | 48 |
# e.g. 6622.1.6.
|
49 |
- # The ref must be specified to build, and 'bst track' will update the
|
|
49 |
+ # The ref must be specified to build, and 'bst source track' will update the
|
|
50 | 50 |
# revision number to the one on the tip of the branch specified in 'track'.
|
51 | 51 |
ref: 6622
|
52 | 52 |
|
... | ... | @@ -34,7 +34,7 @@ deb - stage files from .deb packages |
34 | 34 |
kind: deb
|
35 | 35 |
|
36 | 36 |
# Specify the deb url. Using an alias defined in your project
|
37 |
- # configuration is encouraged. 'bst track' will update the
|
|
37 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
38 | 38 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
39 | 39 |
url: upstream:foo.deb
|
40 | 40 |
|
... | ... | @@ -112,7 +112,7 @@ git - stage files from a git repository |
112 | 112 |
# o Enable `track-tags` feature
|
113 | 113 |
# o Set the `track` parameter to the desired commit sha which
|
114 | 114 |
# the current `ref` points to
|
115 |
- # o Run `bst track` for these elements, this will result in
|
|
115 |
+ # o Run `bst source track` for these elements, this will result in
|
|
116 | 116 |
# populating the `tags` portion of the refs without changing
|
117 | 117 |
# the refs
|
118 | 118 |
# o Restore the `track` parameter to the branches which you have
|
... | ... | @@ -37,7 +37,7 @@ remote - stage files from remote urls |
37 | 37 |
# executable: true
|
38 | 38 |
|
39 | 39 |
# Specify the url. Using an alias defined in your project
|
40 |
- # configuration is encouraged. 'bst track' will update the
|
|
40 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
41 | 41 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
42 | 42 |
url: upstream:foo
|
43 | 43 |
|
... | ... | @@ -33,7 +33,7 @@ tar - stage files from tar archives |
33 | 33 |
kind: tar
|
34 | 34 |
|
35 | 35 |
# Specify the tar url. Using an alias defined in your project
|
36 |
- # configuration is encouraged. 'bst track' will update the
|
|
36 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
37 | 37 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
38 | 38 |
url: upstream:foo.tar
|
39 | 39 |
|
... | ... | @@ -29,7 +29,7 @@ zip - stage files from zip archives |
29 | 29 |
kind: zip
|
30 | 30 |
|
31 | 31 |
# Specify the zip url. Using an alias defined in your project
|
32 |
- # configuration is encouraged. 'bst track' will update the
|
|
32 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
33 | 33 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
34 | 34 |
url: upstream:foo.zip
|
35 | 35 |
|
... | ... | @@ -21,9 +21,9 @@ When a ``project.refs`` file is in use, any source references found |
21 | 21 |
in the :ref:`inline source declarations <format_sources>` are considered
|
22 | 22 |
invalid and will be ignored, and a warning will be emitted for them.
|
23 | 23 |
|
24 |
-When ``bst track`` is run for your project, the ``project.refs`` file
|
|
24 |
+When ``bst source track`` is run for your project, the ``project.refs`` file
|
|
25 | 25 |
will be updated instead of the inline source declarations. In the absence
|
26 |
-of a ``project.refs`` file, ``bst track`` will create one automatically
|
|
26 |
+of a ``project.refs`` file, ``bst source track`` will create one automatically
|
|
27 | 27 |
with the tracking results.
|
28 | 28 |
|
29 | 29 |
An interesting property of ``project.refs`` is that it allows for
|
... | ... | @@ -160,7 +160,7 @@ def test_options(cli, cmd, word_idx, expected): |
160 | 160 |
('bst show --deps b', 3, ['build ']),
|
161 | 161 |
('bst show --deps=b', 2, ['build ']),
|
162 | 162 |
('bst show --deps r', 3, ['run ']),
|
163 |
- ('bst track --deps ', 3, ['all ', 'none ']),
|
|
163 |
+ ('bst source track --deps ', 4, ['all ', 'none ']),
|
|
164 | 164 |
])
|
165 | 165 |
def test_option_choice(cli, cmd, word_idx, expected):
|
166 | 166 |
assert_completion(cli, cmd, word_idx, expected)
|