Add include flags

This commit is contained in:
Philip Sakievich 2025-04-17 15:35:22 -06:00 committed by Harmen Stoppels
parent 9c03f15cbd
commit 6a48121ed7
3 changed files with 24 additions and 2 deletions

View File

@ -134,6 +134,15 @@ def setup_parser(subparser):
default=None,
dest="signed",
)
add_parser.add_argument(
"--include-file",
help="specs which Spack should always try to add to a mirror"
" (listed in a file, one per line)",
)
add_parser.add_argument(
"--include-specs",
help="specs which Spack should always try to add to a mirror (specified on command line)",
)
add_parser.add_argument(
"--exclude-file",
help="specs which Spack should not try to add to a mirror"
@ -378,6 +387,15 @@ def mirror_add(args):
else:
mirror = spack.mirrors.mirror.Mirror(args.url, name=args.name)
include_specs = []
if args.include_file:
include_specs.extend(specs_from_text_file(args.include_file, concretize=False))
if args.include_specs:
include_specs.extend(spack.cmd.parse_specs(str(args.include_specs).split()))
if include_specs:
# round trip specs to assure they are valid
mirror.update({"include": [str(s) for s in include_specs]})
exclude_specs = []
if args.exclude_file:
exclude_specs.extend(specs_from_text_file(args.exclude_file, concretize=False))

View File

@ -1459,7 +1459,7 @@ _spack_mirror_destroy() {
_spack_mirror_add() {
if $list_options
then
SPACK_COMPREPLY="-h --help --scope --type --autopush --unsigned --signed --exclude-file --exclude-specs --s3-access-key-id --s3-access-key-id-variable --s3-access-key-secret --s3-access-key-secret-variable --s3-access-token --s3-access-token-variable --s3-profile --s3-endpoint-url --oci-username --oci-username-variable --oci-password --oci-password-variable"
SPACK_COMPREPLY="-h --help --scope --type --autopush --unsigned --signed --include-file --include-specs --exclude-file --exclude-specs --s3-access-key-id --s3-access-key-id-variable --s3-access-key-secret --s3-access-key-secret-variable --s3-access-token --s3-access-token-variable --s3-profile --s3-endpoint-url --oci-username --oci-username-variable --oci-password --oci-password-variable"
else
_mirrors
fi

View File

@ -2301,7 +2301,7 @@ complete -c spack -n '__fish_spack_using_command mirror destroy' -l mirror-url -
complete -c spack -n '__fish_spack_using_command mirror destroy' -l mirror-url -r -d 'find mirror to destroy by url'
# spack mirror add
set -g __fish_spack_optspecs_spack_mirror_add h/help scope= type= autopush unsigned signed exclude-file= exclude-specs= s3-access-key-id= s3-access-key-id-variable= s3-access-key-secret= s3-access-key-secret-variable= s3-access-token= s3-access-token-variable= s3-profile= s3-endpoint-url= oci-username= oci-username-variable= oci-password= oci-password-variable=
set -g __fish_spack_optspecs_spack_mirror_add h/help scope= type= autopush unsigned signed include-file= include-specs= exclude-file= exclude-specs= s3-access-key-id= s3-access-key-id-variable= s3-access-key-secret= s3-access-key-secret-variable= s3-access-token= s3-access-token-variable= s3-profile= s3-endpoint-url= oci-username= oci-username-variable= oci-password= oci-password-variable=
complete -c spack -n '__fish_spack_using_command_pos 0 mirror add' -f
complete -c spack -n '__fish_spack_using_command mirror add' -s h -l help -f -a help
complete -c spack -n '__fish_spack_using_command mirror add' -s h -l help -d 'show this help message and exit'
@ -2315,6 +2315,10 @@ complete -c spack -n '__fish_spack_using_command mirror add' -l unsigned -f -a s
complete -c spack -n '__fish_spack_using_command mirror add' -l unsigned -d 'do not require signing and signature verification when pushing and installing from this build cache'
complete -c spack -n '__fish_spack_using_command mirror add' -l signed -f -a signed
complete -c spack -n '__fish_spack_using_command mirror add' -l signed -d 'require signing and signature verification when pushing and installing from this build cache'
complete -c spack -n '__fish_spack_using_command mirror add' -l include-file -r -f -a include_file
complete -c spack -n '__fish_spack_using_command mirror add' -l include-file -r -d 'specs which Spack should always try to add to a mirror (listed in a file, one per line)'
complete -c spack -n '__fish_spack_using_command mirror add' -l include-specs -r -f -a include_specs
complete -c spack -n '__fish_spack_using_command mirror add' -l include-specs -r -d 'specs which Spack should always try to add to a mirror (specified on command line)'
complete -c spack -n '__fish_spack_using_command mirror add' -l exclude-file -r -f -a exclude_file
complete -c spack -n '__fish_spack_using_command mirror add' -l exclude-file -r -d 'specs which Spack should not try to add to a mirror (listed in a file, one per line)'
complete -c spack -n '__fish_spack_using_command mirror add' -l exclude-specs -r -f -a exclude_specs