diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2018-07-16 16:45:16 +0100 |
---|---|---|
committer | Tiago Gomes <tiago.avv@gmail.com> | 2018-07-20 09:07:01 +0000 |
commit | 9c1f024b15849fae1d8512c0215e4fb0b24fc311 (patch) | |
tree | 0a2216e961e5b4a5f8eebb6bf1eab087719916a1 /buildstream/_frontend/cli.py | |
parent | 790fb40b75075c9af64798df3aa54fd4d8fe140e (diff) | |
download | buildstream-9c1f024b15849fae1d8512c0215e4fb0b24fc311.tar.gz |
Add support for creating a tarball on bst checkouttiagogomes/tarball_checkout
One of the tests added is configured to be skipped for now, as dumping
binary data is causing a bad descriptor exception when using the pytest
capture module.
Closes #263.
Diffstat (limited to 'buildstream/_frontend/cli.py')
-rw-r--r-- | buildstream/_frontend/cli.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index 51744e806..bd2ce8a73 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -626,7 +626,7 @@ def shell(app, element, sysroot, mount, isolate, build_, command): ################################################################## @cli.command(short_help="Checkout a built artifact") @click.option('--force', '-f', default=False, is_flag=True, - help="Overwrite files existing in checkout directory") + help="Allow files to be overwritten") @click.option('--deps', '-d', default='run', type=click.Choice(['run', 'none']), help='The dependencies to checkout (default: run)') @@ -634,20 +634,30 @@ def shell(app, element, sysroot, mount, isolate, build_, command): help="Whether to run integration commands") @click.option('--hardlinks', default=False, is_flag=True, help="Checkout hardlinks instead of copies (handle with care)") +@click.option('--tar', default=False, is_flag=True, + help="Create a tarball from the artifact contents instead " + "of a file tree. If LOCATION is '-', the tarball " + "will be dumped to the standard output.") @click.argument('element', type=click.Path(readable=False)) -@click.argument('directory', type=click.Path(file_okay=False)) +@click.argument('location', type=click.Path()) @click.pass_obj -def checkout(app, element, directory, force, deps, integrate, hardlinks): - """Checkout a built artifact to the specified directory +def checkout(app, element, location, force, deps, integrate, hardlinks, tar): + """Checkout a built artifact to the specified location """ + + if hardlinks and tar: + click.echo("ERROR: options --hardlinks and --tar conflict", err=True) + sys.exit(-1) + with app.initialized(): app.stream.checkout(element, - directory=directory, - deps=deps, + location=location, force=force, + deps=deps, integrate=integrate, - hardlinks=hardlinks) + hardlinks=hardlinks, + tar=tar) ################################################################## |