diff options
author | Peter Scheibel <scheibel1@llnl.gov> | 2022-03-18 17:07:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-18 17:07:22 -0700 |
commit | 531b1c5c3dcc9bc7bec27e223608aed477e94dbd (patch) | |
tree | f25a6f7873e1f3a37daacdcb755c4ce5ecdc0dde /share | |
parent | be0d611dc18d2eeb560d3e345488892635940ad9 (diff) | |
download | spack-531b1c5c3dcc9bc7bec27e223608aed477e94dbd.tar.gz spack-531b1c5c3dcc9bc7bec27e223608aed477e94dbd.tar.bz2 spack-531b1c5c3dcc9bc7bec27e223608aed477e94dbd.tar.xz spack-531b1c5c3dcc9bc7bec27e223608aed477e94dbd.zip |
Add command for reading a json-based DB description (#24894)
Adds `spack external read-cray-manifest`, which reads a json file that describes a set of package DAGs. The parsed results are stored directly in the database. A user can see these installed specs with `spack find` (like any installed spec). The easiest way to use them right now as dependencies is to run `spack spec ... ^/hash-of-external-package`.
Changes include:
* `spack external read-cray-manifest --file <path/to/file>` will add all specs described in the file to Spack's installation DB and will also install described compilers to the compilers configuration (the expected format of the file is described in this PR as well including examples of the file)
* Database records now may include an "origin" (the command added in this PR registers the origin as "external-db"). In the future, it is assumed users may want to be able to treat installs registered with this command differently (e.g. they may want to uninstall all specs added with this command)
* Hash properties are now always preserved when copying specs if the source spec is concrete
* I don't think the hashes of installed-and-concrete specs should change and this was the easiest way to handle that
* also specs that are concrete preserve their `.normal` property when copied (external specs may mention compilers that are not registered, and without this change they would fail in `normalize` when calling `validate_or_raise`)
* it might be this should only be the case if the spec was installed
- [x] Improve testing
- [x] Specifically mark DB records added with this command (so that users can do something like "uninstall all packages added with `spack read-external-db`)
* This is now possible with `spack uninstall --all --origin=external-db` (this will remove all specs added from manifest files)
- [x] Strip variants that are listed in json entries but don't actually exist for the package
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
Diffstat (limited to 'share')
-rwxr-xr-x | share/spack/spack-completion.bash | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 9e4586abbb..7bbb3ba211 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -1017,7 +1017,7 @@ _spack_external() { then SPACK_COMPREPLY="-h --help" else - SPACK_COMPREPLY="find list" + SPACK_COMPREPLY="find list read-cray-manifest" fi } @@ -1034,6 +1034,10 @@ _spack_external_list() { SPACK_COMPREPLY="-h --help" } +_spack_external_read_cray_manifest() { + SPACK_COMPREPLY="-h --help --file --directory --dry-run" +} + _spack_fetch() { if $list_options then @@ -1791,7 +1795,7 @@ _spack_undevelop() { _spack_uninstall() { if $list_options then - SPACK_COMPREPLY="-h --help -f --force -R --dependents -y --yes-to-all -a --all" + SPACK_COMPREPLY="-h --help -f --force -R --dependents -y --yes-to-all -a --all --origin" else _installed_packages fi |