spack buildcache push: improve argparse (#38876)

This commit is contained in:
Harmen Stoppels 2023-07-13 16:01:09 +02:00 committed by GitHub
parent 522d9e260b
commit 033eb77aa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 10 deletions

View File

@ -45,15 +45,18 @@ def setup_parser(subparser):
push = subparsers.add_parser("push", aliases=["create"], help=push_fn.__doc__) push = subparsers.add_parser("push", aliases=["create"], help=push_fn.__doc__)
push.add_argument("-f", "--force", action="store_true", help="overwrite tarball if it exists") push.add_argument("-f", "--force", action="store_true", help="overwrite tarball if it exists")
push.add_argument( push.add_argument(
"-u", "--unsigned", action="store_true", help="push unsigned buildcache tarballs"
)
push.add_argument(
"-a",
"--allow-root", "--allow-root",
"-a",
action="store_true", action="store_true",
help="allow install root string in binary files after RPATH substitution", help="allow install root string in binary files after RPATH substitution",
) )
push.add_argument("-k", "--key", metavar="key", type=str, default=None, help="key for signing") push_sign = push.add_mutually_exclusive_group(required=False)
push_sign.add_argument(
"--unsigned", "-u", action="store_true", help="push unsigned buildcache tarballs"
)
push_sign.add_argument(
"--key", "-k", metavar="key", type=str, default=None, help="key for signing"
)
push.add_argument("mirror", type=str, help="mirror name, path, or URL") push.add_argument("mirror", type=str, help="mirror name, path, or URL")
push.add_argument( push.add_argument(
"--update-index", "--update-index",
@ -70,9 +73,9 @@ def setup_parser(subparser):
default="package,dependencies", default="package,dependencies",
dest="things_to_install", dest="things_to_install",
choices=["package", "dependencies"], choices=["package", "dependencies"],
help="select the buildcache mode\n\n" help="select the buildcache mode. "
"the default is to build a cache for the package along with all its dependencies. " "The default is to build a cache for the package along with all its dependencies. "
"alternatively, one can decide to build a cache for only the package or only the " "Alternatively, one can decide to build a cache for only the package or only the "
"dependencies", "dependencies",
) )
arguments.add_common_arguments(push, ["specs"]) arguments.add_common_arguments(push, ["specs"])

View File

@ -498,7 +498,7 @@ _spack_buildcache() {
_spack_buildcache_push() { _spack_buildcache_push() {
if $list_options if $list_options
then then
SPACK_COMPREPLY="-h --help -f --force -u --unsigned -a --allow-root -k --key --update-index --rebuild-index --spec-file --only" SPACK_COMPREPLY="-h --help -f --force --allow-root -a --unsigned -u --key -k --update-index --rebuild-index --spec-file --only"
else else
_mirrors _mirrors
fi fi
@ -507,7 +507,7 @@ _spack_buildcache_push() {
_spack_buildcache_create() { _spack_buildcache_create() {
if $list_options if $list_options
then then
SPACK_COMPREPLY="-h --help -f --force -u --unsigned -a --allow-root -k --key --update-index --rebuild-index --spec-file --only" SPACK_COMPREPLY="-h --help -f --force --allow-root -a --unsigned -u --key -k --update-index --rebuild-index --spec-file --only"
else else
_mirrors _mirrors
fi fi