diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2020-10-24 16:48:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-24 16:48:04 -0700 |
commit | 01953dc5134643995db0f769eddab8868b62b1ae (patch) | |
tree | 18c7c97c18ed2ba0785590eabef367551f4337b7 /.gitignore | |
parent | 6752a39629be9fb9362e35ffdcce9bcb5cf40f2d (diff) | |
download | spack-01953dc5134643995db0f769eddab8868b62b1ae.tar.gz spack-01953dc5134643995db0f769eddab8868b62b1ae.tar.bz2 spack-01953dc5134643995db0f769eddab8868b62b1ae.tar.xz spack-01953dc5134643995db0f769eddab8868b62b1ae.zip |
bugfix: fix config merge order for OrderdDicts (#18482)
The logic in `config.py` merges lists correctly so that list elements
from higher-precedence config files come first, but the way we merge
`dict` elements reverses the precedence.
Since `mirrors.yaml` relies on `OrderedDict` for precedence, this bug
causes mirrors in lower-precedence config scopes to be checked before
higher-precedence scopes.
We should probably convert `mirrors.yaml` to use a list at some point,
but in the meantie here's a fix for `OrderedDict`.
- [x] ensuring that keys are ordered correctly in `OrderedDict` by
re-inserting keys from the destination `dict` after adding the keys from
the source `dict`.
- [x] also simplify the logic in `merge_yaml` by always reinserting
common keys -- this preserves mark information without all the special
cases, and makes it simpler to preserve insertion order.
Assuming a default spack configuration, if we run this:
```console
$ spack mirror add foo https://bar.com
```
Results before this change:
```console
$ spack config blame mirrors
--- mirrors:
/Users/gamblin2/src/spack/etc/spack/defaults/mirrors.yaml:2 spack-public: https://spack-llnl-mirror.s3-us-west-2.amazonaws.com/
/Users/gamblin2/.spack/mirrors.yaml:2 foo: https://bar.com
```
Results after:
```console
$ spack config blame mirrors
--- mirrors:
/Users/gamblin2/.spack/mirrors.yaml:2 foo: https://bar.com
/Users/gamblin2/src/spack/etc/spack/defaults/mirrors.yaml:2 spack-public: https://spack-llnl-mirror.s3-us-west-2.amazonaws.com/
```
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions