From d4f41b51f4d3304d102a932d3df64af13e0988a7 Mon Sep 17 00:00:00 2001 From: Alec Scott Date: Mon, 31 Jul 2023 14:49:43 -0700 Subject: Add `spack checksum --verify`, fix `--add` (#38458) * Add rewrite of spack checksum to include --verify and better add versions to package.py files * Fix formatting and remove unused import * Update checksum unit-tests to correctly test multiple versions and add to package * Remove references to latest in stage.py * Update bash-completion scripts to fix unit tests failures * Fix docs generation * Remove unused url_dict argument from methods * Reduce chance of redundant remote_versions work * Add print() before tty.die() to increase error readablity * Update version regular expression to allow for multi-line versions * Add a few unit tests to improve test coverage * Update command completion * Add type hints to added functions and fix a few py-lint suggestions * Add @no_type_check to prevent mypy from failing on pkg.versions * Add type hints to format.py and fix unit test * Black format lib/spack/spack/package_base.py * Attempt ignoring type errors * Add optional dict type hint and declare versions in PackageBase * Refactor util/format.py to allow for url_dict as an optional parameter * Directly reference PackageBase class instead of using TypeVar * Fix comment typo --------- Co-authored-by: Tamara Dahlgren --- share/spack/spack-completion.bash | 2 +- share/spack/spack-completion.fish | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'share') diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index f2275e27d4..f541070682 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -608,7 +608,7 @@ _spack_change() { _spack_checksum() { if $list_options then - SPACK_COMPREPLY="-h --help --keep-stage -b --batch -l --latest -p --preferred -a --add-to-package" + SPACK_COMPREPLY="-h --help --keep-stage -b --batch -l --latest -p --preferred -a --add-to-package --verify" else _all_packages fi diff --git a/share/spack/spack-completion.fish b/share/spack/spack-completion.fish index 79af365c25..8892c6a95e 100755 --- a/share/spack/spack-completion.fish +++ b/share/spack/spack-completion.fish @@ -882,7 +882,7 @@ complete -c spack -n '__fish_spack_using_command change' -s a -l all -f -a all complete -c spack -n '__fish_spack_using_command change' -s a -l all -d 'change all matching specs (allow changing more than one spec)' # spack checksum -set -g __fish_spack_optspecs_spack_checksum h/help keep-stage b/batch l/latest p/preferred a/add-to-package +set -g __fish_spack_optspecs_spack_checksum h/help keep-stage b/batch l/latest p/preferred a/add-to-package verify complete -c spack -n '__fish_spack_using_command_pos 0 checksum' -f -a '(__fish_spack_packages)' complete -c spack -n '__fish_spack_using_command_pos_remainder 1 checksum' -f -a '(__fish_spack_package_versions $__fish_spack_argparse_argv[1])' complete -c spack -n '__fish_spack_using_command checksum' -s h -l help -f -a help @@ -892,11 +892,13 @@ complete -c spack -n '__fish_spack_using_command checksum' -l keep-stage -d 'don complete -c spack -n '__fish_spack_using_command checksum' -s b -l batch -f -a batch complete -c spack -n '__fish_spack_using_command checksum' -s b -l batch -d 'don\'t ask which versions to checksum' complete -c spack -n '__fish_spack_using_command checksum' -s l -l latest -f -a latest -complete -c spack -n '__fish_spack_using_command checksum' -s l -l latest -d 'checksum the latest available version only' +complete -c spack -n '__fish_spack_using_command checksum' -s l -l latest -d 'checksum the latest available version' complete -c spack -n '__fish_spack_using_command checksum' -s p -l preferred -f -a preferred -complete -c spack -n '__fish_spack_using_command checksum' -s p -l preferred -d 'checksum the preferred version only' +complete -c spack -n '__fish_spack_using_command checksum' -s p -l preferred -d 'checksum the known Spack preferred version' complete -c spack -n '__fish_spack_using_command checksum' -s a -l add-to-package -f -a add_to_package complete -c spack -n '__fish_spack_using_command checksum' -s a -l add-to-package -d 'add new versions to package' +complete -c spack -n '__fish_spack_using_command checksum' -l verify -f -a verify +complete -c spack -n '__fish_spack_using_command checksum' -l verify -d 'verify known package checksums' # spack ci set -g __fish_spack_optspecs_spack_ci h/help -- cgit v1.2.3-60-g2f50