diff options
author | Chandan Singh <csingh43@bloomberg.net> | 2018-09-22 00:32:04 +0100 |
---|---|---|
committer | Chandan Singh <csingh43@bloomberg.net> | 2018-10-26 16:21:29 +0100 |
commit | 06a29a600cebc9226f1c524b60f5028f7d7ec5d5 (patch) | |
tree | 84e310a7ecea45c3fda8a2610d7575d7d895ee7b /buildstream/_frontend/cli.py | |
parent | ebcc348d9eca81f3fd8405b0eb89942ef13db7e6 (diff) | |
download | buildstream-chandan/source-checkout.tar.gz |
Add `bst source-checkout` commandchandan/source-checkout
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 85632959f..53edc0b71 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -663,6 +663,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") |