diff options
author | Harmen Stoppels <me@harmenstoppels.nl> | 2023-12-05 12:44:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-05 12:44:50 +0100 |
commit | 3cefd73fcc0647cda740e5953af709e82b4b5bd8 (patch) | |
tree | 33cab65ed82a536a6af1f1067920f2285fc7603b /lib | |
parent | 3547bcb51714872e4fc735a657b38ecc6eeae30c (diff) | |
download | spack-3cefd73fcc0647cda740e5953af709e82b4b5bd8.tar.gz spack-3cefd73fcc0647cda740e5953af709e82b4b5bd8.tar.bz2 spack-3cefd73fcc0647cda740e5953af709e82b4b5bd8.tar.xz spack-3cefd73fcc0647cda740e5953af709e82b4b5bd8.zip |
spack buildcache check: use same interface as push (#41378)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/buildcache.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/spack/spack/cmd/buildcache.py b/lib/spack/spack/cmd/buildcache.py index 05b7bd783a..76e2d0f61c 100644 --- a/lib/spack/spack/cmd/buildcache.py +++ b/lib/spack/spack/cmd/buildcache.py @@ -188,14 +188,16 @@ def setup_parser(subparser: argparse.ArgumentParser): default=lambda: spack.config.default_modify_scope(), help="configuration scope containing mirrors to check", ) - check_spec_or_specfile = check.add_mutually_exclusive_group(required=True) - check_spec_or_specfile.add_argument( + # Unfortunately there are 3 ways to do the same thing here: + check_specs = check.add_mutually_exclusive_group() + check_specs.add_argument( "-s", "--spec", help="check single spec instead of release specs file" ) - check_spec_or_specfile.add_argument( + check_specs.add_argument( "--spec-file", help="check single spec from json or yaml file instead of release specs file", ) + arguments.add_common_arguments(check, ["specs"]) check.set_defaults(func=check_fn) @@ -813,15 +815,24 @@ def check_fn(args: argparse.Namespace): exit code is non-zero, then at least one of the indicated specs needs to be rebuilt """ if args.spec_file: + specs_arg = ( + args.spec_file if os.path.sep in args.spec_file else os.path.join(".", args.spec_file) + ) tty.warn( "The flag `--spec-file` is deprecated and will be removed in Spack 0.22. " - "Use --spec instead." + f"Use `spack buildcache check {specs_arg}` instead." ) + elif args.spec: + specs_arg = args.spec + tty.warn( + "The flag `--spec` is deprecated and will be removed in Spack 0.23. " + f"Use `spack buildcache check {specs_arg}` instead." + ) + else: + specs_arg = args.specs - specs = spack.cmd.parse_specs(args.spec or args.spec_file) - - if specs: - specs = _matching_specs(specs) + if specs_arg: + specs = _matching_specs(spack.cmd.parse_specs(specs_arg)) else: specs = spack.cmd.require_active_env("buildcache check").all_specs() |