summaryrefslogtreecommitdiff
path: root/share/spack
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2023-12-26 14:52:10 -0800
committerGitHub <noreply@github.com>2023-12-26 14:52:10 -0800
commit24d12c632c483fb84bac2f6bc64bb62593035e3f (patch)
tree05119bc1aaffc16a67f97a6f3c4f0fa356ef9a74 /share/spack
parent441b68aca3f4bd95f87a6781a9f79308e662427e (diff)
downloadspack-24d12c632c483fb84bac2f6bc64bb62593035e3f.tar.gz
spack-24d12c632c483fb84bac2f6bc64bb62593035e3f.tar.bz2
spack-24d12c632c483fb84bac2f6bc64bb62593035e3f.tar.xz
spack-24d12c632c483fb84bac2f6bc64bb62593035e3f.zip
`spack gc`: add options for environments and build dependencies (#41731)
This adds a few options to `spack gc`. One to give you a little more control over dependencies: * `-b` / `--keep-build-dependencies`: By default, `spack gc` considers build dependencies to be "no longer needed" once their dependents are installed. With this option, we'll keep build dependencies of needed installations as well. And two more to make working with environments easier: * `-E` / `--except-any-environment`: Garbage collect anything NOT needed by an environment. `spack gc -E` and `spack gc -bE` are now easy ways to get rid of everytihng not used by some environment. * `-e` / `--except-environment` `ENV`: Instead of considering all environments, garbage collect everything not needed by a *specific* environment. Note that you can use this with `-E` to add directory environments to the list of considered envs, e.g.: spack gc -E -e /path/to/direnv1 -e /path/to/direnv2 #... - [x] rework `unused_specs()` method on DB to add options for roots and deptypes - [x] add `all_hashes()` method on DB - [x] rework `spack gc` command to add 3 more options - [x] tests
Diffstat (limited to 'share/spack')
-rwxr-xr-xshare/spack/spack-completion.bash2
-rwxr-xr-xshare/spack/spack-completion.fish8
2 files changed, 8 insertions, 2 deletions
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash
index 76f046eaae..bc1998c465 100755
--- a/share/spack/spack-completion.bash
+++ b/share/spack/spack-completion.bash
@@ -1177,7 +1177,7 @@ _spack_find() {
}
_spack_gc() {
- SPACK_COMPREPLY="-h --help -y --yes-to-all"
+ SPACK_COMPREPLY="-h --help -E --except-any-environment -e --except-environment -b --keep-build-dependencies -y --yes-to-all"
}
_spack_gpg() {
diff --git a/share/spack/spack-completion.fish b/share/spack/spack-completion.fish
index 7f4446706a..2b3edaa5a4 100755
--- a/share/spack/spack-completion.fish
+++ b/share/spack/spack-completion.fish
@@ -1747,9 +1747,15 @@ complete -c spack -n '__fish_spack_using_command find' -l end-date -r -f -a end_
complete -c spack -n '__fish_spack_using_command find' -l end-date -r -d 'latest date of installation [YYYY-MM-DD]'
# spack gc
-set -g __fish_spack_optspecs_spack_gc h/help y/yes-to-all
+set -g __fish_spack_optspecs_spack_gc h/help E/except-any-environment e/except-environment= b/keep-build-dependencies y/yes-to-all
complete -c spack -n '__fish_spack_using_command gc' -s h -l help -f -a help
complete -c spack -n '__fish_spack_using_command gc' -s h -l help -d 'show this help message and exit'
+complete -c spack -n '__fish_spack_using_command gc' -s E -l except-any-environment -f -a except_any_environment
+complete -c spack -n '__fish_spack_using_command gc' -s E -l except-any-environment -d 'remove everything unless needed by an environment'
+complete -c spack -n '__fish_spack_using_command gc' -s e -l except-environment -r -f -a except_environment
+complete -c spack -n '__fish_spack_using_command gc' -s e -l except-environment -r -d 'remove everything unless needed by specified environment'
+complete -c spack -n '__fish_spack_using_command gc' -s b -l keep-build-dependencies -f -a keep_build_dependencies
+complete -c spack -n '__fish_spack_using_command gc' -s b -l keep-build-dependencies -d 'do not remove installed build-only dependencies of roots'
complete -c spack -n '__fish_spack_using_command gc' -s y -l yes-to-all -f -a yes_to_all
complete -c spack -n '__fish_spack_using_command gc' -s y -l yes-to-all -d 'assume "yes" is the answer to every confirmation request'