diff options
author | Chandan Singh <csingh43@bloomberg.net> | 2018-09-22 00:32:04 +0100 |
---|---|---|
committer | Chandan Singh <chandan@chandansingh.net> | 2018-11-19 12:35:01 +0000 |
commit | 76c5d2f884724791d65cb148f958c9c31ab3dc6c (patch) | |
tree | 9652d4700a32c9f7a5f4e50b322c7537772f36e2 /buildstream/_frontend/cli.py | |
parent | 30b722447a2f45194d207f261602e3d86837d06e (diff) | |
download | buildstream-76c5d2f884724791d65cb148f958c9c31ab3dc6c.tar.gz |
Add `bst source-checkout` command
As discussed in
https://mail.gnome.org/archives/buildstream-list/2018-September/msg00064.html,
add `bst source-checkout` command. This will allow users to checkout
sources for a given target.
* _frontend/cli.py: Add source-checkout command
* _pipeline.py: Add assert_sources_cached() method
* _stream.py: Add source_checkout method, abstract out
__check_location_writable() method that used to part of checkout()
Diffstat (limited to 'buildstream/_frontend/cli.py')
-rw-r--r-- | buildstream/_frontend/cli.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index b75bf455b..725dc8c1d 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -665,6 +665,33 @@ def checkout(app, element, location, force, deps, integrate, hardlinks, tar): ################################################################## +# Source Checkout Command # +################################################################## +@cli.command(name='source-checkout', short_help='Checkout sources for an element') +@click.option('--except', 'except_', multiple=True, + type=click.Path(readable=False), + help="Except certain dependencies") +@click.option('--deps', '-d', default='none', + type=click.Choice(['build', 'none', 'run', 'all']), + help='The dependencies whose sources to checkout (default: none)') +@click.option('--fetch', 'fetch_', default=False, is_flag=True, + help='Fetch elements if they are not fetched') +@click.argument('element', + type=click.Path(readable=False)) +@click.argument('location', type=click.Path()) +@click.pass_obj +def source_checkout(app, element, location, deps, fetch_, except_): + """Checkout sources of an element to the specified location + """ + with app.initialized(): + app.stream.source_checkout(element, + location=location, + deps=deps, + fetch=fetch_, + except_targets=except_) + + +################################################################## # Workspace Command # ################################################################## @cli.group(short_help="Manipulate developer workspaces") |