Commit Graph

7831 Commits

Author SHA1 Message Date
Tamara Dahlgren
8ec1369d2b
unit tests: use mock_packages for 'spack [info|list|style]' tests (#50309) 2025-05-06 07:35:26 +02:00
Harmen Stoppels
1527e9703d
builder.py: check is_package_module for v2 support (#50298) 2025-05-05 14:08:58 +02:00
Harmen Stoppels
2b4f2daa73
package API v2.0: new repo layout (#49256)
This implements Package API v2.0, and is an opt-in feature for repos. It can be enabled with

```yaml
repo:
  ...
  api: v2.0
```

It differs from the current default v1.0 as follows:

1. Package names can only contain `-` as a separator.
2. Package names can only be lowercase.
3. Package directory names are valid Python module names.
4. The repo namespace and its directory name are the same.
5. The `packages` subdir, which is configurable, should be a directory
   name that is also a valid Python module name.
6. There is a one to one mapping between Spack package names and Python
   module names.
7. Import statements `import spack.pkg.namespace.package_module` in
   `package.py` files need to specify the canonical package module.

To go from Spack package name to Python module name:
- Replace `-` by `_`
- Add a leading `_` if the package name starts with a digit

To go from Python module name to Spack package name:
- Strip leading `_`
- Replace `_` by `-`.
2025-05-05 10:52:16 +02:00
Harmen Stoppels
02501bc4af
lang.py: make HashableMap generic, and use in Spec (#50229) 2025-05-05 10:45:11 +02:00
psakiev
b0541cb5d5 Remove Philter 2025-04-30 17:23:22 -06:00
psakievich
ca40480908
Merge branch 'develop' into psakiev/f/git-version-refactor 2025-04-30 17:22:23 -06:00
psakiev
72cf35aeab Fix tests and test reuse 2025-04-30 17:17:08 -06: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
psakievich
7b68d31143
Update packages.py 2025-04-08 21:07:37 -06:00
psakievich
4e29975eed
Update core.py 2025-04-08 21:07:31 -06:00
psakiev
434541b408 Disable failing tests 2025-04-08 20:19:06 -06:00
psakiev
24c32b6183 Style and fixes 2025-04-08 17:24:33 -06:00
Philip Sakievich
f85329e792 Ideas for facts that will close the loop 2025-04-08 16:07:23 -06:00
Philip Sakievich
9dc57d2864 WIP: More rules 2025-04-08 16:05:58 -06:00
Philip Sakievich
b5456c0fa7 Rework concretizer rules still not passing 2025-04-08 16:04:59 -06:00
Philip Sakievich
f61001d94d Style 2025-04-08 16:04:43 -06:00
Philip Sakievich
ebd5b2203c Revert random style changes 2025-04-08 16:04:43 -06:00
Philip Sakievich
820cf473cc Fix problem 2025-04-08 16:04:43 -06:00
Philip Sakievich
1d441c1a7a Rework test 2025-04-08 16:04:13 -06:00
Philip Sakievich
1d6662abfb New test on version satisfaction 2025-04-08 16:00:57 -06:00
psakiev
dc1b0662d9 Add package tests 2025-04-08 15:56:10 -06:00
psakiev
a5f0ba5692 Add lookup check tests 2025-04-08 15:56:10 -06:00
Philip Sakievich
b4269ff8f1 WIP: refactor test 2025-04-08 15:56:10 -06:00
Philip Sakievich
128bf5c52d Review fixes 2025-04-08 15:56:07 -06:00
Philip Sakievich
c0e4d2e3cf First new unit test passes 2025-04-08 15:54:48 -06:00
Philip Sakievich
5a2182af3f Fix lp constraint 2025-04-08 15:54:48 -06:00
Philip Sakievich
9224994dad Attempt to add solver constraint 2025-04-08 15:54:48 -06:00
Philip Sakievich
eda744718e Write tests and stub out core changes 2025-04-08 15:54:48 -06:00
Philip Sakievich
0dcc164346 Add unit-tests to verify requirements 2025-04-08 15:54:48 -06:00
Philip Sakievich
d94892493b Add additional reserved variants 2025-04-08 15:54:47 -06:00
Philip Sakievich
65ea51d800 Fix tests 2025-04-08 15:54:47 -06:00
Philip Sakievich
9b328772a6 Handler for overlapping attributes 2025-04-08 15:53:37 -06:00
Philip Sakievich
c713c5567f Add a more specific function for shas 2025-04-08 15:53:37 -06:00
Philip Sakievich
c512512b49 Fix commit check 2025-04-08 15:52:48 -06:00
Philip Sakievich
2fafba4395 Add package class hook for SNL work 2025-04-08 15:52:45 -06:00
Philip Sakievich
9c575ef310 Have fetcher respect the commit variant
Ensure that if a commit variant is on the spec fetch operations
use the commit
2025-04-08 15:51:06 -06:00
Philip Sakievich
011da2d44a dev_path and commit mutually exclusive 2025-04-08 15:51:06 -06:00
Philip Sakievich
f070163a37 Add version attribute restrictions for commit variant 2025-04-08 15:51:06 -06:00
Philip Sakievich
1199b1ef99 Add tests 2025-04-08 15:51:03 -06:00
Philip Sakievich
251af651c9 commit variant concretizes and check is commit 2025-04-08 15:49:42 -06:00
psakievich
0b81a52476 Update lib/spack/spack/spec.py 2025-04-08 15:47:12 -06:00
psakievich
3daf5d0e8d Update lib/spack/spack/spec.py 2025-04-08 15:47:12 -06:00
psakiev
9ed45eebcd Style fixes 2025-04-08 15:47:12 -06:00
psakiev
8fd5f573b1 Convert internal members to new names 2025-04-08 15:47:12 -06:00
psakiev
b56d7e028f Define components for GitVersion provenance
Adding binary provenance requires we track the commit.
Typically this has been an optional form for the encompassing git ref.
Moving towards always defining a commit means we need to have space
to store a user requested ref that will then be paired with a commit
sha.
2025-04-08 15:47:12 -06: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