Files
spack/lib
Todd Gamblin f85f50d64e configuration: remove platform-specific scopes
Spack has historically allowed a platform-specific subdirectory
for each configuration scope. e.g., in Spack's own defaults we use this
for platform-specific overrides:

```
spack/etc/spack/
    packages.yaml
spack/etc/spack/linux/
    packages.yaml
spack/etc/spack/darwin/
    packages.yaml
```

This adds specialized `packages.yaml` overrides for linux and darwin.

In #48784, we added a much more general facility for an `include:`
section in configuration, so you can add your own much more specialized
config directories.  This PR addresses a couple issues with that, namely:

1. We still hard-code the platform includes in Spack
2. Platform includes are at *higher* precedence than the including scope,
   while `include:` includes are lower. This makes it impossible for
   something like:

   ```yaml
   include:
      - include: "${os}"
   ```

   to override the linux subdirectory in a config scope.

This PR removes the older platform-specific config scopes in favor of
allowing users to add their own such scopes if they need them.  So,
if you want platform configuration, you can add this to the scope
that needs it:

   ```yaml
   include:
      - include: "${platform}"
   ```

If you want platform to have lower precedence than OS, you can do this:

   ```yaml
   include:
      - include: "${os}"
   include:
      - include: "${platform}"
   ```

And now OS config can override platform. Likewise, you could reverse the
list and have platofrm with higher precedence than OS.

- [x] remove `_add_platform_scope() from `config`
- [x] refactor default config scope to account for new structure
- [ ] TBD: docs

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2025-05-21 16:39:58 -07:00
..