Commit Graph

7788 Commits

Author SHA1 Message Date
Harmen Stoppels
02501bc4af
lang.py: make HashableMap generic, and use in Spec (#50229) 2025-05-05 10:45:11 +02:00
Greg Becker
b42ef1e7b8
spack solve: respect unify:false config (#50243)
----------

Signed-off-by: Gregory Becker <becker33@llnl.gov>
2025-04-30 21:51:19 +00:00
Wouter Deconinck
b9b7450f60
Revert "XorgPackage, glx: conflicts windows and darwin (#50216)" (#50231)
This reverts commit 382847976f.
2025-04-29 14:09:40 +00:00
Harmen Stoppels
a6b0dfbd53
package_base.py: use sys.modules for module lookup (#50230) 2025-04-29 10:53:30 +00:00
Massimiliano Culpo
ecc3752ee9
fix %compiler satisfaction with specs v4 format (#50140)
This PR improves compatibility with specs installed before #45189, and with externals specifying a compiler, by using the annotated compiler to "satisfy" a spec query.

On top of that, the PR adds a new flag for:
```console
$ spack find --specfile-format -I %gcc
-- linux-ubuntu20.04-icelake / gcc@10.5.0 -----------------------
[+]  [v4] ca-certificates-mozilla@2023-05-30  [e]  [v4] cmake@3.31.6  [+]  [v4] gcc-runtime@10.5.0  [e]  [v4] glibc@2.31  [+]  [v4] gmake@4.4.1  [+]  [v4] hdf5@1.14.5  [+]  [v4] pkgconf@2.2.0  [+]  [v4] zlib-ng@2.2.1
==> 8 installed packages
```
which shows the specfile format of the specs being retrieved.
2025-04-29 10:09:49 +02:00
Wouter Deconinck
382847976f
XorgPackage, glx: conflicts windows and darwin (#50216)
* XorgPackage: conflicts windows and darwin

* xorg: import conflicts

* xorg: fix style

* glx: conflicts windows and darwin
2025-04-28 15:33:02 -05:00
Massimiliano Culpo
3df5a85237
input_analysis.py: fix conditional requirements (#50194)
Fixes a logic bug where a -> b was assumed to imply not a -> not b
in conditional requirements.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-25 09:44:05 +02:00
Peter Scheibel
a3c430e810
CompilerAdaptor: add support for opt_flags/debug_flags (#50126) 2025-04-24 07:08:54 +02:00
Alec Scott
41ff0500f9
Add ls alias to spack {compiler, external} (#50189) 2025-04-24 05:08:20 +00:00
Adam J. Stewart
3f063ace1d
Add type hints to all setup_*environment functions (#49985) 2025-04-23 15:41:22 +02:00
Ryan Krattiger
3fd6066e54
ci: copy logs from failed job stage dir (#49884) 2025-04-22 23:23:49 +02:00
Stephen Nicholas Swatman
6085586407
oneapi: Move temporary home directory to stage (#50160)
When trying to use Spack to build Intel TBB on the EOS network file
system we use at CERN, I am facing the following error:

```
Launching the installer...
Installation directory is not empty.
The product cannot be installed into nonempty directory
'/eos/home-s/sswatman/spack/opt/spack/linux-x86_64_v2/...
    intel-oneapi-tbb-2021.12.0-3jlx6hlr3z6di42f3qy35eizcse7u2tk'.
```

This error appears to happen because Spack tries to set `$HOME` to the
prefix of the package, into which the Intel installer is also trying to
install it's software. I've found that an easy fix is to set `$HOME` to
a directory in the build stage instead, as this can be guaranteed to
remain empty.
2025-04-22 15:47:30 +00:00
Harmen Stoppels
31c5c0b423
directives_meta.py: remove global decl (#50162)
silence flake8
2025-04-22 17:08:14 +02:00
Harmen Stoppels
60f6f8d836
python.py/r.py: fix type issues with classproperty/constant (#50059) 2025-04-22 09:53:34 +02:00
Joe
d39382bec8
Env vars docs (#49346) 2025-04-21 18:59:01 -06:00
Wouter Deconinck
18eebce04d
external: list licensing in init summary (#46042) 2025-04-18 21:28:23 -06:00
Peter Scheibel
e78d9d93dd
c23 standard typo (#50101) 2025-04-17 10:20:40 -04:00
Massimiliano Culpo
be492e1ed7
solver: encode % as "build requirement", not as "dependency" (take 2) (#50104)
reland 8fc1ccc686

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-17 15:25:02 +02:00
Alec Scott
986102ab7a
Revert "solver: encode % as "build requirement", not as "dependency" (#50011)" (#50092)
This reverts commit 8fc1ccc686.

conflicts("%gcc@:11", when="@2.17:")
conflicts("%gcc", when="+ompt")

regressed.
2025-04-17 08:45:29 +02:00
Massimiliano Culpo
04f6881b76
Environment: remove leftover code to attach test deps (#50097)
This should not be needed anymore after #49405

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-17 07:55:32 +02:00
Harmen Stoppels
883bbf3826
variants: fix narrowing multi -> single -> bool (#49880)
* `x=*` constrained by `+x` now produces a boolean valued variant instead of a multi-valued variant.
   
* Values are now always stored as a tuple internally, whether bool, single or multi-valued. 

* Value assignment has a stricter api to prevent ambiguity / type issues related to 
   `variant.value = "x"` / `variant.value = ["x"]` / `variant.value = ("x",)`. It's now `variant.set("x", ...)` for 
   single and multi-valued variants.

* The `_original_value` prop is dropped, since it was unused.

* The wildcard `*` is no longer a possible variant value in any type of variant, since the *parser*
   deals with it and creates a variant with no values.
2025-04-16 09:44:38 +02:00
Harmen Stoppels
1dc9bac745
detection/common.py: catch is_file() inside loop (#50042) 2025-04-16 09:40:14 +02:00
Harmen Stoppels
dbd3895cbf
version_types.py: Version -> Union[StandardVersion, GitVersion] (#50061) 2025-04-16 09:15:13 +02:00
John W. Parent
4a7508c9df
Update make/nmake invocations (mostly Windows) (#49022)
The second change technically affects non-Windows, but the
behavior should be exactly the same:

* Packages no longer have access to `.msbuild` and `.nmake`
  automatically; they now get them via a dependency on `msvc`.
* Update two CMake-based packages that call `make test` to
  instead call `ctest` (`netcdf-cxx4` and `pegtl`).
  CMake-based packages should do this because on Windows
  `make test` will not generally work, but `ctest` does.
* Fix `openssl` "make test" on Windows (WRT prior point: not
  a CMake-based package).
2025-04-15 14:44:25 -06:00
Harmen Stoppels
ebef5f75fb
util/environment.py: allow PurePath for path modifiers and improve file/lineno of warnings (#50038) 2025-04-14 14:52:12 +02:00
Massimiliano Culpo
25beeef865
Environment: separate parsing concerns from SpecList (#49973)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-14 11:22:13 +02:00
dependabot[bot]
7794d51adb
build(deps): bump urllib3 from 2.3.0 to 2.4.0 in /lib/spack/docs (#50014)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.3.0...2.4.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-14 10:07:24 +02:00
Harmen Stoppels
cc3d40d9d3
fetch_strategy.py: show progress (#50003)
Show progress meter for fetches when `stdout` is a `tty`.

* fetch_strategy.py: show progress
* "Fetched: x MB at y MB/s"
* add tests, show % if content-length
2025-04-11 12:39:42 -07:00
Massimiliano Culpo
8fc1ccc686
solver: encode % as "build requirement", not as "dependency" (#50011)
This PR fixes the issues with `%` and reused specs, due to https://github.com/spack/spack/issues/49847#issuecomment-2774640234 

It does so by adding another layer of indirection, so that whenever a spec
`foo %bar` is encountered, the `%bar` part is encoded as an
`attr("build_requirement", ...)`.

Then:

1. If `foo` is a node to be built, then the build requirement implies a dependency
2. Otherwise it implies looking e.g. reused specs metadata, and ensure it matches

---------

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-11 11:09:21 -07:00
Harmen Stoppels
fd1b982073
solver: dump output specs to file if not satisfied (#50019)
When the solver produces specs that do not satisfy the input
constraints, dump both input and output specs as json in an temporary
dir and ask the user to upload these files in a bug report.
2025-04-11 19:01:27 +02:00
Harmen Stoppels
fd31f7e014
spec.py: remove exceptions of old concretizer (#50018) 2025-04-11 15:52:11 +02:00
Scott Wittenburg
23d7305efd
buildcache: Remove deprecated commands and arguments (#49999) 2025-04-10 09:42:01 +02:00
psakievich
252ceeedbe
spack develop: avoid deprecated package_class (#49997) 2025-04-10 09:40:16 +02:00
Harmen Stoppels
84dcc654ec
util/environment.py: require string values in env mods (#49987) 2025-04-09 19:29:47 +02:00
John W. Parent
d2dd4e96d9
Windows: add env name to prompts (#48819) 2025-04-08 14:16:39 -07:00
Harmen Stoppels
8ffd6c29bf
gcc/oneapi: inject runtime iff language virtual (#49956)
Currently we inject runtimes when a package has a direct build dep on a
compiler, but what matters is whether the package depends on a language.

That way we can avoid recursion of injecting runtimes to runtimes
without a rule in the solver: runtimes don't depend on languages, they
just have a build dep on the same compiler.
2025-04-08 19:51:16 +02:00
Massimiliano Culpo
129338c4c9
Group together all concretization unit test (#49960)
In this way, to run them, we just need to run:

spack unit-test lib/spack/spack/test/concretization

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-08 17:27:17 +02:00
Harmen Stoppels
e7b009e350
asp.py: reduce verbosity of "preferences" comment (#49954) 2025-04-08 15:17:21 +02:00
dependabot[bot]
cfbc92c2f0
build(deps): bump flake8 from 7.1.2 to 7.2.0 in /lib/spack/docs (#49816)
Bumps [flake8](https://github.com/pycqa/flake8) from 7.1.2 to 7.2.0.
- [Commits](https://github.com/pycqa/flake8/compare/7.1.2...7.2.0)

---
updated-dependencies:
- dependency-name: flake8
  dependency-version: 7.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-07 09:49:58 -07:00
Massimiliano Culpo
081e4c463b
compilers: add .stdcxx_libs to the compiler adaptor (#49873)
This property is used by a few recipes, including `cp2k` under
certain configurations

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-07 15:39:13 +02:00
Harmen Stoppels
e5ec08771b
docs: editor support config files (#49935) 2025-04-07 15:35:21 +02:00
Massimiliano Culpo
7e6a216d33
spack test run: add a --timeout argument (#49839)
* TestSuite: add type hints
* spack test run: add a --timeout argument
* pipelines: allow 2 minutes to run tests
* Fix docstrings, increase maximum pipelines time for tests to 5 mins.
* Use SIGTERM first, SIGKILL shortly after
* Add unit-tests for "start_build_process"

---------

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-04 15:48:48 -07:00
Massimiliano Culpo
b2f8cd22c3
Update the "missing attribute in recipe" message (#49874)
Multiple build systems have been part of Spack for a long
time now, and they are rarely the cause of a missing attribute.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-04 10:38:38 -07:00
Harmen Stoppels
3ea92b1983
conditional: fix value type (#49882) 2025-04-04 15:31:44 +02:00
Harmen Stoppels
522fa9dc62
test/variant.py: fix broken test (#49879) 2025-04-04 11:13:50 +02:00
Caetano Melone
65ec330af5
fix: intel compiler alias intel-typo (#49870)
This typo was causing issues when concretizing specs with "%intel"
2025-04-04 08:51:48 +02:00
Harmen Stoppels
6bfe83106d
Concrete multi-valued variants (#49756)
Similar to the range-or-specific-version ambiguity of `@1.2` in the past,
which was solved with `@1.2` vs `@=1.2` we still have the ambiguity of
`name=a,b,c` in multi-valued variants. Do they mean "at least a,b,c" or
"exactly a,b,c"?

This issue comes up in for example `gcc languages=c,cxx`; there's no
way to exclude `fortran`.

The ambiguity is resolved with syntax `:=` to distinguish concrete from
abstract.

The following strings parse as **concrete** variants:

* `name:=a,b,c` => values exactly {a, b, c}
* `name:=a` => values exactly {a}
* `+name` => values exactly {True}
* `~name` => values exactly {False}

The following strings parse as **abstract** variants:

* `name=a,b,c` values at least {a, b, c}
* `name=*` special case for testing existence of a variant; values are at
  least the empty set {}

As a reminder

* `satisfies(lhs, rhs)` means `concretizations(lhs)` ⊆ `concretizations(rhs)`
* `intersects(lhs, rhs)` means `concretizations(lhs)` ∩ `concretizations(rhs)` ≠ ∅

where `concretizations(...)` is the set of sets of variant values in this case.

The satisfies semantics are:

* rhs abstract: rhs values is a subset of lhs values (whether lhs is abstract or concrete)
* lhs concrete, rhs concrete: set equality
* lhs abstract, rhs concrete: false

and intersects should mean

* lhs and rhs abstract: true (the union is a valid concretization under both)
* lhs or rhs abstract: true iff the abstract variant's values are a subset of the concrete one
* lhs concrete, rhs concrete: set equality

Concrete specs with single-valued variants are printed `+foo`, `~foo` and `foo=bar`;
only multi-valued variants are printed with `foo:=bar,baz` to reduce the visual noise.
2025-04-04 04:47:43 +00:00
Massimiliano Culpo
b1ac661ba8
Simplify a few methods in environments (#49682)
Return a single scope from environment.env_config_scope
Return a single scope from environment_path_scope

---------

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-03 18:19:04 +02:00
Greg Becker
63b437ddf9
py-black: add v24.4.0 -> 25.1.0 (#49814)
Signed-off-by: Gregory Becker <becker33@llnl.gov>
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
2025-04-03 16:48:18 +02:00
Harmen Stoppels
751c79872f
variant.py: make Variant.default is str | bool | tuple[str] (#49836)
Warn if variant default is not among those types
2025-04-03 11:07:08 +00:00
Massimiliano Culpo
5c71d36330
compiler-wrapper: set SPACK_COMPILER_EXTRA_RPATHS (#49828)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-03 11:23:08 +02:00
Massimiliano Culpo
62ee56e8a3
docs: remove leftover references to compiler: entries (#49824)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-02 09:33:23 +02:00
Massimiliano Culpo
01471aee6b
solver: don't use tags to compute injected deps (#49723)
This commit reorders ASP setup, so that rules from
possible compilers are collected first.

This allows us to know the dependencies that may be
injected before counting the possible dependencies,
so we can account for them too.

Proceeding this way makes it easier to inject
complex runtimes, like hip.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-04-02 09:32:25 +02:00
Harmen Stoppels
0facab231f
spec.py: more virtuals=... type hints (#49753)
Deal with the "issue" that passing a str instance does not cause a
type check failure, because str is a subset of Sequence[str] and
Iterable[str]. Instead fix it by special casing the str instance.
2025-04-02 00:05:00 -07:00
Greg Becker
ca64050f6a
config:url_fetch_method: allow curl args (#49712)
Signed-off-by: Gregory Becker <becker33@llnl.gov>
2025-04-01 15:23:28 -05:00
John W. Parent
93220f706e
concretizer cache: disable due to broken cleanup (#49470)
Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
2025-04-01 15:38:56 +02:00
Harmen Stoppels
a257747cba
test/spec_semantics.py: more fixes (#49821) 2025-04-01 09:14:26 +02:00
Tamara Dahlgren
748c7e5420
Documentation: remote URL inclusion updates (#49669) 2025-04-01 09:02:50 +02:00
Harmen Stoppels
95927df455
test/spec_semantics.py: split a test into multiple ones, test only necessary bits (#49806) 2025-03-31 17:08:36 +00:00
Tara Drwenski
0f64f1baec
CachedCMakePackage: Improve finding mpiexec for non-slurm machines (#49033)
* Check for LSF, FLux, and Slurm when determing MPI exec

* Make scheduler/MPI exec helper functions methods of CachedCMakeBuilder

* Remove axom workaround for running mpi on machines with flux
2025-03-31 09:11:09 -07:00
Harmen Stoppels
46f7737626
xfail -> skipif platform specific tests on other platforms (#49800) 2025-03-31 16:32:26 +02:00
Adrien Bernede
22c38e5975
Update hip support for Cached CMake Packages (#49635)
* Clearly split old and new hip settings requirements
* Apply generic rocm handling to every project
* make default logic for hip support more robust
* GPU_TARGET is only necessary under certain project specific conditions, it should not be necessary in general
* Update logic to find amdclang++
2025-03-28 18:38:45 -07:00
Massimiliano Culpo
10f309273a
Do not error when trying to convert corrupted compiler entries (#49759)
fixes #49717

If no compiler is listed in the 'packages' section of
the configuration, Spack will currently try to:
1. Look for a legacy compilers.yaml to convert
2. Look for compilers in PATH

in that order. If an entry in compilers.yaml is
corrupted, that should not result in an obscure
error.

Instead, it should just be skipped.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-03-28 13:14:12 -06:00
Harmen Stoppels
35a84f02fa
variant.py: reserved names is a set (#49762) 2025-03-28 08:17:04 -07:00
Harmen Stoppels
4b02ecddf4
variant.py: use spack.error the normal way (#49763)
This module references `spack.error.Something` in the same file, which happens to
work but is incorrect. Use `spack.error` to prevent that in the future.
2025-03-28 14:12:45 +00:00
Todd Gamblin
3444d40ae2
bugfix: pure cxx and fortran deps should display with a compiler. (#49752)
I noticed that `abseil-cpp` was showing in `spack find` with "no compiler", and the only
difference between it and other nodes was that it *only* depends on `cxx` -- others
depend on `c` as well.

It turns out that the `select()` method on `EdgeMap` only takes `Sequence[str]` and doesn't
check whether they're actually just one `str`.  So asking for, e.g., `cxx` is like asking for
`c` or `x` or `x`, as the `str` is treated like a sequence. This causes Spack to miss `cxx`
and `fortran` language virtuals in `DeprecatedCompilerSpec`.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2025-03-28 10:18:18 +01:00
Harmen Stoppels
3c4f23f64a
Fix import urllib.request (#49699) 2025-03-28 10:15:33 +01:00
Todd Gamblin
52a995a95c
UI: Color external packages differently from installed packages (#49751)
Currently, externals show up in `spack find` and `spack spec` install status as a green
`[e]`, which is hard to distinguish from the green [+] used for installed packages.

- [x] Make externals magenta instead, so they stand out.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2025-03-28 00:37:56 -07:00
Massimiliano Culpo
a6c22f2690
Update documentation after compiler as deps (#49715) 2025-03-27 11:19:35 +01:00
Massimiliano Culpo
4894668ece
Remove "classic" Intel packages (#45188) 2025-03-27 10:13:33 +01:00
Todd Gamblin
199133fca4
bugfix: concretization shouldn't require concrete packages to be known (#49706)
Concretization setup was checking whether any input spec has a dependency
that's *not* in the set of possible dependencies for all roots in the solve.
There are two reasons to check this:

1. The user could be asking for a dependency that none of the roots has, or
2. The user could be asking for a dependency that doesn't exist.

For abstract roots, (2) implies (1), and the check makes sense.  For concrete
roots, we don't care, because the spec has already been built. If a `package.py`
no longer depends on something it did before, it doesn't matter -- it's already
built. If the dependency no longer exists, we also do not care -- we already
built it and there's an installation for it somewhere. 

When you concretize an environment with a lockfile, *many* of the input specs
are concrete, and we don't need to build them. If a package changes its
dependencies, or if a `package.py` is removed for a concrete input spec, that
shouldn't cause an already-built environment to fail concretization.

A user reported that this was happening with an error like:

```console
spack concretize
==> Error: Package chapel does not depend on py-protobuf@5.28.2/a4rf4glr2tntfwsz6myzwmlk5iu25t74
```

Or, with traceback:
```console
  File "/apps/other/spack-devel/lib/spack/spack/solver/asp.py", line 3014, in setup
    raise spack.spec.InvalidDependencyError(spec.name, missing_deps)
spack.spec.InvalidDependencyError: Package chapel does not depend on py-protobuf@5.28.2/a4rf4glr2tntfwsz6myzwmlk5iu25t74
```

Fix this by skipping the check for concrete input specs. We already ignore conflicts,
etc. for concrete/external specs, and we do not need metadata in the solve for
concrete dependencies b/c they're imposed by hash constraints.

- [x] Ignore the package existence check for concrete input specs.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2025-03-26 23:58:12 +00:00
Alec Scott
ea3a3b51a0
ci: Skip removed packages during automatic checksum verification (#49681)
* Skip packages removed for automatic checksum verification

* Unify finding modified or added packages with spack.repo logic

* Remove unused imports

* Fix unit-tests using shared modified function

* Update last remaining unit test to new format
2025-03-26 16:47:11 -07:00
Todd Gamblin
2d2a4d1908
bugfix: display old-style compilers without @= in spack find output (#49693)
* bugfix: display old-style compilers without `@=` in `spack find` output

Fix `display_str` attribute of `DeprecatedCompiler` so that `spack find` displays
compilers without `@=` for the version (as expected).

- [x] Use `spec.format("{@version}")` to do this

before:
```
> spack find
-- darwin-sequoia-m1 / apple-clang@=16.0.0 -----------------------
abseil-cpp@20240722.0               py-graphviz@0.13.2
apple-libuuid@1353.100.2            py-hatch-fancy-pypi-readme@23.1.0
```

after:
```
> spack find
-- darwin-sequoia-m1 / apple-clang@16.0.0 -----------------------
abseil-cpp@20240722.0               py-graphviz@0.13.2
apple-libuuid@1353.100.2            py-hatch-fancy-pypi-readme@23.1.0
```

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>

* [@spackbot] updating style on behalf of tgamblin

---------

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2025-03-26 10:34:05 -07:00
Massimiliano Culpo
5b3942a489
Turn compilers into nodes (#45189)
## Summary

Compilers stop being a *node attribute*, and become a *build-only* dependency. 

Packages may declare a dependency on the `c`, `cxx`, or `fortran` languages, which
are now treated as virtuals, and compilers would be *providers* for one or more of
those languages. Compilers can also inject runtime dependency, on the node being
compiled. An example graph for something as simple as `zlib-ng` is the following:

<p align="center">
<img src="https://github.com/user-attachments/assets/ee6471cb-09fd-4127-9f16-b9fe6d1338ac" alt="zlib-ng DAG" width="80%" height="auto">
</p>

Here `gcc` is used for both the `c`, and `cxx` languages. Edges are annotated with
the virtuals they satisfy (`c`, `cxx`, `libc`). `gcc` injects `gcc-runtime` on the nodes
being compiled. `glibc` is also injected for packages that require `c`. The
`compiler-wrapper` is explicitly represented as a node in the DAG, and is included in
the hash.

This change in the model has implications on the semantics of the `%` sigil, as
discussed in #44379, and requires a version bump for our `Specfile`, `Database`,
and `Lockfile` formats.

## Breaking changes

Breaking changes below may impact users of this branch.

### 1. Custom, non-numeric version of compilers are not supported

Currently, users can assign to compilers any custom version they want, and Spack
will try to recover the "real version" whenever the custom version fails some operation.
To deduce the "real version" Spack must run the compiler, which can add needless
overhead to common operations.

Since any information that a version like `gcc@foo` might give to the user, can also
be suffixed while retaining the correct numeric version, e.g. `gcc@10.5.0-foo`, Spack
will **not try** anymore to deduce real versions for compilers.

Said otherwise, users should have no expectation that `gcc@foo` behaves as
`gcc@X.Y.Z` internally.

### 2. The `%` sigil in the spec syntax means "direct build dependency"

The `%` sigil in the spec syntax means *"direct build dependency"*, and is not a node
attribute anymore. This means that:

```python
node.satisfies("%gcc")
``` 
is true only if `gcc` is a direct build dependency of the node. *Nodes without a compiler
dependency are allowed.*

### `parent["child"]`, and `node in spec`, will now only inspect the link/run sub-DAG
and direct build dependencies

The subscript notation for `Spec`:

```python
parent["child"]
```

will look for a `child` node only in the link/run transitive graph of `parent`, and in its
direct build dependencies. This means that to reach a transitive build dependency,
we must first pass through the node it is associated with. 

Assuming `parent` does not depend on `cmake`, but depends on a `CMakePackage`,
e.g. `hdf5`, then we have the following situation:

```python
# This one raises an Exception, since "parent" does not depend on cmake
parent["cmake"]
# This one is ok
cmake = parent["hdf5"]["cmake"]
```

### 3. Externals differing by just the compiler attribute

Externals are nodes where dependencies are trimmed, and that _is not planned to
change_ in this branch. Currently, on `develop` it is ok to write:

```yaml
packages:
  hdf5:
    externals:
    - spec: hdf5@1.12 %gcc
      prefix: /prefix/gcc
    - spec: hdf5@1.12 %clang
      prefix: /prefix/clang
```
and Spack will account for the compiler node attribute when computing the optimal
spec. In this branch, using externals with a compiler specified is allowed only if any
compiler in the dag matches the constraints specified on the external. _The external
will be still represented as a single node without dependencies_.

### 4. Spec matrices enforcing a compiler

Currently we can have matrices of the form:

```yaml
matrix:
- [x, y, z]
- [%gcc, %clang]
```
to get the cross-product of specs and compilers. We can disregard the nature of the
packages in the first row, since the compiler is a node attribute required on each node.

In this branch, instead, we require a spec to depend on `c`, `cxx`, or `fortran` for the
`%` to have any meaning. If any of the specs in the first row doesn't depend on these
languages, there will be a concretization error. 

## Deprecations

* The entire `compilers` section in the configuration (i.e., `compilers.yaml`) has been
  deprecated, and current entries will be removed in v1.2.0. For the time being, if Spack
  finds any `compilers` configuration, it will try to convert it automatically to a set of
  external packages.
* The `packages:compiler` soft-preference has been deprecated. It will be removed
  in v1.1.0.

## Other notable changes

* The tokens `{compiler}`, `{compiler.version}`, and `{compiler.name}` in `Spec.format`
  expand to `"none"` if a Spec does not depend on C, C++, or Fortran.
* The default install tree layout is now
  `"{architecture.platform}-{architecture.target}/{name}-{version}-{hash}"`

## Known limitations

The major known limitations of this branch that we intend to fix before v1.0 is that compilers
cannot be bootstrapped directly. 

In this branch we can build a new compiler using an existing external compiler, for instance:
	
```
$ spack install gcc@14 %gcc@10.5.0
```

where `gcc@10.5.0` is external, and `gcc@14` is to be built.

What we can't do at the moment is use a yet to be built compiler, and expect it will be
bootstrapped, e.g. :

```
spack install hdf5 %gcc@14
```

We plan to tackle this issue in a following PR.

---------

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2025-03-25 22:32:49 -06:00
Todd Gamblin
f42f59c84b
concretizer: don't use clingo.Symbol for setup (#49650)
Since we moved from creating clingo symbols directly to constructing a pure string
representation of the program, we don't need to make `AspFunctions` into symbols before
turning them into strings. We can just write strings like clingo would.

This cuts about 25% off the setup time by avoiding an unnecessary round trip.

- [x] create strings directly from `AspFunctions`
- [x] remove unused `symbol()` method on `AspFunction`
- [x] setup no longer tries to call `symbol()`

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Signed-off-by: Greg Becker <becker33@llnl.gov>

---------

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Co-authored-by: Greg Becker <becker33@llnl.gov>
2025-03-25 17:55:27 -07:00
psakievich
0158fc46aa
Add recursive argument to spack develop (#46885)
* Add recursive argument to spack develop

This effort allows for a recursive develop call
which will traverse from the develop spec given back to the root(s)
and mark all packages along the path as develop.

If people are doing development across the graph then paying
fetch and full rebuild costs every time spack develop is called
is unnecessary and expensive.

Also remove the constraint for concrete specs and simply take the
max(version) if a version is not given. This should default to the
highest infinity version which is also the logical best guess for
doing development.
2025-03-24 16:50:16 -07:00
psakievich
5d0b5ed73c
EnvironmentModifications: fix reverse prepend/append (#49645)
pop a single item from front / back resp. instead of remove all instances
2025-03-24 17:29:27 +01:00
Ryan Krattiger
151af13be2
Unit tests: error message when running parallel without xdist (#49632) 2025-03-24 09:25:45 -07:00
Greg Becker
5983f72439
fix extendee_spec for transitive dependencies on potential extendees (#48025)
* fix extendee_spec for transitive dependencies on potential extendees

* regression test

* resolve conditional extensions on direct deps

* remove outdated comment

Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>

---------

Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
2025-03-21 08:27:51 -07:00
psakievich
f2d830cd4c
Get env_var mods from config (#49626) 2025-03-20 21:48:50 -05:00
Alec Scott
c79b6207e8
ci: add automatic checksum verification check (#45063)
Add a CI check to automatically verify the checksums of newly added
package versions:
    - [x] a new command, `spack ci verify-versions`
    - [x] a GitHub actions check to run the command
    - [x] tests for the new command

This also eliminates the suggestion for maintainers to manually verify added
checksums in the case of accidental version <--> checksum mismatches.

----

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2025-03-20 22:58:14 +01:00
Harmen Stoppels
a0ad02c247
solver: improve error message when single-valued variant cannot be satisfied (#49583) 2025-03-19 19:44:45 +01:00
germanne
a8584d5eb4
asp.py: abs_control_files shouldn't ask for write rights (#49591) 2025-03-19 15:19:40 +01:00
Harmen Stoppels
5016084213
Move default implementation of pkg.command to PackageBase (#49580) 2025-03-19 09:28:29 +00:00
Massimiliano Culpo
5a04e84097
solver: allow prefer and conflict on virtuals in packages config (#45017) 2025-03-19 09:53:05 +01:00
Harmen Stoppels
ecf414ed07
docs: add strong preferences to faq (#49556) 2025-03-19 08:53:14 +01:00
Adrien Bernede
9dada76d34
Update hip support in radiuss packages leveraging blt@0.7.0 (#49488)
Co-authored-by: Chris White <white238@llnl.gov>
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-03-19 07:36:52 +01:00
Harmen Stoppels
bff4fa2761
spec.py: include test deps in dag hash, remove process_hash (take two) (#49505)
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2025-03-17 08:47:09 +01:00
Massimiliano Culpo
a574a995f8
converge: remove package (#49499)
The package was added in 2017, and never updated
substantially. It requires users to login into
a platform to download code.

Thus, instead of updating to new versions, and add
support for OneAPI, remove the package.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-03-17 08:46:32 +01:00
Harmen Stoppels
f82de718cd
Revert "spec.py: include test deps in dag hash, remove process_hash (#48936)" (#49503)
This reverts commit 2806ed2751.
2025-03-15 22:56:03 +01:00
Todd Gamblin
4f6836c878
bugfix: Scopes shouldn't dynamically maintain include lists (#49494)
Fixes #49403.

When one scope included another, we were appending to a list stored on the scope to
track what was included, and we would clear the list when the scope was removed.

This assumes that the scopes are always strictly pushed then popped, but the order can
be violated when serializing config scopes across processes (and then activating
environments in subprocesses), or if, e.g., instead of removing each scope we simply
cleared the list of config scopes. Removal can be skipped, which can cause the list of
includes on a cached scope (like the one we use for environments) to grow every time it
is pushed, and this triggers an assertion error.

There isn't actually a need to construct and destroy the include list. We can just
compute it once and cache it -- it's the same every time.

- [x] Cache included scope list on scope objects
- [x] Do not dynamically append/clear the included scope list

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2025-03-15 13:21:36 -07:00
Harmen Stoppels
2806ed2751
spec.py: include test deps in dag hash, remove process_hash (#48936) 2025-03-15 13:12:51 -07:00
Ryan Krattiger
f32b5e572a
ci: remove --keep-stage flag (#49467)
logs are now copied from the install dir
2025-03-15 09:41:25 +01:00
Asa
e35c5ec104
module generation: make package tags accessible in template (#48213) 2025-03-14 15:08:14 -07:00
Harmen Stoppels
60be77f761
spack style --spec-strings: fix non-str constant issue (#49492) 2025-03-14 21:54:02 +01:00
John W. Parent
69b7c32b5d
MSVC: Restore amalgamated compiler functionality (#46678)
Right now the Spack %msvc compiler is inherently a hybrid compiler
that uses Intel's oneAPI fortran compiler.

This was addressed in Spacks MSVC compiler class, but detection has
since stopped using the compiler class, so this PR moves the logic
into the `msvc` compiler package (does not delete the original code
because that is handled in #45189).

This includes a change to the general detection logic to deprioritize
paths that include a symlink anywhere in the path, in order to prefer
"2025.0/bin" over "latest/bin" for the oneAPI compiler.
2025-03-14 13:36:41 -07:00
Harmen Stoppels
87926e40a9
style.py: add spack style --spec-strings for compat with v1.0 (#49485)
* style.py: add spack style --spec-strings for compat with v1.0

* add --fix also, and avoid infinite recursion and too large files

* tests: check identify and check edit files
2025-03-14 19:10:39 +00:00
Harmen Stoppels
11f52ce2f6
Warn when %compiler precedes +variant (#49410) 2025-03-13 10:45:09 +01:00
Tamara Dahlgren
d518aaa4c9
path and remote_file_cache: support windows paths (#49437)
Windows paths with drives were being interpreted as network protocols
in canonicalize_path (which was expanded to handle more general URLs
in #48784).

This fixes that and adds some tests for it.
2025-03-12 22:28:37 +00:00
Harmen Stoppels
f89a2ada4c
Move %compiler last in static spec strings (#49438) 2025-03-12 19:41:43 +01:00