Commit Graph

7769 Commits

Author SHA1 Message Date
Tamara Dahlgren
ae9cffe55f
test/bootstrap.py: test_bootstrap_search_for_compilers_with* use mock packages path (#50441) 2025-05-13 14:31:13 +02:00
Harmen Stoppels
c5eb82fcb0
pkg.spec.package is pkg after deserialization (#50449) 2025-05-13 12:08:13 +02:00
Massimiliano Culpo
a938167a22
Add a prefix when we import vendored modules (#50443)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2025-05-13 07:20:40 +02:00
Massimiliano Culpo
acd47147a5
solver: support concrete multivalued variants (#50325)
The solves now supports key:=val syntax for multivalued variants in specs originating from input, externals, requirements, directives and when conditions

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-05-09 23:08:21 +02:00
Harmen Stoppels
3ed6736b2c
compiler.py: be more defensive (#50403) 2025-05-09 16:58:52 +00:00
Massimiliano Culpo
842954f6a4
solver: treat external nodes as concrete for optimization purposes (#50165)
This PR is a step towards treating externals as concrete specs. Specifically, it moves the optimization weights of external nodes into the group of "reused" specs, and doesn't count externals as specs to be built. 

It still keeps the one to many mapping between an external spec in `packages.yaml` and the corresponding specs in the DB. To make it such that an hashed external is preferred to a non-hashed one, the version weights of externals are demoted at lowest priority.

**Change in behavior**:
- Having the possibility, Spack will now prefer to mix compilers in a DAG, and use the latest version possible for each node, rather than using a single compiler and employ old versions of some nodes because of conflicts
- In general, using externals by default is now triggered by putting their weights in the "reused" group. This means that any penalty they might induce will never have the same priority as something that needs to be built. This behavior reflects reality, but changes some default choices from the previous state.

Modifications:
- External nodes weights are now moved to the group of "reused" specs
- Runtimes are treated as concrete as well (to avoid that e.g.`gcc` is not selected because it "builds" the runtime package)
- Shuffle version weights, so that externals are least preferred (counterbalanced by the fact that they are in the "reused" groups)
- Split provider weights on edges from version badness on edges

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-05-09 17:41:16 +02:00
Tamara Dahlgren
a505fb1f37
unit tests: switch TestSpecList to use mock packages (#50353) 2025-05-09 07:45:49 +02:00
Scott Wittenburg
03cb30cb96
binary_distribution: Do not look in sub-mirrors when indexing (#50389)
When indexing top level specs, eg, in s3://spack-binaries/develop,
do not sync manifests from all the stacks.  Instead, add the path
to the spec manifests to the url to sync, so that only items in
s3://spack-binaries/develop/v3/manifests/spec are copied to the
local system.
2025-05-08 17:25:35 -06:00
Scott Wittenburg
f6da037129
binary_distribution: Handle fetch error during rebuild-index (#50387)
Allow rebuild-index to continue if fetching some specs fails
for any reason, and issue a warning indicating which manifest
is associated with the failed fetch.
2025-05-08 13:54:43 -06:00
jgraciahlrs
1a379215da
Allow usage of config variables and env variables with include_concrete (#45871)
* Allow usage of spack config vars in concrete env path
* Update docs on usage of spack config vars in concrete env path
2025-05-08 14:23:02 -05:00
Harmen Stoppels
b0b316c646
builtin: add a few missing __init__.py (#50374) 2025-05-08 18:45:09 +02:00
Harmen Stoppels
a95fa26857
docs/comments: fix typo with wildcard import (#50379) 2025-05-08 18:37:45 +02:00
Harmen Stoppels
98c08ce5c6
repo.py: enable search paths when spack.repo.PATH is assigned (#50370)
Fixes a bug where `custom_repo.get_pkg_class("foo")` failed executing `import spack_repo.builtin` even if the builtin repo was configured globally.

Instead of assignment of `spack.repo.PATH`, the `spack.repo.enable_repo` function now assigns and enables the repo, meaning that also Python module search paths are modified.
2025-05-08 13:42:20 +02:00
Tamara Dahlgren
59339be48f
test/cmd/find.py: switch to use mock_packages (#50358) 2025-05-08 08:33:56 +02:00
Harmen Stoppels
21d8c09c5e
builtin: fix various type/correctness issues (#50340) 2025-05-07 15:45:15 +02:00
Tamara Dahlgren
0b4477c0df
test/cmd/unit_test: have test_list_with* ignore missing repo warning (#50332) 2025-05-07 09:06:34 +02:00
Tamara Dahlgren
eff4c14a09
test/providers: switch to mock packages (#50333) 2025-05-07 09:04:06 +02:00
Tamara Dahlgren
f485a622c8
test/cmd/maintainers.py: cleanup of mock_packages use (#50334) 2025-05-07 09:03:00 +02:00
Tamara Dahlgren
f151bc65f7
test/env: switch to mock packages (#50335) 2025-05-07 09:02:10 +02:00
Tamara Dahlgren
99d849b2e6
test/spec_semantics: add mock_packages to test_intersects_and_satisfies (#50336) 2025-05-07 08:59:16 +02:00
Tamara Dahlgren
c88e7bc492
test/ci.py: remove redundant mock_packages fixture use (#50331) 2025-05-07 08:09:14 +02:00
Tamara Dahlgren
931d034da4
test/patch.py: switch tests to use mock_packages (#50337) 2025-05-07 08:07:11 +02:00
Scott Wittenburg
2c05ce3607
binary_distribution: content addressable tarballs (#48713)
binary_distribution: content addressable url buildcache

Change how binary mirrors are laid out, adopting content addressing for every
piece of data spack stores in a binary mirror. Items (e.g. tarballs, specfiles, public
keys, indices, etc) are now discoverable via manifest files which give the size,
checksum, compression type, etc of the the stored item. The information in the
manifest, in turn, is used to find the actual data, which is stored by its content
address in the blobs directory. Additionally, signing is now applied to the manifest
files, rather than to the spec files themselves.
2025-05-06 12:32:15 -06:00
Harmen Stoppels
b932c14008
builtin: use api v2.0 and update dir structure (#49275)
* Bump the package API of the `builtin` repo to `v2.0`
* Move `var/spack/repos/builtin` -> `var/spack/repos/spack_repo/builtin`
* Move test repos `var/spack/repos/{builtin.mock,tutorial,...}` -> `var/spack/test_repos/`
* Update package dir names to v2 format (`-` -> `_` etc)
* Change absolute imports `from spack.pkg.builtin.my_pkg ...` to relative imports `from ..my_pkg.package ...`

Users who have a repo on top of builtin should change imports from

```python
from spack.pkg.builtin.my_pkg import MyPkg
```

to

```python
from spack_repo.builtin.packages.my_pkg.package import MyPkg
```

and can configure their editors with

```
PYTHONPATH=$spack/lib/spack:$spack/var/spack/repos
```

[skip-verify-checksums]
2025-05-06 12:05:44 +02:00
Tamara Dahlgren
3de68ef976
unit tests: switch test/cmd/config.py to mock packages (#50313) 2025-05-06 08:14:32 +02:00
Tamara Dahlgren
5c7fe24bec
unit tests: change test_config_audits to use mock_packages, add mock openssl (#50308) 2025-05-06 08:10:11 +02:00
Tamara Dahlgren
ecb122f4c1
unit tests: switch test/cmd/versions to mock packages (#50315) 2025-05-06 08:08:38 +02:00
Tamara Dahlgren
6219780691
unit tests: test_concretization_cache_roundtrip use mock_packages (#50314) 2025-05-06 08:06:44 +02:00
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
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