diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2022-01-17 09:59:40 -0800 |
---|---|---|
committer | Greg Becker <becker33@llnl.gov> | 2022-02-16 10:17:18 -0800 |
commit | a2b8e0c3e9b4b2a9f18f14c0cec1dd99b598d1c7 (patch) | |
tree | 2f8109f2cd9f39084a8df5492fff7262344f9b96 /LICENSE-APACHE | |
parent | f155de7462d7863fa9b89e4303f37c0edafa8125 (diff) | |
download | spack-a2b8e0c3e9b4b2a9f18f14c0cec1dd99b598d1c7.tar.gz spack-a2b8e0c3e9b4b2a9f18f14c0cec1dd99b598d1c7.tar.bz2 spack-a2b8e0c3e9b4b2a9f18f14c0cec1dd99b598d1c7.tar.xz spack-a2b8e0c3e9b4b2a9f18f14c0cec1dd99b598d1c7.zip |
commands: refactor `--reuse` handling to use config
`--reuse` was previously handled individually by each command that
needed it. We are growing more concretization options, and they'll
need their own section for commands that support them.
Now there are two concretization options:
* `--reuse`: Attempt to reuse packages from installs and buildcaches.
* `--fresh`: Opposite of reuse -- traditional spack install.
To handle thes, this PR adds a `ConfigSetAction` for `argparse`, so
that you can write argparse code like this:
```
subgroup.add_argument(
'--reuse', action=ConfigSetAction, dest="concretizer:reuse",
const=True, default=None,
help='reuse installed dependencies/buildcaches when possible'
)
```
With this, you don't need to add logic to pull the argument out and
handle it; the `ConfigSetAction` just does it for you. This can probably
be used to clean up some other commands later, as well.
Code that was previously passing `reuse=True` around everywhere has
been refactored to use config, and config is set from the CLI using
a new `add_concretizer_args()` function in `spack.cmd.common.arguments`.
- [x] Add `ConfigSetAction` to simplify concretizer config on the CLI
- [x] Refactor code so that it does not pass `reuse=True` to every function.
- [x] Refactor commands to use `add_concretizer_args()` and to pass
concretizer config using the config system.
Diffstat (limited to 'LICENSE-APACHE')
0 files changed, 0 insertions, 0 deletions