spack/share/spack
Massimiliano Culpo f8538a1b1c
Parse % as ^ in specs (#49808)
This PR modifies the parser, so that `%` is parsed as a `DEPENDENCY`, and all
node properties that follow are associated to the name after the `%`. e.g.,
in `foo %gcc +binutils` the `+binutils` refers to `gcc` and not to `foo`.

`%` is still parsed as a build-type dependency, at the moment.

Environments, config files and `package.py` files from before Spack v1.0 may have
spec strings with package variants, targets, etc. *after* a build dependency, and these
will need to be updated. You can use the `spack style --spec-strings` command to do this.

To see what strings will be parsed differently under Spack v1.0, run:

```
spack style --spec-strings FILES
```

where `FILES` is a list of filenames that may contain old specs. To update these spec
strings so that they parse correctly under both Spack 1.0 and Spack 0.x, you can run:

```
spack style --fix --spec-strings FILES
```

In the example above, `foo %gcc +binutils` would be rewritten as `foo +binutils %gcc`,
which parses the same in any Spack version.

In addition, this PR fixes several issues with `%` dependencies:

- [x] Ensure we can still constrain compilers on reuse
- [x] Ensure we can reuse a compiler by hash
- [x] Add tests

---------

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-05-14 16:17:34 -06:00
..
bash Remove years from license headers (#48352) 2025-01-02 15:40:28 +01:00
bootstrap Move %compiler last in static spec strings (#49438) 2025-03-12 19:41:43 +01:00
csh Remove years from license headers (#48352) 2025-01-02 15:40:28 +01:00
docker Remove years from license headers (#48352) 2025-01-02 15:40:28 +01:00
docs/docker/module-file-tutorial Remove years from license headers (#48352) 2025-01-02 15:40:28 +01:00
fish Remove years from license headers (#48352) 2025-01-02 15:40:28 +01:00
gitlab/cloud_pipelines ci: recalibrate per-package resource requests (#50406) 2025-05-13 09:28:11 -05:00
keys update tutorial command for v0.18.0 and new gpg key (#30904) 2022-05-28 02:36:20 +00:00
logo
qa repo.py: enable search paths when spack.repo.PATH is assigned (#50370) 2025-05-08 13:42:20 +02:00
templates Don't inject import statements in package recipes 2024-12-05 12:48:00 -08:00
setup-env.bat Normalize Spack Win entry points (#38648) 2024-10-25 15:23:29 -04:00
setup-env.csh setup-env.csh: Harden for people who like aliases (#49670) 2025-03-25 09:01:28 -07:00
setup-env.fish Fix setup.fish syntax (#49176) 2025-02-25 07:11:55 -06:00
setup-env.ps1 Remove years from license headers (#48352) 2025-01-02 15:40:28 +01:00
setup-env.sh Remove years from license headers (#48352) 2025-01-02 15:40:28 +01:00
setup-tutorial-env.sh Remove years from license headers (#48352) 2025-01-02 15:40:28 +01:00
spack-completion.bash binary_distribution: content addressable tarballs (#48713) 2025-05-06 12:32:15 -06:00
spack-completion.fish Parse % as ^ in specs (#49808) 2025-05-14 16:17:34 -06:00