From a18a0e7a47ca20c9745e2dfc12f7dbc1f47253b1 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Thu, 23 Dec 2021 13:45:06 -0800 Subject: commands: add `spack pkg source` and `spack pkg hash` To make it easier to see how package hashes change and how they are computed, add two commands: * `spack pkg source `: dumps source code for a package to the terminal * `spack pkg source --canonical `: dumps canonicalized source code for a package to the terminal. It strips comments, directives, and known-unused multimethods from the package. It is used to generate package hashes. * `spack pkg hash `: This gives the package hash for a particular spec. It is generated from the canonical source code for the spec. - [x] `add spack pkg source` and `spack pkg hash` - [x] add tests - [x] fix bug in multimethod resolution with boolean `@when` values Co-authored-by: Greg Becker --- share/spack/spack-completion.bash | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'share') diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 08ea6751f3..65866a5099 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -1444,7 +1444,7 @@ _spack_pkg() { then SPACK_COMPREPLY="-h --help" else - SPACK_COMPREPLY="add list diff added changed removed" + SPACK_COMPREPLY="add list diff added changed removed source hash" fi } @@ -1502,6 +1502,24 @@ _spack_pkg_removed() { fi } +_spack_pkg_source() { + if $list_options + then + SPACK_COMPREPLY="-h --help -c --canonical" + else + _all_packages + fi +} + +_spack_pkg_hash() { + if $list_options + then + SPACK_COMPREPLY="-h --help" + else + _all_packages + fi +} + _spack_providers() { if $list_options then -- cgit v1.2.3-60-g2f50