Commit Graph

7687 Commits

Author SHA1 Message Date
Adrien Bernede
7328c64fc7
CachedCMakePackage: set CMAKE_*_RPATH with implicit and extra rpaths (#48067)
This is useful when CachedCMakePackage is used without the Spack compiler wrapper.
2025-01-08 04:18:44 -07:00
Massimiliano Culpo
4be7b98fd2
Perl build system: add a dependency on gmake (#48437) 2025-01-08 09:10:22 +01:00
Harmen Stoppels
ca8ea63796
compiler.py: deal with temporarily broken compiler (#48418)
When a compiler is temporarily broken, we cache `c_compiler_output:`
`null`. This commit ensures we retry to obtain the `c_compiler_output`.
2025-01-07 09:56:05 +01:00
Lehman Garrison
aa0ab3b38b
py-py-spy: add 0.4.0, and make rust & CargoPackage respect -j (#47883)
* py-py-spy: add 0.4.0

* py-py-spy: port from Package to CargoPackage

* CargoPackage: respect make_jobs

* rust: respect make_jobs during build and install

* spack style

* CargoBuilder: fix make_jobs syntax

* CargoBuilder: don't write to $HOME, use stage dir
2025-01-06 12:14:19 -07:00
Massimiliano Culpo
85c125a0f5
Remove spack.config.add_default_platform_scope (#48425)
This function is used only in tests, and pushes a scope to the
current global CONFIG, when on Windows, regardless of what that
CONFIG is.
2025-01-06 20:06:02 +01:00
Harmen Stoppels
4b4be2e2c2
cmd/__init__.py: pass tests in case n=1 (#48417) 2025-01-06 15:30:29 +01:00
Harmen Stoppels
79027884c7
Add spack API warning with file/line (#48416) 2025-01-06 03:43:04 -07:00
Adam J. Stewart
0a03a92e78
Avoid trailing slashes in strings (#48359) 2025-01-03 23:00:18 +01:00
Harmen Stoppels
0a070512e6
tests: remove file requirement (#48362) 2025-01-03 15:49:06 +01:00
Wouter Deconinck
e374f8fb66
build_environment: only traverse unique edges (#48301)
Wrap EnvironmentVisitor in CoverEdgesVisitor so only unique edges are enqueued.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2025-01-03 12:17:26 +01:00
Todd Gamblin
f635337af8
Remove years from license headers (#48352) 2025-01-02 15:40:28 +01:00
Alec Scott
022ae8503a oxide-rs: new-package 2025-01-02 01:17:37 -08:00
Massimiliano Culpo
71512f5682
mpich: gather in a single place env modifications needed by mpich derivatives (#48276)
* mpich: gather in a single place env modifications needed by mpich derivatives

MPICH, and its derivatives, share a lot of copy/paste code to setup the
environment during the different stages of the package life-cycle.

This commit gathers the common modifications in a single place (a mixin class),
living in the Mpich package, and makes derivatives import, and reuse, it.

* Fix docs for Python < 3.13
2024-12-30 15:42:16 -07:00
dependabot[bot]
15124d7c73
build(deps): bump urllib3 from 2.2.3 to 2.3.0 in /lib/spack/docs (#48278)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.3 to 2.3.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.2.3...2.3.0)

---
updated-dependencies:
- dependency-name: urllib3
  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>
2024-12-26 09:03:38 -07:00
psakievich
78bd905fe0
Ensure command_line scope is always last (#48255) 2024-12-25 14:32:31 -07:00
Harmen Stoppels
e9cdcc4af0
build caches: collect files to relocate while tarballing w/o file (#48212)
A few changes to tarball creation (for build caches):
- do not run file to distinguish binary from text
- file is slow, even when running it in a batched fashion -- it usually reads all bytes and has slow logic to categorize specific types
- we don't need a highly detailed file categorization; a crude categorization of elf, mach-o, text suffices.
detecting elf and mach-o is straightforward and cheap
- detecting utf-8 (and with that ascii) is highly accurate: false positive rate decays exponentially as file size increases. Further it's not only the most common encoding, but the most common file type in package prefixes.
iso-8859-1 is cheaply (but heuristically) detected too, and sufficiently accurate after binaries and utf-8 files are classified earlier
- remove file as a dependency of Spack in general, which makes Spack itself easier to install
- detect file type and need to relocate as part of creating the tarball, which is more cache friendly and thus faster
2024-12-24 10:53:13 -07:00
Wouter Deconinck
c65a0e03c4
doc: ensure getting_started has bootstrap list output in correct place (#48281) 2024-12-24 04:48:02 -07:00
Massimiliano Culpo
a3322459fe
bootstrap mirror: fix references from v0.4 to v0.6 (#48235) 2024-12-23 14:06:48 +01:00
jnhealy2
6de1ebd71a
Fix silent error when reporting builds to CDash (#47939)
* Fix silent error when reporting builds to CDash
   CDash has a 191 char maximum for build names.  When this
   is exceeded, CDash silently fails to correctly process the
   reported XML. This truncates CDash build names to 190 chars
   and emits a warning indicating it is doing so to prevent
   such errors from occuring.
* test/reporters.py: add unittest for buildname len issue
* test/reporters.py: rename cdash buildname test
* ci/common.py: fix syntax causing breaking test
   It appears that the CDash reporter is expecting a string
   as the buildname.
* Update lib/spack/spack/reporters/cdash.py
   Fix warning message to reflect actual issue.
   Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
* ci/common.py: fix function call to actually call function

---------

Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
Co-authored-by: psakievich <psakiev@sandia.gov>
2024-12-19 14:19:44 -07:00
dependabot[bot]
ec7436be6b
build(deps): bump sphinxcontrib-programoutput in /lib/spack/docs (#47992)
Bumps [sphinxcontrib-programoutput](https://github.com/NextThought/sphinxcontrib-programoutput) from 0.17 to 0.18.
- [Changelog](https://github.com/OpenNTI/sphinxcontrib-programoutput/blob/master/CHANGES.rst)
- [Commits](https://github.com/NextThought/sphinxcontrib-programoutput/compare/0.17...0.18)

---
updated-dependencies:
- dependency-name: sphinxcontrib-programoutput
  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>
2024-12-19 12:08:20 +01:00
Harmen Stoppels
96a0b0eb08
llnl.util.lang: remove testing literal backtrace output (#48209) 2024-12-19 11:55:41 +01:00
Harmen Stoppels
0850e0bf08
docs: advertise --oci-username-variable and --oci-password-variable (#48189) 2024-12-19 10:15:01 +01:00
Wouter Deconinck
8e163c3565
qmake: docs about virtual provider (#48055) 2024-12-18 17:16:30 -08:00
Todd Gamblin
30e2b15eea
Use Literal now that we have typing_extensions in Spack. (#48172)
Improve our typing by updating some todo locations in the code to use
`Literal` instead of a simple `str`.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-18 14:10:14 +01:00
psakievich
0894180cc1
Add more functionality to the stage cmd (#46498)
* Add more functionality to the stage cmd

* Completion commands

* completion again

* Add tests, but they are slow

* Stale comment
2024-12-17 15:07:29 -08:00
kwryankrattiger
dfb529fc6e
Ci set concretiztion pool size (#48077)
* Set the "build_jobs" on concretization/generate for CI

build_jobs also controls the concretization pool size. Set this
in the config section for CI generate.

This config is overwritten by build_job CI using the SPACK_BUILD_JOBS
environment variable. This implicitly will drop the default build
CPU request on all "default" grouped build jobs from (max) 16 to 8.

* Add default allocations for build jobs

* Add common jobs and concretize args to ci generate and rebuild

* CI: Specify parallel concretize and build jobs via argument

* Increase power and cray concretization limits

Lowering limits for these stacks creates timeout

* Increase default pool size to 8

intermittent timeouts with 4 CPU

* Add reduced requests for windows for now
2024-12-17 12:05:15 -06:00
Todd Gamblin
6e2625ae65 package_base: generify accessor methods for when-keyed dictionaries
This turns some variant-specific methods for dealing with when-keyed dictionaries into
more generic versions, in preparation for conditional version definitions.

`_by_name`, `_names`, etc. are replaced with generic methods for transforming
when-keyed dictionaries:
 * `_by_subkey()`
 * `_subkeys()`
 * `_num_definitions()`
 * `_definitions()`
 * `_remove_overridden_defs()`

And the variant accessors are refactored to use these methods underneath.

To do this, types like `WhenDict` had to be generified, and some `TypeVars`
were added for sortable keys and values.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-17 07:25:14 -08:00
Todd Gamblin
7f24b11675 Vendor typing_extensions
We are using more and more typing features in Spack, and without features like
protocols, typing core is becoming harder and harder.

I think it's worth vendoring `typing_extensions` for this. It will get us a number of
useful capabilities:

* `Literal`
* `TypedDict`
* `Protocol`

among others.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-17 07:25:14 -08:00
Harmen Stoppels
19734832eb
resolve_shared_libraries.py: exclude libanl.so from glibc (#48139) 2024-12-17 11:33:36 +01:00
Harmen Stoppels
06eae96ef9
config:shared_linking:missing_library_policy to error/warn about accidental use of system libraries on linux/freebsd (#47365)
This commit adds a config option `config:shared_linking:missing_library_policy:error/warn/ignore` which will cause installation errors or warnings when ELF executables or libraries need shared libraries which cannot be resolved from RPATH search paths. The default is to ignore.

This is a safeguard against accidentally linking to system libraries instead of Spack libraries. It makes it more likely that build cache installs work on different machines. It works only at the level of libraries, not at the level of symbols. Some system dependencies are allowed (e.g. kernel and libc).

Packages can (but are discouraged to) set `unresolved_libraries` to a list of patterns of sonames/library names that are know to be unresolvable in RPATHs.  In the future this could be made more fine-grained in a non-breaking way by allowing a dictionary of patterns `lib => [deps]`.
2024-12-16 12:32:36 +01:00
Massimiliano Culpo
f6ab2f5b99
unit-test: port changes from compiler as deps (#48104)
Extracted #45189

Common test setup has been extracted in fixtures. Some matrix
dimensions moved from being "compiler" to be "targets".

Use --fake install for packages in test.
2024-12-16 09:27:41 +01:00
Todd Gamblin
0d0ff44e3e
Spec: Remove _normal attribute and unused constructor arguments (#48119)
The `_normal` attribute on specs is no longer used and has no meaning.
It's left over from part of the original concretizer.

The `concrete` constructor argument is also not used by any part of core.

- [x] remove `_normal` attribute from `Spec`
- [x] remove `concrete` argument from `Spec.__init__`
- [x] remove unused `check_diamond_normalized_dag` function in tests
- [x] simplify `Spec` constructor and docstrings

I tried to add typing to `Spec` here, but it creates a huge number of type issues
because *most* things on `Spec` are optional. We probably need separate `Spec` and
`ConcreteSpec` classes before attempting that.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-14 15:24:22 +01:00
Zack Galbreath
a16350df69
Fix typo in ci/README.md (#48114) 2024-12-14 06:22:46 -07:00
Harmen Stoppels
107e4515bd
tests: fix a few open(...) calls (#48113) 2024-12-13 21:38:48 +01:00
Massimiliano Culpo
af6526bb82
ga: add a pylint check to avoid adding open calls without encoding= (#48099) 2024-12-13 21:21:26 +01:00
Harmen Stoppels
a07e372770
filter_file: make tempfile later (#48108)
* filter_file: make tempfile later

* also add a `.` after the filename
2024-12-13 11:49:32 -07:00
Tamara Dahlgren
1c1d439a01
Circular import fix: spack.config -> spack.environment (#48057)
Fix by moving setup to spack.main
2024-12-13 18:44:08 +01:00
Harmen Stoppels
11b86ca75c
package_base.py: remove deprecated props (#48066) 2024-12-13 10:19:16 +01:00
kwryankrattiger
0c2b546825
Remove extraneous newline from reproducer output (#48076)
* Remove extraneous newline from reproducer output

* Convert print -> tty.info
2024-12-13 09:38:43 +01:00
kwryankrattiger
92dbb55703
Mkae Autotools build_system point at correct build_directory (#48072) 2024-12-12 15:58:18 -07:00
Harmen Stoppels
526af1cbe7
Sprinkle open(..., encoding=utf-8) (#48006)
Add missing encoding=utf-8 to various open calls. This makes
files like spec.json, spack.yaml, spack.lock, config.yaml etc locale
independent w.r.t. text encoding. In practice this is not often an
issue since Python 3.7, where the C locale is promoted to
C.UTF-8. But it's better to enforce UTF-8 explicitly, since there is
no guarantee text files are written in the right encoding.

Also avoid opening in text mode if it can be avoided.
2024-12-12 21:46:08 +01:00
Massimiliano Culpo
334a8b0991
ci: remove a custom implementation of a stdlib functionality (#48068) 2024-12-12 12:09:35 -08:00
Harmen Stoppels
9cd2f0a536
filter_file: fix various bugs (#48038)
* `f.tell` on a `TextIOWrapper` does not return the offset in bytes, but
  an opaque integer that can only be used for `f.seek` on the same
  object. Spack assumes it's a byte offset.
* Do not open in a locale dependent way, but assume utf-8 (and allow
  users to override that)
* Use tempfile to generate a backup/temporary file in a safe way
* Comparison between None and str is valid and on purpose.
2024-12-12 20:07:39 +01:00
Harmen Stoppels
687766b8ab
spec.parser / spec.token: improvements (#48063)
Follow-up to #47956 

* Rename `token.py` -> `tokenize.py`
* Rename `parser.py` -> `spec_parser.py`
* Move common code related to iterating over tokens into `tokenize.py`
* Add "unexpected character token" (i.e. `.`) to `SpecTokens` by default instead of having a separate tokenizer / regex.
2024-12-12 17:08:20 +01:00
Massimiliano Culpo
7105cc8c01
Make use of ^ in 'depends_on' an error (#48062)
The use of `^` in `depends_on` directives has never been allowed, since
the dawn of Spack.

Up to now, we used to have an audit to catch this kind of issue, mainly
because in that way we could easily collect all issues and report them
to packagers at once.

Due to implementation details, this audit doesn't work if a dependency
without a `^` is followed by the same dependency with a `^`.

This PR makes this pattern an error, which will be reported eagerly, and
removes the corresponding audit. It also fixes a package using the wrong
idiom.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2024-12-12 14:19:05 +01:00
Tamara Dahlgren
c548bcc9ef
Environment: remove self import (#48056) 2024-12-12 10:30:19 +01:00
Tamara Dahlgren
f018e0fe42
Circular import fix: spack.schema.config -> spack.config (#48059)
fix by moving `merge_yaml` from `config.py` to `schema/__init__.py`
2024-12-12 10:07:53 +01:00
Tamara Dahlgren
9aefbb0e96
Circular import fix: spack.oci.opener -> spack.parser (#47956)
by splitting spack.parser into two modules
2024-12-12 10:02:07 +01:00
Scott Wittenburg
de1416b3de
ci: Refactor pipeline generation (#47459)
Reorganize the pipeline generation aspect of the ci module,
mostly to separate the representation, generation, and
pruning of pipeline graphs from platform-specific output
formatting.

Introduce a pipeline generation registry to support generating
pipelines for other platforms, though gitlab is still the only
supported format currently.

Fix a long-existing bug in pipeline pruning where only direct
dependencies were added to any nodes dependency list.
2024-12-11 19:23:37 +00:00
Harmen Stoppels
e9d2732e00
log.py: improve utf-8 handling, and non-utf-8 output (#48005) 2024-12-11 10:54:17 +01:00
Harmen Stoppels
03525528d6
llnl.path: make system_path_filter a noop on non-win32 (#48032) 2024-12-11 10:51:06 +01:00
Scott Wittenburg
a3985e7538
Revert "Set the "build_jobs" on concretization/generate for CI (#47660)" (#48028)
This reverts commit 316dcc1609.
2024-12-11 07:56:36 +01:00
kwryankrattiger
316dcc1609
Set the "build_jobs" on concretization/generate for CI (#47660)
* Set the "build_jobs" on concretization/generate for CI

build_jobs also controls the concretization pool size. Set this
in the config section for CI generate.

This config is overwritten by build_job CI using the SPACK_BUILD_JOBS
environment variable. This implicitly will drop the default build
CPU request on all "default" grouped build jobs from (max) 16 to 8.

* Add default allocations for build jobs

* Add common jobs and concretize args to ci generate and rebuild

* CI: Specify parallel concretize and build jobs via argument

* Increase power and cray concretization limits

Lowering limits for these stacks creates timeout
2024-12-10 14:13:23 -07:00
Massimiliano Culpo
b50dbb8604
pipelines: simplify and lint aws-pcluster-* (#47989) 2024-12-10 12:16:51 +01:00
Tamara Dahlgren
466c3abaeb
Remove remaining use of deprecated test callback (#47995) 2024-12-10 08:19:56 +01:00
Harmen Stoppels
422f829e4e
mirrors: add missing init file (#47977) 2024-12-08 09:31:22 +01:00
Harmen Stoppels
05acd29f38
extensions.py: remove import of spack.cmd (#47963) 2024-12-07 10:08:04 +01:00
Harmen Stoppels
5c88e035f2
directives.py: remove redundant import (#47965) 2024-12-06 19:18:12 +01:00
Harmen Stoppels
94bd7b9afb
build_environment: drop off by one fix (#47960) 2024-12-06 17:01:46 +01:00
Massimiliano Culpo
112e47cc23 Don't inject import statements in package recipes
Remove a hack done by RepoLoader, which was injecting an extra
```
from spack.package import *
```
at the beginning of each package.py
2024-12-05 12:48:00 -08:00
Massimiliano Culpo
c1b2ac549d
solver: partition classes related to requirement parsing into their own file (#47915) 2024-12-05 18:10:06 +01:00
Harmen Stoppels
4693b323ac
spack.mirror: split into submodules (#47936) 2024-12-05 18:09:08 +01:00
Todd Gamblin
8b1009a4a0 resource: clean up arguments and typing
- [x] Clean up arguments on the `resource` directive.
- [x] Add type annotations
- [x] Add `resource` to type annotations on `PackageBase`
- [x] Fix up `resource` docstrings

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-04 22:49:18 -08:00
Todd Gamblin
f54526957a directives: add type annotations to DirectiveMeta class
Some of the class-level annotations were wrong, and some were missing. Annotate all the
functions here and fix the class properties to match what's actually happening.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-04 22:49:18 -08:00
Todd Gamblin
175a4bf101 directives: use Type[PackageBase] instead of PackageBase
The first argument to each Spack directive is not a `PackageBase` instance but a
`PackageBase` class object, so fix the type annotations to reflect this.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-04 22:49:18 -08:00
Todd Gamblin
aa81d59958 directives: don't include Optional in PatchesType
`Optional` shouldn't be part of `PatchesType` -- it's clearer to specify `Optional` it
in the methods that need their arguments to be optional.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-04 22:49:18 -08:00
Harmen Stoppels
f82554a39b
stage.py: improve path to url (#47898) 2024-12-04 09:41:38 +01:00
Carson Woods
a7eacd77e3
bug fix: updated warning message to reflect impending v1.0 release (#47887) 2024-12-03 17:16:36 +01:00
Harmen Stoppels
b31dd46ab8
style.py: do not remove import spack in packages (#47895) 2024-12-03 16:04:18 +01:00
dependabot[bot]
b9c60f96ea
build(deps): bump pytest from 8.3.3 to 8.3.4 in /lib/spack/docs (#47882)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.3.3 to 8.3.4.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/8.3.3...8.3.4)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-03 06:07:27 +01:00
Todd Gamblin
2a2d1989c1
version_types: clean up type hierarchy and add annotations (#47781)
In preparation for adding `when=` to `version()`, I'm cleaning up the types in
`version_types` and making sure the methods here pass `mypy` checks. This started as an
attempt to use `ConcreteVersion` outside of `spack.version` and grew into a larger type
refactor.

The hierarchy now looks like this:

* `VersionType`
  * `ConcreteVersion`
    * `StandardVersion`
    * `GitVersion`
  * `ClosedOpenRange`
  * `VersionList`

Note that the top-level thing can't easily be `Version` as that is a method and it
returns only `ConcreteVersion` right now. I *could* do something fancy with `__new__` to
make `Version` a synonym for the `ConcreteVersion` constructor, which would allow it to
be used as a type. I could also do something similar with `VersionRange` but not sure if
it's worth it just to make these into types.

There are still some places where I think `GitVersion` might not be handled properly,
but I have not attempted to fix those here.

- [x] Add a top-level `VersionType` class that all version types extend from
- [x] Define and document common methods and rich comparisons on `VersionType`
- [x] Replace complicated `Union` types with `VersionType` and `ConcreteVersion` as needed
- [x] Annotate most methods (skipping `__getitem__` and friends as the typing is a pain)
- [x] Fix up the `VersionList` constructor a bit
- [x] Add cases to methods that weren't handling all `VersionType`s
- [x] Rework some places to clarify typing for `mypy`
- [x] Simplify / optimize _next_version
- [x] Make StandardVersion.string a property to enable lazy comparison

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-30 08:21:07 +01:00
Harmen Stoppels
67d494fa0b
filesystem.py: remove unused md5sum (#47832) 2024-11-28 18:43:21 +01:00
Harmen Stoppels
e37e53cfe8
traverse: add MixedDepthVisitor, use in cmake (#47750)
This visitor accepts the sub-dag of all nodes and unique edges that have
deptype X directly from given roots, or deptype Y transitively for any
of the roots.
2024-11-28 17:48:48 +01:00
Harmen Stoppels
b74db341c8
darwin: preserve hardlinks on codesign/install_name_tool (#47808) 2024-11-28 14:57:28 +01:00
Harmen Stoppels
3194be2e92
gcc-runtime: remove libz.so from libgfortran.so if present (#47812) 2024-11-27 22:32:37 +01:00
kwryankrattiger
0b094f2473
Docs: Reference 7z requirement on Windows (#35943) 2024-11-26 17:11:12 -05:00
Dom Heinzeller
fdb9cf2412
Intel/oneapi compilers: correct version ranges for diab-disable flag (#47428)
* c/c++ flags should have been modified for all 2023.x.y versions, but
  upper bound was too low
* Fortran flags should have been modified for all 2024.x.y versions, but
  likewise the upper bound was too low
2024-11-26 12:34:37 -07:00
Harmen Stoppels
bf12bb57e7
install_test: first look at builder, then package (#47735) 2024-11-25 11:53:28 +01:00
Harmen Stoppels
cb3d6549c9
traverse.py: ensure topo order is bfs for trees (#47720) 2024-11-22 15:04:19 +01:00
Harmen Stoppels
aa2c18e4df
spack style: import-check -> import, fix bugs, exclude spack.pkg (#47690) 2024-11-20 16:15:28 +01:00
Mark Abraham
22690a7576
Make oneAPI library-with-sdk specialize library class (#47632) 2024-11-19 12:12:10 -05:00
Massimiliano Culpo
68aa712a3e
solver: add a timeout handle for users (#47661)
This PR adds a configuration setting to allow setting time limits for concretization.

For backward compatibility, the default is to set no time limit.
2024-11-19 15:00:26 +01:00
Massimiliano Culpo
f182032337
Restore message when concretizing in parallel (#47663)
It was lost in #44843
2024-11-19 12:28:14 +00:00
Richard Berger
73316c3e28
cached_cmake: mpifc is not always defined (#46861)
* cached_cmake: mpifc is not always defined
* mpich: only depend on fortran when +fortran
2024-11-18 14:49:56 -08:00
Massimiliano Culpo
da4f7c2952
Add an audit to prevent using the name "all" in packages (#47651)
Packages cannot be named like that, since we use "all" to indicate
default settings under the "packages" section of the configuration.
2024-11-17 13:32:24 -07:00
Harmen Stoppels
fdedb6f95d
style.py: add import-check for missing & redundant imports (#47619) 2024-11-17 09:18:48 +01:00
Harmen Stoppels
4d3b85c4d4
spack.package / builtin repo: fix exports/imports (#47617)
Add various missing imports in packages.
Remove redundant imports
Export NoLibrariesError, NoHeadersError, which_string in spack.package
2024-11-17 09:02:04 +01:00
dependabot[bot]
68b69aa9e3
build(deps): bump sphinx-rtd-theme in /lib/spack/docs (#47588)
Bumps [sphinx-rtd-theme](https://github.com/readthedocs/sphinx_rtd_theme) from 3.0.1 to 3.0.2.
- [Changelog](https://github.com/readthedocs/sphinx_rtd_theme/blob/master/docs/changelog.rst)
- [Commits](https://github.com/readthedocs/sphinx_rtd_theme/compare/3.0.1...3.0.2)

---
updated-dependencies:
- dependency-name: sphinx-rtd-theme
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-15 17:21:42 -06:00
Harmen Stoppels
66a93b5433
Add missing llnl.* imports (#47618) 2024-11-15 15:49:25 +01:00
Harmen Stoppels
b7993317ea
Improve type hints for package API (#47576)
by disentangling `package_base`, `builder` and `directives`.
2024-11-15 09:13:10 +01:00
Massimiliano Culpo
fb46c7a72d
Rework spack.database.InstallStatuses into a flag (#47321) 2024-11-14 15:43:31 +01:00
Massimiliano Culpo
c0196cde39
Remove support for PGI compilers (#47195) 2024-11-14 09:17:41 +01:00
Todd Gamblin
d091172d67
Spec: prefer a splice-specific method to __len__ (#47585)
Automatic splicing say `Spec` grow a `__len__` method but it's only used
in one place and it's not clear the semantics are useful elsewhere. It also
runs the risk of Specs one day being confused for other types of containers.

Rather than introduce a new function for one algorithm, let's use a more
specific method in the splice code.

- [x] Use topological ordering in `_resolve_automatic_splices` instead of 
      sorting by node count
- [x] delete `Spec.__len__()` and `Spec.__bool__()`

---------

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Co-authored-by: Greg Becker <becker33@llnl.gov>
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-11-13 23:20:03 -08:00
psakievich
ab51369087
Update tutorial version (#47593) 2024-11-14 08:15:11 +01:00
Todd Gamblin
6f948eb847
spack spec: simplify and unify output (#47574)
`spack spec` output has looked like this for a while:

```console
> spack spec /v5fn6xo /wd2p2v7
Input spec
--------------------------------
 -   /v5fn6xo

Concretized
--------------------------------
[+]  openssl@3.3.1%apple-clang@16.0.0~docs+shared build_system=generic certs=mozilla arch=darwin-sequoia-m1
[+]      ^ca-certificates-mozilla@2023-05-30%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1
...

Input spec
--------------------------------
 -   /wd2p2v7

Concretized
--------------------------------
[+]  py-six@1.16.0%apple-clang@16.0.0 build_system=python_pip arch=darwin-sequoia-m1
[+]      ^py-pip@23.1.2%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1
```

But the input spec is right there on the CLI, and it doesn't add anything to the output.
Also, since #44843, specs concretized in the CLI line can be unified, so it makes sense
to display them as we did in #44489 -- as one multi-root tree instead of as multiple
single-root trees.

With this PR, concretize output now looks like this:

```console
> spack spec /v5fn6xo /wd2p2v7
[+]  openssl@3.3.1%apple-clang@16.0.0~docs+shared build_system=generic certs=mozilla arch=darwin-sequoia-m1
[+]      ^ca-certificates-mozilla@2023-05-30%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1
[+]      ^gmake@4.4.1%apple-clang@16.0.0~guile build_system=generic arch=darwin-sequoia-m1
[+]      ^perl@5.40.0%apple-clang@16.0.0+cpanm+opcode+open+shared+threads build_system=generic arch=darwin-sequoia-m1
[+]          ^berkeley-db@18.1.40%apple-clang@16.0.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=darwin-sequoia-m1
[+]          ^bzip2@1.0.8%apple-clang@16.0.0~debug~pic+shared build_system=generic arch=darwin-sequoia-m1
[+]              ^diffutils@3.10%apple-clang@16.0.0 build_system=autotools arch=darwin-sequoia-m1
[+]                  ^libiconv@1.17%apple-clang@16.0.0 build_system=autotools libs=shared,static arch=darwin-sequoia-m1
[+]          ^gdbm@1.23%apple-clang@16.0.0 build_system=autotools arch=darwin-sequoia-m1
[+]              ^readline@8.2%apple-clang@16.0.0 build_system=autotools patches=bbf97f1 arch=darwin-sequoia-m1
[+]                  ^ncurses@6.5%apple-clang@16.0.0~symlinks+termlib abi=none build_system=autotools patches=7a351bc arch=darwin-sequoia-m1
[+]                      ^pkgconf@2.2.0%apple-clang@16.0.0 build_system=autotools arch=darwin-sequoia-m1
[+]      ^zlib-ng@2.2.1%apple-clang@16.0.0+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sequoia-m1
[+]          ^gnuconfig@2022-09-17%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1
[+]  py-six@1.16.0%apple-clang@16.0.0 build_system=python_pip arch=darwin-sequoia-m1
[+]      ^py-pip@23.1.2%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1
[+]      ^py-setuptools@69.2.0%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1
[-]      ^py-wheel@0.41.2%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1
...
```

With no input spec displayed -- just the concretization output shown as one consolidated
tree and multiple roots.

- [x] remove "Input Spec" section and "Concretized" header from `spack spec` output
- [x] print concretized specs as one BFS tree instead of multiple

---------

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2024-11-13 08:21:16 -07:00
Harmen Stoppels
be918817d6
bump version to 0.24.0.dev0 (#47578) 2024-11-13 13:05:14 +01:00
Harmen Stoppels
41d9f687f6
missing and redundant imports (#47577) 2024-11-13 13:03:09 +01:00
John Gouwar
bf16f0bf74
Add solver capability for synthesizing splices of ABI compatible packages. (#46729)
This PR provides complementary 2 features:
1. An augmentation to the package language to express ABI compatibility relationships among packages. 
2. An extension to the concretizer that can synthesize splices between ABI compatible packages.

1.  The `can_splice` directive and ABI compatibility 
We augment the package language with a single directive: `can_splice`. Here is an example of a package `Foo` exercising the `can_splice` directive:

class Foo(Package):
    version("1.0")
    version("1.1")
    variant("compat", default=True)
    variant("json", default=False)
    variant("pic", default=False)
    can_splice("foo@1.0", when="@1.1")
    can_splice("bar@1.0", when="@1.0+compat")
    can_splice("baz@1.0+compat", when="@1.0+compat", match_variants="*")
    can_splice("quux@1.0", when=@1.1~compat", match_variants="json")

Explanations of the uses of each directive: 
- `can_splice("foo@1.0", when="@1.1")`:  If `foo@1.0` is the dependency of an already installed spec and `foo@1.1` could be a valid dependency for the parent spec, then `foo@1.1` can be spliced in for `foo@1.0` in the parent spec.
- `can_splice("bar@1.0", when="@1.0+compat")`: If `bar@1.0` is the dependency of an already installed spec and `foo@1.0+compat` could be a valid dependency for the parent spec, then `foo@1.0+compat` can be spliced in for `bar@1.0+compat` in the parent spec
-  `can_splice("baz@1.0", when="@1.0+compat", match_variants="*")`: If `baz@1.0+compat` is the dependency of an already installed spec and `foo@1.0+compat` could be a valid dependency for the parent spec, then `foo@1.0+compat` can be spliced in for `baz@1.0+compat` in the parent spec, provided that they have the same value for all other variants (regardless of what those values are). 
-  `can_splice("quux@1.0", when=@1.1~compat", match_variants="json")`:If `quux@1.0` is the dependency of an already installed spec and `foo@1.1~compat` could be a valid dependency for the parent spec, then `foo@1.0~compat` can be spliced in for `quux@1.0` in the parent spec, provided that they have the same value for their `json` variant. 

2. Augmenting the solver to synthesize splices
### Changes to the hash encoding in `asp.py`
Previously, when including concrete specs in the solve, they would have the following form:

installed_hash("foo", "xxxyyy")
imposed_constraint("xxxyyy", "foo", "attr1", ...)
imposed_constraint("xxxyyy", "foo", "attr2", ...)
% etc. 

Concrete specs now have the following form:
installed_hash("foo", "xxxyyy")
hash_attr("xxxyyy", "foo", "attr1", ...)
hash_attr("xxxyyy", "foo", "attr2", ...)

This transformation allows us to control which constraints are imposed when we select a hash, to facilitate the splicing of dependencies. 

2.1 Compiling `can_splice` directives in `asp.py`
Consider the concrete spec:
foo@2.72%gcc@11.4 arch=linux-ubuntu22.04-icelake build_system=autotools ^bar ...
It will emit the following facts for reuse (below is a subset)

installed_hash("foo", "xxxyyy")
hash_attr("xxxyyy", "hash", "foo", "xxxyyy")
hash_attr("xxxyyy", "version", "foo", "2.72")
hash_attr("xxxyyy", "node_os", "ubuntu22.04")
hash_attr("xxxyyy", "hash", "bar", "zzzqqq")
hash_attr("xxxyyy", "depends_on", "foo", "bar", "link")

Rules that derive abi_splice_conditions_hold will be generated from 
use of the `can_splice` directive. They will have the following form:
can_splice("foo@1.0.0+a", when="@1.0.1+a", match_variants=["b"]) --->

abi_splice_conditions_hold(0, node(SID, "foo"), "foo", BaseHash) :-
  installed_hash("foo", BaseHash),
  attr("node", node(SID, SpliceName)),
  attr("node_version_satisfies", node(SID, "foo"), "1.0.1"),
  hash_attr("hash", "node_version_satisfies", "foo", "1.0.1"),
  attr("variant_value", node(SID, "foo"), "a", "True"),
  hash_attr("hash", "variant_value", "foo", "a", "True"),
  attr("variant_value", node(SID, "foo"), "b", VariVar0),
  hash_attr("hash", "variant_value", "foo", "b", VariVar0).


2.2 Synthesizing splices in `concretize.lp` and `splices.lp`

The ASP solver generates "splice_at_hash" attrs to indicate that a particular node has a splice in one of its immediate dependencies. 

Splices can be introduced in the dependencies of concrete specs when `splices.lp` is conditionally loaded (based on the config option `concretizer:splice:True`. 

2.3 Constructing spliced specs in `asp.py`

The method `SpecBuilder._resolve_splices` implements a top-down memoized implementation of hybrid splicing. This is an optimization over the more general `Spec.splice`, since the solver gives a global view of exactly which specs can be shared, to ensure the minimal number of splicing operations. 

Misc changes to facilitate configuration and benchmarking 
- Added the method `Solver.solve_with_stats` to expose timers from the public interface for easier benchmarking 
- Added the boolean config option `concretizer:splice` to conditionally load splicing behavior 

Co-authored-by: Greg Becker <becker33@llnl.gov>
2024-11-12 20:51:19 -08:00
Greg Becker
1809b81e1d
parse_specs: special case for concretizing lookups quickly (#47556)
We added unification semantics for parsing specs from the CLI, but there are a couple
of special cases in which we can avoid calls to the concretizer for speed when the
specs can all be resolved by lookups.

- [x] special case 1: solving a single spec

- [x] special case 2: all specs are either concrete (come from a file) or have an abstract
      hash. In this case if concretizer:unify:true we need an additional check to confirm
      the specs are compatible.

- [x] add a parameterized test for unifying on the CI

---------

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-12 15:04:47 -07:00
Harmen Stoppels
e33cbac01f
getting_started.rst: fix list of spack deps (#47557) 2024-11-12 08:59:07 +01:00
Harmen Stoppels
4691301eba
Compiler.default_libc: early exit on darwin/win (#47554)
* Compiler.default_libc: early exit on darwin/win

* use .cc when testing c++ compiler if c compiler is missing
2024-11-11 14:12:43 -08:00
Peter Scheibel
9ed5e1de8e
Bugfix: spack find -x in environments (#46798)
This addresses part [1] of #46345

#44713 introduced a bug where all non-spec query parameters like date
ranges, -x, etc. were ignored when an env was active.

This fixes that issue and adds tests for it.

---------

Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
2024-11-11 10:13:31 -08:00
Massimiliano Culpo
4eb7b998e8
Move concretization tests to the same folder (#47539)
* Move concretization tests to the same folder

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>

* Fix for clingo-cffi

---------

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-11-11 19:01:24 +01:00
kwryankrattiger
b803dabb2c
mirrors: allow username/password as environment variables (#46549)
`spack mirror add` and `set` now have flags `--oci-password-variable`, `--oci-password-variable`, `--s3-access-key-id-variable`, `--s3-access-key-secret-variable`, `--s3-access-token-variable`, which allows users to specify an environment variable in which a username or password is stored.

Storing plain text passwords in config files is considered deprecated.

The schema for mirrors.yaml has changed, notably the `access_pair` list is generally replaced with a dictionary of `{id: ..., secret_variable: ...}` or `{id_variable: ..., secret_variable: ...}`.
2024-11-11 16:34:39 +01:00
Todd Gamblin
c4a5a996a5 solver: avoid parsing specs in setup
- [x] Get rid of a call to `parser.quote_if_needed()` during solver setup, which
      introduces a circular import and also isn't necessary.

- [x] Rename `spack.variant.Value` to `spack.variant.ConditionalValue`, as it is *only*
      used for conditional values. This makes it much easier to understand some of the
      logic for variant definitions.

Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-11 01:54:57 -08:00
Todd Gamblin
6961514122 imports: move conditional to directives.py
`conditional()`, which defines conditional variant values, and the other ways to declare
variant values should probably be in a layer above `spack.variant`. This does the simple
thing and moves *just* `conditional()` to `spack.directives` to avoid a circular import.

We can revisit the public variant interface later, when we split packages from core.

Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-11 01:54:57 -08:00
Harmen Stoppels
a9e6074996
filesystem.py find: return directories and improve performance (#47537) 2024-11-11 09:43:23 +00:00
Todd Gamblin
7fbfb0f6dc
Revert "fix patched dependencies across repositories (#42463)" (#47519)
This reverts commit da1d533877.
2024-11-09 10:25:25 +01:00
Massimiliano Culpo
11d276ab6f
Fix style checks on develop (#47518)
`mypy` checks have been accidentally broken by #47213
2024-11-08 23:50:37 -08:00
Greg Becker
da1d533877
fix patched dependencies across repositories (#42463)
Currently, if a package has a dependency from another repository and patches it,
generation of the patch cache will fail. Concretization succeeds if a fixed patch
cache is in place.

- [x] don't assume that patched dependencies are in the same repo when indexing
- [x] add some test fixtures to support multi-repo tests.

---------

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-08 18:07:40 -07:00
Harmen Stoppels
c6997e11a7
spack.compiler/spack.util.libc: add caching (#47213)
* spack.compiler: cache output

* compute libc from the dynamic linker at most once per spack process

* wrap compiler cache entry in class, add type hints

* test compiler caching

* ensure tests do not populate user cache, and fix 2 tests

* avoid recursion: cache lookup -> compute key -> cflags -> real_version -> cache lookup

* allow compiler execution in test that depends on get_real_version
2024-11-08 16:25:02 -08:00
Harmen Stoppels
907a37145f
llnl.util.filesystem: multiple entrypoints and max_depth (#47495)
If a package `foo` doesn't implement `libs`, the default was to search recursively for `libfoo` whenever asking for `spec[foo].libs` (this also happens automatically if a package includes `foo` as a link dependency).

This can lead to some strange behavior:
1. A package that is normally used as a build dependency (e.g. `cmake` at one point) is referenced like
   `depends_on(cmake)` which leads to a fully-recursive search for `libcmake` (this can take
   "forever" when CMake is registered as an external with a prefix like `/usr`, particularly on NFS mounts).
2. A similar hang can occur if a package is registered as an external with an incorrect prefix

- [x] Update the default library search to stop after a maximum depth (by default, search
  the root prefix and each directory in it, but no lower).
- [x] 

The following is a list of known changes to `find` compared to `develop`:

1. Matching directories are no longer returned -- `find` consistently only finds non-dirs, 
   even at `max_depth`
2. Symlinked directories are followed (needed to support max_depth)
3. `find(..., "dir/*.txt")` is allowed, for finding files inside certain dirs. These "complex"
   patterns are delegated to `glob`, like they are on `develop`.
4. `root` and `files` arguments both support generic sequences, and `root`
   allows both `str` and `path` types. This allows us to specify multiple entry points to `find`.

---------

Co-authored-by: Peter Scheibel <scheibel1@llnl.gov>
2024-11-08 13:55:53 -08:00
Harmen Stoppels
4778d2d332
Add missing imports (#47496) 2024-11-08 17:51:58 +01:00
Alec Scott
ff26d2f833
spack env track command (#41897)
This PR adds a sub-command to `spack env` (`track`) which allows users to add/link
anonymous environments into their installation as named environments. This allows
users to more easily track their installed packages and the environments they're
dependencies of. For example, with the addition of #41731 it's now easier to remove
all packages not required by any environments with,

```
spack gc -bE
```

#### Usage
```
spack env track /path/to/env
==> Linked environment in /path/to/env
==> You can activate this environment with:
==>     spack env activate env
```

By default `track /path/to/env` will use the last directory in the path as the name of 
the environment. However users may customize the name of the linked environment
with `-n | --name`. Shown below.
```
spack env track /path/to/env --name foo 
==> Tracking environment in /path/to/env
==> You can activate this environment with:
==>     spack env activate foo
```

When removing a linked environment, Spack will remove the link to the environment
but will keep the structure of the environment within the directory. This will allow
users to remove a linked environment from their installation without deleting it from
a shared repository.

There is a `spack env untrack` command that can be used to *only* untrack a tracked
environment -- it will fail if it is used on a managed environment.  Users can also use
`spack env remove` to untrack an environment.

This allows users to continue to share environments in git repositories  while also having
the dependencies of those environments be remembered by Spack.

---------

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-08 00:16:01 -08:00
Harmen Stoppels
ed916ffe6c Revert "filesystem.py: add max_depth argument to find (#41945)"
This reverts commit 38c8069ab4.
2024-11-07 13:09:10 -08:00
Harmen Stoppels
4fbdf2f2c0 Revert "llnl.util.filesystem.find: restore old error handling (#47463)"
This reverts commit a31c525778.
2024-11-07 13:09:10 -08:00
Harmen Stoppels
60ba61f6b2 Revert "llnl.util.filesystem.find: multiple entrypoints (#47436)"
This reverts commit 73219e4b02.
2024-11-07 13:09:10 -08:00
Harmen Stoppels
0d817878ea
spec.py: fix comparison with multivalued variants (#47485) 2024-11-07 19:29:37 +00:00
Harmen Stoppels
73219e4b02
llnl.util.filesystem.find: multiple entrypoints (#47436)
You can now provide multiple roots to a single `find()` call and all of
them will be searched. The roots can overlap (e.g. can be parents of one
another).

This also adds a library function for taking a set of regular expression
patterns and creating a single OR expression (and that library function
is used in `find` to improve its performance).
2024-11-06 15:22:26 -08:00
Massimiliano Culpo
e62cf9c45b
Fix spack -c <override> when env active (#47403)
Set command line scopes last in _main, so they are higher scopes

Restore the global configuration in a spawned process by inspecting
the result of ctx.get_start_method()

Add the ability to pass a mp.context to PackageInstallContext.

Add shell-tests to check overriding the configuration:
- Using both -c and -C from command line
- With and without an environment active
2024-11-06 17:18:58 +01:00
Harmen Stoppels
d09b185522
Fix various bootstrap/concretizer import issues (#47467) 2024-11-06 14:35:04 +00:00
Harmen Stoppels
a31c525778
llnl.util.filesystem.find: restore old error handling (#47463) 2024-11-06 11:49:14 +01:00
Richarda Butler
0c164d2740
Feature: Allow variants to propagate if not available in source pkg (#42931)
Variants can now be propagated from a dependent package to (transitive) dependencies, 
even if the source or transitive dependencies have the propagated variants.

For example, here `zlib` doesn't have a `guile` variant, but `gmake` does:
```
$ spack spec zlib++guile
 -   zlib@1.3%gcc@12.2.0+optimize+pic+shared build_system=makefile arch=linux-rhel8-broadwell
 -       ^gcc-runtime@12.2.0%gcc@12.2.0 build_system=generic arch=linux-rhel8-broadwell
 -       ^gmake@4.4.1%gcc@12.2.0+guile build_system=generic arch=linux-rhel8-broadwell
```

Adding this property has some strange ramifications for `satisfies()`. In particular:
* The abstract specs `pkg++variant` and `pkg+variant`  do not intersect, because `+variant`
  implies that `pkg` *has* the variant, but `++variant` does not.
* This means that `spec.satisfies("++foo")` is `True` if:
    * for concrete specs: `spec` and its dependencies all have `foo` set if it exists
    * for abstract specs: no dependency of `spec`  has `~foo` (i.e. no dependency contradicts `++foo`).
* This also means that `Spec("++foo").satisfies("+foo")` is `False` -- we only know after concretization.

The `satisfies()` semantics may be surprising, but this is the cost of introducing non-subset
semantics (which are more useful than proper subsets here).

- [x] Change checks for variants
- [x] Resolve conflicts
- [x] Add tests
- [x] Add documentation

---------

Co-authored-by: Gregory Becker <becker33@llnl.gov>
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-11-06 00:53:52 -08:00
Harmen Stoppels
dadb30f0e2
libc.py: detect glibc also in chinese locale (#47434) 2024-11-05 12:30:32 +01:00
Harmen Stoppels
d45f682573
Revert "Ci generate on change (#47318)" (#47431)
This reverts commit 1462c35761.
2024-11-05 10:51:12 +01:00
Massimiliano Culpo
14bc900e9d
spack.concretize: add type-hints, remove kwargs (#47382)
Also remove find_spec, which was used by the old concretizer.
Currently, it seems to be used only in tests.
2024-11-05 07:46:49 +01:00
Peter Scheibel
38c8069ab4
filesystem.py: add max_depth argument to find (#41945)
* `find(..., max_depth=...)` can be used to control how many directories at most to descend into below the starting point
* `find` now enters every unique (symlinked) directory once at the lowest depth
* `find` is now repeatable: it traverses the directory tree in a deterministic order
2024-11-04 20:31:57 +01:00
Todd Gamblin
5cc07522ab cc: parse RPATHs when in ld mode
In the pure `ld` case, we weren't actually parsing `RPATH` arguments separately as we
do for `ccld`. Fix this by adding *another* nested case statement for raw `RPATH`
parsing.

There are now 3 places where we deal with `-rpath` and friends, but I don't see a great
way to unify them, as `-Wl,`, `-Xlinker`, and raw `-rpath` arguments are all ever so
slightly different.

Also, this Fixes ordering of assertions to make `pytest` diffs more intelligible.
The meaning of `+` and `-` in diffs changed in `pytest` 6.0 and the "preferred" order
for assertions became `assert actual == expected` instead of the other way around.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-04 19:52:08 +01:00
Todd Gamblin
575a006ca3 cc: simplify ordered list handling
`cc` divides most paths up into system paths, spack managed paths, and other paths.
This gets really repetitive and makes the code hard to read. Simplify the script
by adding some functions to do most of the redundant work for us.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-04 19:52:08 +01:00
John Gouwar
23ac56edfb
Times spec building and timing to public concretizer API (#47310)
This PR has two small contributions:
- It adds another phase to the timer for concrectization, "construct_specs", to actually see the time the concretizer spends interpreting the `clingo` output to build the Python object for a concretized spec. 
- It adds the method `Solver.solve_with_stats` to expose the timers that were already in the concretizer to the public solver API. `Solver.solve` just becomes a special case of `Solver.solve_with_stats` that throws away the timing output (which is what it was already doing).  

These changes will make it easier to benchmark concretizer performance and provide a more complete picture of the time spent in the concretizer by including the time spent interpreting clingo output.
2024-11-04 09:48:18 -08:00
Harmen Stoppels
8d0856d1cc
packaging_guide.rst: explain forward and backward compat before the less common cases (#47402)
The idea is to go from most to least used: backward compat -> forward compat -> pinning on major or major.minor version -> pinning specific, concrete versions.

Further, the following

```python
   # backward compatibility with Python
   depends_on("python@3.8:")
   depends_on("python@3.9:", when="@1.2:")
   depends_on("python@3.10:", when="@1.4:")

   # forward compatibility with Python
   depends_on("python@:3.12", when="@:1.10")
   depends_on("python@:3.13", when="@:1.12")
   depends_on("python@:3.14")
```

is better than disjoint when ranges causing repetition of the rules on dependencies, and requiring frequent editing of existing lines after new releases are done:

```python
   depends_on("python@3.8:3.12", when="@:1.1")
   depends_on("python@3.9:3.12", when="@1.2:1.3")
   depends_on("python@3.10:3.12", when="@1.4:1.10")
   depends_on("python@3.10:3.13", when="@1.11:1.12")
   depends_on("python@3.10:3.14", when="@1.13:")
2024-11-04 13:52:05 +01:00
Massimiliano Culpo
395c911689
Specs: propagated variants affect == equality (#47376)
This PR changes the semantic of == for spec so that:

hdf5++mpi == hdf5+mpi

won't hold true anymore. It also changes the constrain semantic, so that a
non-propagating variant always override a propagating variant. This means:

(hdf5++mpi).constrain(hdf5+mpi) -> hdf5+mpi

Before we had a very weird semantic, that was supposed to be tested by unit-tests:

(libelf++debug).constrain(libelf+debug+foo) -> libelf++debug++foo

This semantic has been dropped, as it was never really tested due to the == bug.
2024-11-03 22:35:16 -08:00
Tamara Dahlgren
b8461f3d2d
Remove ignored config:install_missing_compilers from unit tests (#47357) 2024-11-02 09:36:05 +01:00
Massimiliano Culpo
133895e785
Rework the schema for reusing environments (#47364)
Currently, the schema reads:

  from:
    - type:
        environment: path_or_name

but this can't be extended easily to other types, e.g. to buildcaches,
without duplicating the extension keys. Use instead:

  from:
    - type: environment
      path: path_or_name
2024-11-02 09:03:42 +01:00
dependabot[bot]
19e3ab83cf
build(deps): bump python-levenshtein in /lib/spack/docs (#47372)
Bumps [python-levenshtein](https://github.com/rapidfuzz/python-Levenshtein) from 0.26.0 to 0.26.1.
- [Release notes](https://github.com/rapidfuzz/python-Levenshtein/releases)
- [Changelog](https://github.com/rapidfuzz/python-Levenshtein/blob/main/HISTORY.md)
- [Commits](https://github.com/rapidfuzz/python-Levenshtein/compare/v0.26.0...v0.26.1)

---
updated-dependencies:
- dependency-name: python-levenshtein
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-01 23:55:18 +00:00
Greg Becker
e42a4a8bac
parse_specs: unify specs based on concretizer:unify (#44843)
Currently, the `concretizer:unify:` config option only affects environments.

With this PR, it now affects any group of specs given to a command using the `parse_specs(*, concretize=True)` interface.

- [x] implementation in `parse_specs`
- [x] tests
- [x] ensure all commands that accept multiple specs and concretize use `parse_specs` interface

---------

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-01 23:49:26 +00:00
kwryankrattiger
1462c35761
Ci generate on change (#47318)
* don't concretize in CI if changed packages are not in stacks

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

* Generate noop job when no specs to rebuild due to untouched pruning

* Add test to verify skipping generate creates a noop job

* Changed debug for early exit

---------

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-01 22:07:23 +00:00
Massimiliano Culpo
0cf8cb70f4
Fix pickle round-trip of specs propagating variants (#47351)
This changes `Spec` serialization to include information about propagation for abstract specs.
This was previously not included in the JSON representation for abstract specs, and couldn't be
stored.

Now, there is a separate `propagate` dictionary alongside the `parameters` dictionary. This isn't
beautiful, but when we bump the spec version for Spack `v0.24`, we can clean up this and other
aspects of the schema.
2024-11-01 13:43:16 -07:00
dependabot[bot]
5df7dc88fc
build(deps): bump docutils from 0.20.1 to 0.21.2 in /lib/spack/docs (#45592)
Bumps [docutils](https://docutils.sourceforge.io) from 0.20.1 to 0.21.2.

---
updated-dependencies:
- dependency-name: docutils
  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>
2024-11-01 06:23:10 -05:00
Harmen Stoppels
e3aca49e25
database.py: remove process unsafe update_explicit (#47358)
Fixes an issue reported where `spack env depfile` + `make -j` would
non-deterministically refuse to mark all environment roots explicit.

`update_explicit` had the pattern

```python
rec = self._data[key]
with self.write_transaction():
    rec.explicit = explicit
```

but `write_transaction` may reinitialize `self._data`, meaning that
mutating `rec` won't mutate `self._data`, and the changes won't be
persisted.

Instead, use `mark` which has a correct implementation.

Also avoids the essentially incorrect early return in `update_explicit`
which is a pattern I don't think belongs in database.py: it branches on
possibly stale data to realize there is nothing to change, but in reality
it requires a write transaction to know that for a fact, but that would
defeat the purpose. So, leave this optimization to the call site.
2024-10-31 13:58:42 -07:00
kwryankrattiger
0c00a297e1
Concretize reuse: reuse specs from environment (#45139)
The already concrete specs in an environment are now among the reusable specs for the concretizer.

This includes concrete specs from all include_concrete environments.

In addition to this change to the default reuse, `environment` is added as a reuse type for 
the concretizer config. This allows users to specify:

spack:
  concretizer:
    # Reuse from this environment (including included concrete) but not elsewhere
    reuse:
      from:
      - type: environment
    # or reuse from only my_env included environment
    reuse:
      from:
      - type:
          environment: my_env
    # or reuse from everywhere
    reuse: true

If reuse is specified from a specific environment, only specs from that environment will be reused.
If the reused environment is not specified via include_concrete, the concrete specs will be retried
at concretization time to be reused.

Signed-off-by: Ryan Krattiger <ryan.krattiger@kitware.com>
Co-authored-by: Gregory Becker <becker33@llnl.gov>
2024-10-31 10:31:34 -07:00
Adam J. Stewart
6ab92b119d
Docs: remove reference to pyspack (#47346) 2024-10-31 11:15:51 +01:00
Harmen Stoppels
c3435b4e7d
hooks: run in clear, fixed order (#47329)
Currently the order in which hooks are run is arbitrary.

This can be fixed by sorted(list_modules(...)) but I think it is much
more clear to just have a static list.

Hooks are not extensible other than modifying Spack code, which
means it's unlikely people maintain custom hooks since they'd have
to fork Spack. And if they fork Spack, they might as well add an entry
to the list when they're continuously rebasing.
2024-10-30 18:57:49 +00:00
Harmen Stoppels
8892c878ce
types: remove singleton union in globals (#47282) 2024-10-30 13:48:32 +01:00
Harmen Stoppels
cbf4d3967a
add std_pip_args global to the audit list (#47320) 2024-10-30 13:14:15 +01:00
Harmen Stoppels
8bc0b2e086
Spec.__str__: use full hash (#47322)
The idea is that `spack -e env add ./concrete-spec.json` would list the
full hash in the specs, so that (a) it's not ambiguous and (b) it could
in principle results in constant time lookup instead of linear time
substring match in large build caches.
2024-10-30 12:44:51 +01:00
Massimiliano Culpo
354615d491
Spec.dependencies: allow to filter on virtuals (#47284)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-30 12:15:01 +01:00
Alex Hedges
34b2f28a5e
Fix malformed RST link in documentation (#47309) 2024-10-30 09:40:35 +01:00
Massimiliano Culpo
b8e3246e89
llnl.util.lang: add classes to help with deprecations (#47279)
* Add a descriptor to have a class level constant

This descriptor helps intercept places where we set a value on instances.
It does not really behave like "const" in C-like languages, but is the
simplest implementation that might still be useful.

* Add a descriptor to deprecate properties/attributes of an object

This descriptor is used as a base class. Derived classes may implement a
factory to return an adaptor to the attribute being deprecated. The
descriptor can either warn, or raise an error, when usage of the deprecated
attribute is intercepted.

---------

Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
2024-10-29 19:06:26 +01:00
Harmen Stoppels
ea1aa0714b
bootstrap: do not consider source when metadata file missing (#47278) 2024-10-29 10:57:31 +01:00
Harmen Stoppels
7af1a3d240
std_meson_args: deprecate (#47259) 2024-10-29 07:54:28 +01:00
Harmen Stoppels
962115b386
builder.py: builder_cls should be associated to spack.pkg module (#47269) 2024-10-29 07:53:06 +01:00
Harmen Stoppels
f81ca0cd89
directives_meta.py: use startswith to test module part of spack.pkg (#47270) 2024-10-29 07:51:36 +01:00
Greg Becker
e81ce18cad
cmd/solve: use interface from cmd/spec (#47182)
Currently, `spack solve` has different spec selection semantics than `spack spec`.
`spack solve` currently does not allow specifying a single spec when an environment is active.

This PR modifies `spack solve` to inherit the interface from `spack spec`, and to use
the same spec selection logic. This will allow for better use of `spack solve --show opt`
for debugging.

---------

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2024-10-28 19:28:03 -07:00
Harmen Stoppels
2ec4281c4f
Remove a few redundant imports (#47250)
* remove self-imports

* remove unused imports
2024-10-27 15:40:05 -06:00
Greg Becker
47e70c5c3a
explicit splice: do not fail for bad config replacement if target not matched (#46925)
Originally, concretization failed if the splice config points to an invalid replacement.

This PR defers the check until we know the splice is needed, so that irrelevant splices
with bad config cannot stop concretization.

While I was at it, I improved an error message from an assert to a ValueError.
2024-10-27 11:35:10 -07:00
Todd Gamblin
c8bebff7f5
Add -t short option for spack --backtrace (#47227)
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-10-26 09:16:31 +02:00
John W. Parent
7b27aed4c8
Normalize Spack Win entry points (#38648)
* Normalize Spack Win entrypoints

Currently Spack has multiple entrypoints on Windows that in addition to
differing from *nix implementations, differ from shell to shell on
Windows. This is a bit confusing for new users and in general
unnecessary.
This PR adds a normal setup script for the batch shell while preserving
the previous "click from file explorer for spack shell" behavior.
Additionally adds a shell title to both powershell and cmd letting users
know this is a Spack shell

* remove doskeys
2024-10-25 15:23:29 -04:00
Dom Heinzeller
ad0b256407
Intel/Oneapi compilers: suppress warnings when using Cray wrappers (#47046)
#44588 we added logic to suppress deprecation warnings for the
Intel classic compilers. This depended on matching against 

* The compiler names (looking for icc, icpc, ifort)
* The compiler version

When using an Intel compiler with fortran wrappers, the first check
always fails. To support using the fortran wrappers (in combination
with the classic Intel compilers), we remove the first check and
suppress if just the version matches. This works because:

* The newer compilers like icx can handle (ignore) the flags that
  suppress deprecation warnings
* The Cray wrappers pass the underlying compiler version (e.g. they
  report what icc would report)
2024-10-25 12:17:49 -07:00
Harmen Stoppels
7d86670826 ensure write_fd.close() isn't called when sys.std* cannot be redirected 2024-10-25 10:16:44 -07:00
Harmen Stoppels
ae306b73c3 Avoid a socket to communicate effectively a bit 2024-10-25 10:16:44 -07:00
Harmen Stoppels
b63cbe4e6e Replace MultiProcessFd with Connection objects
Connection objects are Python version, platform and multiprocessing
start method independent, so better to use those than a mix of plain
file descriptors and inadequate guesses in the child process whether it
was forked or not.

This also allows us to delete the now redundant MultiProcessFd class,
hopefully making things a bit easier to follow.
2024-10-25 10:16:44 -07:00
Harmen Stoppels
e86a3b68f7
file_cache.py: allow read transaction on uninitialized cache (#47212)
This allows the following

```python
cache.init_entry("my/cache")
with cache.read_transaction("my/cache") as f:
    data = f.read() if f is not None else None
```

mirroring `write_transaction`, which returns a tuple `(old, new)` where
`old` is `None` if the cache file did not exist yet.

The alternative that requires less defensive programming on the call
site would be to create the "old" file upon first read, but I did not
want to think about how to safely atomically create the file, and it's
not unthinkable that an empty file is an invalid format (for instance
the call site may expect a json file, which requires at least {} bytes).
2024-10-25 17:10:14 +02:00
Jordan Galby
f13d998d21
Add spack short version in config variables (#47016) 2024-10-25 07:34:59 +02:00
Tamara Dahlgren
1b0631b69e
Env help: expand and refine subcommand help and descriptions (#47089)
This PR is in response to a question in the `environments` slack channel (https://spackpm.slack.com/archives/CMHK7MF51/p1729200068557219) about inadequate CLI help/documentation for one specific subcommand.

This PR uses the approach I took for the descriptions and help for `spack test` subcommands.  Namely, I use the first line of the relevant docstring as the description, which is shown per subcommand in `spack env -h`, and the entire docstring as the help.  I then added, where it seemed appropriate, help.  I also tweaked argument docstrings to tighten them up, make consistent with similar arguments elsewhere in the command, and elaborate when it seemed important.  (The only subcommand I didn't touch is `loads`.)

For example, before:
```
$ spack env update -h
usage: spack env update [-hy] env

positional arguments:
  env               name or directory of the environment to activate

optional arguments:
  -h, --help        show this help message and exit
  -y, --yes-to-all  assume "yes" is the answer to every confirmation request
```

After the changes in this PR:
```
$ spack env update -h
usage: spack env update [-hy] env

update the environment manifest to the latest schema format

    update the environment to the latest schema format, which may not be
    readable by older versions of spack

    a backup copy of the manifest is retained in case there is a need to revert
    this operation
    

positional arguments:
  env               name or directory of the environment

optional arguments:
  -h, --help        show this help message and exit
  -y, --yes-to-all  assume "yes" is the answer to every confirmation request
```

---------

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2024-10-24 13:55:00 -07:00
Harmen Stoppels
5ac2b8a178
compilers.yaml: require list of strings for modules (#47197) 2024-10-24 13:28:38 -06:00
Kyle Knoepfel
e0eea48ccf
Restore bold uncolored font face (#47108)
Commit aa0825d642 accidentally added a semicolon
to the ANSI escape sequence even if the color code was `None` or unknown, breaking the
bold, uncolored font-face.  This PR restores the old behavior.

---------

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2024-10-24 09:11:43 +00:00
Harmen Stoppels
d8c8074762
bootstrap: add clingo 3.13 binaries and more (#47126) 2024-10-24 08:55:14 +02:00
Massimiliano Culpo
f6ad1e23f8
Improve Database.query* methods (#47116)
* Add type hints to all query* methods
* Inline docstrings
* Change defaults from `any` to `None` so they can be type hinted in old Python
* Pre-filter on given hashes instead of iterating over all db specs
* Fix a bug where the `--origin` option of uninstall had no effect
* Fix a bug where query args were not applied when searching by concrete spec

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-24 08:13:07 +02:00
Harmen Stoppels
79ad6f6b48
env: continue to mark non-roots as implicitly installed on partial env installs (#47183)
Fixes a change in behavior/bug in
70412612c7, where partial environment
installs would mark the selected spec as explicitly installed, even if
it was not a root of the environment.

The desired behavior is that roots by definition are the to be
explicitly installed specs. The specs on the `spack -e ... install x`
command line are just filters for partial installs, so leave them
implicitly installed if they aren't roots.
2024-10-23 21:17:40 +00:00
Scott Wittenburg
1472dcace4
ci: Remove deprecated logic from the ci module (#47062)
ci: Remove deprecated logic from the ci module

Remove the following from the ci module, schema, and tests:

- deprecated ci stack and handling of old ci config
- deprecated mirror handling logic
- support for artifacts buildcache
- support for temporary storage url
2024-10-23 12:50:55 -06:00
Todd Gamblin
f33912d707
mypy: work around typing issues with functools.partial (#47160) 2024-10-23 06:33:09 -06:00
dependabot[bot]
e785d3716e
build(deps): bump sphinx from 7.4.7 to 8.1.3 in /lib/spack/docs (#47159)
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 7.4.7 to 8.1.3.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/v8.1.3/CHANGES.rst)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v7.4.7...v8.1.3)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-23 06:18:20 -06:00
Massimiliano Culpo
ed15b73c3b
Remove spurious warning, introduced in #46992 (#47152)
fixes #47135

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-23 07:33:09 +02:00
dependabot[bot]
50aa5a7b24
build(deps): bump black from 24.8.0 to 24.10.0 in /lib/spack/docs (#47118)
Bumps [black](https://github.com/psf/black) from 24.8.0 to 24.10.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/24.8.0...24.10.0)

---
updated-dependencies:
- dependency-name: black
  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>
2024-10-22 18:58:31 +02:00
Harmen Stoppels
ef9bb7ebe5
spack arch: add --family --generic flags (#47078)
This allows users to do:

```
spack install ... target=$(spack arch --target --family)
spack install ... arch=$(spack arch --family)

spack install ... target=$(spack arch --target --generic)
spack install ... arch=$(spack arch --generic)
```

Deprecate `--generic-target` in favor of `--generic --target`
2024-10-22 14:13:11 +00:00
Harmen Stoppels
cbad3d464a
buildcache: recognize . and .. as paths instead of names (#47105) 2024-10-22 13:05:06 +02:00
Peter Scheibel
275d1d88f4
avoid double closing of fd in sub-processes (#47035)
Both `multiprocessing.connection.Connection.__del__` and `io.IOBase.__del__` called `os.close` on the same file descriptor. As of Python 3.13, this is an explicit warning. Ensure we close once by usef `os.fdopen(..., closefd=False)`
2024-10-21 18:44:28 +00:00
Tom Scogland
a07d42d35b
Devtools darwin (#46910)
* stacks: add a stack for devtools on darwin

After getting this whole mess building on darwin, let's keep it that
way, and maybe make it so we have some non-ML darwin binaries in spack
as well.

* reuse: false for devtools

* dtc: fix darwin dylib name and id

On mac the convention is `lib<name>.<num>.dylib`, while the makefile
creates a num suffixed one by default. The id in the file is also a
local name rather than rewritten to the full path, this fixes both
problems.

* node-js: make whereis more deterministic

* relocation(darwin): catch Mach-O load failure

The MachO library can throw an exception rather than return no headers,
this happened in an elf file in the test data of go-bootstrap.  Trying
catching the exception and moving on for now.  May also need to look
into why we're trying to rewrite an elf file.

* qemu: add darwin flags to clear out warnings

There's a build failure for qemu in CI, but it's invisible because of
the immense mass of warning output.  Explicitly specify the target macos
version and remove the extraneous unknown-warning-option flag.

* dtc: libyaml is also a link dependency

libyaml is required at runtime to run the dtc binary, lack of it caused
the ci for qemu to fail when the library wasn't found.
2024-10-21 17:32:14 +00:00
Harmen Stoppels
19ad29a690
bootstrap: handle a new edge case of binary python packages with missing python-venv (#47094)
relevant for clingo installed without gcc-runtime and python-venv, which
is done for good reasons.
2024-10-21 10:46:13 -06:00
Massimiliano Culpo
4187c57250
Fix broken spack find -u (#47102)
fixes #47101

The bug was introduced in #33495, where `spack find was not updated,
and wasn't caught by unit tests.

Now a Database can accept a custom predicate to select the installation
records. A unit test is added to prevent regressions. The weird convention
of having `any` as a default value has been replaced by the more commonly
used `None`.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-21 18:03:57 +02:00
Jordan Galby
e5a602c1bb
Modules suffixes config are now spec format strings (#38411) 2024-10-21 09:08:59 +02:00
Tamara Dahlgren
260b36e272
Docs: clarify include path options (#47083) 2024-10-21 07:26:18 +02:00
Harmen Stoppels
9b8c06a049
spack external find: show backtrace on error when --backtrace (#47082) 2024-10-19 15:45:59 +02:00
dependabot[bot]
011ff48f82
build(deps): bump python-levenshtein in /lib/spack/docs (#46494)
Bumps [python-levenshtein](https://github.com/rapidfuzz/python-Levenshtein) from 0.25.1 to 0.26.0.
- [Release notes](https://github.com/rapidfuzz/python-Levenshtein/releases)
- [Changelog](https://github.com/rapidfuzz/python-Levenshtein/blob/main/HISTORY.md)
- [Commits](https://github.com/rapidfuzz/python-Levenshtein/compare/v0.25.1...v0.26.0)

---
updated-dependencies:
- dependency-name: python-levenshtein
  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>
2024-10-19 12:12:13 +02:00
Wouter Deconinck
31bdcd7dc6
rtd: bump sphinx-rtd-theme to 3.0.1 (#47002) 2024-10-19 03:29:36 +02:00
John W. Parent
31cfcafeba
Build logic fix: reorder definition of package module variables (#46992)
#44327 made sure to always run `set_package_py_globals` on all
packages before running `setup_dependent_package` for any package,
so that packages implementing the latter could depend on variables
like `spack_cc` being defined.

This ran into an undocumented dependency: `std_cmake_args` is set in
`set_package_py_globals` and makes use of `cmake_prefix_paths` (if it
is defined in the package); `py-torch`es implementation of
`cmake_prefix_paths` depends on a variable set by
`setup_dependent_package` (`python_platlib`).

This generally restores #44327, and corrects the resulting issue by
moving assignment of `std_cmake_args` to after both actions have been
run.
2024-10-18 13:36:16 -07:00
Sean Koyama
c006cb573a
implement prefix property for OneAPI compiler (#47066) 2024-10-18 11:50:12 -04:00
Harmen Stoppels
c6bfe7c6bd
fix use of traceback.format_exception (#47080)
Co-authored-by: Peter Scheibel <scheibel1@llnl.gov>
2024-10-18 14:54:21 +00:00
kwryankrattiger
34c89c0f7b
CI RESTful Configuration (#41622)
* CI: Add dynamic mapping section

* Doc: Add documentation for dynamic mapping section

* Add missing schema property

* Fixes from review

* query build fix up
* add warning output for dynamic mapping request errors

* Cleanup ci schema

* Add more protections for disabling/mitigating bad endpoints for dynamic
mapping

* Remove references to "gantry" in the docs

* Fixup rtd header

* Add unit testing for dynamic-mapping section

* Add arch to dynamic-mapping query string

* Tests and cleanup schema
2024-10-16 14:06:09 -06:00
Massimiliano Culpo
cbdc07248f
unit-tests: install.py (#47007)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-16 15:02:52 +02:00
Harmen Stoppels
8c70912b11
Update release documentation (#46991) 2024-10-16 09:11:53 +02:00
Massimiliano Culpo
64f90c38be
unit-tests: oci/integration_test.py (#47006)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-16 09:09:52 +02:00
psakievich
0477875667
remove concrete spec constraint from spack develop (#46911)
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.

* Remove concrete verision constriant for develop, set docs

* Add unit-test

* Update lib/spack/docs/environments.rst

Co-authored-by: kwryankrattiger <80296582+kwryankrattiger@users.noreply.github.com>

* Update lib/spack/spack/cmd/develop.py

Co-authored-by: Greg Becker <becker33@llnl.gov>

* Consolidate env collection in cmd

* Style

---------

Co-authored-by: kwryankrattiger <80296582+kwryankrattiger@users.noreply.github.com>
Co-authored-by: Greg Becker <becker33@llnl.gov>
2024-10-15 17:46:27 +00:00
Tobias Ribizel
834ed2f117
env depfile: generate Makefile with absolute script path (#46966)
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2024-10-15 13:52:31 +00:00
Massimiliano Culpo
2f711bda5f
Improve behavior of spack deprecate (#46917)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-15 09:04:12 +02:00
kwryankrattiger
c8f61c8662
Don't require OIDC initialization for noop (#46921)
ref. https://github.com/spack/spack-infrastructure/pull/957
2024-10-14 23:39:55 -05:00
Tamara Dahlgren
507965cbc6
Docs: reduce confusion in configuration override of scope precedence section (#46977) 2024-10-15 04:07:48 +00:00
Harmen Stoppels
21c2eedb80
detection: prefer dir instead of symlink in case of duplicate search paths (#46957) 2024-10-14 17:09:55 +00:00
Massimiliano Culpo
66a3c7bc42
archspec: update to v0.2.5 (#46958)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-14 19:09:17 +02:00
Harmen Stoppels
8b3d3ac2de
cmake: remove custom CMAKE_INSTALL_RPATH (#46685)
The CMake builder in Spack actually adds incorrect rpaths. They are
unfiltered and incorrectly ordered compared to what the compiler wrapper
adds.

There is no need to specify paths to dependencies in `CMAKE_INSTALL_RPATH`
because of two reasons:

1. CMake preserves "toolchain" rpaths, which includes the rpaths injected
   by our compiler wrapper.
2. We use `CMAKE_INSTALL_RPATH_USE_LINK_PATH=ON`, so libraries we link
   to are rpath'ed automatically.

However, CMake does not create install rpaths to directories in the package's
own install prefix, so we set `CMAKE_INSTALL_RPATH` to the educated guess
`<prefix>/{lib,lib64}`, but omit dependencies.
2024-10-14 12:35:50 +02:00
John W. Parent
6c6b262140
Add "only_windows" marker for unit tests (#45979) 2024-10-14 09:02:49 +02:00
Jordan Galby
02a991688f
Fix makefile target check with Make jobserver keep-going (#46784) 2024-10-13 15:02:49 -07:00
Massimiliano Culpo
d5966e676d
Fix splicing related unit tests (#46914)
Some assertion are not testing DAG invariants, and they are passing only
because of the simple structure of the builtin.mock repository on develop.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-12 00:25:41 +00:00
Stephen Sachs
22043617aa
libunistring: 1.2 needs std=c18 for icc, add icc C++ flags update (#37607) 2024-10-11 02:25:32 +02:00
Nathan Hanford
af62a062cc
Installer: rewire spliced specs via RewireTask (#39136)
This PR allows users to configure explicit splicing replacement of an abstract spec in the concretizer.

concretizer:
  splice:
    explicit:
    - target: mpi
      replacement: mpich/abcdef
      transitive: true

This config block would mean "for any spec that concretizes to use mpi, splice in mpich/abcdef in place of the mpi it would naturally concretize to use. See #20262, #26873, #27919, and #46382 for PRs enabling splicing in the Spec object. This PR will be the first place the splice method is used in a user-facing manner. See https://spack.readthedocs.io/en/latest/spack.html#spack.spec.Spec.splice for more information on splicing.

This will allow users to reuse generic public binaries while splicing in the performant local mpi implementation on their system.

In the config file, the target may be any abstract spec. The replacement must be a spec that includes an abstract hash `/abcdef`. The transitive key is optional, defaulting to true if left out.

Two important items to note:

1. When writing explicit splice config, the user is in charge of ensuring that the replacement specs they use are binary compatible with whatever targets they replace. In practice, this will likely require either specific knowledge of what packages will be installed by the user's workflow, or somewhat more specific abstract "target" specs for splicing, to ensure binary compatibility.
2. Explicit splices can cause the output of the concretizer not to satisfy the input. For example, using the config above and consider a package in a binary cache `hdf5/xyzabc` that depends on mvapich2. Then the command `spack install hdf5/xyzabc` will instead install the result of splicing `mpich/abcdef` into `hdf5/xyzabc` in place of whatever mvapich2 spec it previously depended on. When this occurs, a warning message is printed `Warning: explicit splice configuration has caused the the concretized spec {concrete_spec} not to satisfy the input spec {input_spec}".

Highlighted technical details of implementation:

1. This PR required modifying the installer to have two separate types of Tasks, `RewireTask` and `BuildTask`. Spliced specs are queued as `RewireTask` and standard specs are queued as `BuildTask`. Each spliced spec retains a pointer to its build_spec for provenance. If a RewireTask is dequeued and the associated `build_spec` is neither available in the install_tree nor from a binary cache, the RewireTask is requeued with a new dependency on a BuildTask for the build_spec, and BuildTasks are queued for the build spec and its dependencies.
2. Relocation is modified so that a spack binary can be simultaneously installed and rewired. This ensures that installing the build_spec is not necessary when splicing from a binary cache.
3. The splicing model is modified to more accurately represent build dependencies -- that is, spliced specs do not have build dependencies, as spliced specs are never built. Their build_specs retain the build dependencies, as they may be built as part of installing the spliced spec.
4. There were vestiges of the compiler bootstrapping logic that were not removed in #46237 because I asked alalazo to leave them in to avoid making the rebase for this PR harder than it needed to be. Those last remains are removed in this PR.

Co-authored-by: Nathan Hanford <hanford1@llnl.gov>
Co-authored-by: Gregory Becker <becker33@llnl.gov>
Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
2024-10-10 15:48:58 -07:00
pauleonix
caaaba464e
cuda: add v12.6.2 (#46864)
* cuda: Add 12.6.2
* Update cuda build system
   - Remove gcc@6 conflict that was only a deprecation (probably has be added again with cuda@13)
   - Update cuda_arch support by CUDA version
   - Kepler support has ended with cuda@12
   - Recently added 90a Hopper "experimental" features architecture was
    missing the dependency on cuda@12:
2024-10-10 09:48:20 -06:00
psakievich
afc01f9570
CMake: Improve incremental build speed. (#46878)
* CMake: Improve incremental build speed.

CMake automatically embeds an updated configure step into make/ninja that will be called during the build phase.  By default if a `CMakeCache.txt` file exists in the build directory CMake will use it and this + `spec.is_develop` is sufficient evidence of an incremental build.

This PR removes duplicate work/expense from CMake packages when using `spack develop`.

* Update cmake.py

* [@spackbot] updating style on behalf of psakievich

* Update cmake.py

meant self not spec...

---------

Co-authored-by: psakievich <psakievich@users.noreply.github.com>
2024-10-10 00:45:10 -06:00
Greg Becker
f807337273
Environment.clear: ensure clearing is passed through to manifest (#46880)
* Environment.clear: ensure clearing is passed through to manifest
* test/cmd/env: make test_remove_commmand round-trip to disk
* cleanup vestigial variables
2024-10-09 11:13:56 -07:00
Massimiliano Culpo
8e4e3c9060
python: rework how we compute the "command" property (#46850)
Some Windows Python installations may store the Python exe in Scripts/
rather than the base directory. Update `.command` to search in both
locations on Windows. On all systems, the search is now done
recursively from the search root: on Windows, that is the base install
directory, and on other systems it is bin/.
2024-10-09 01:08:27 -06:00
Massimiliano Culpo
d70e9e131d
Fix relocating MachO binary, when store projection changes (#46840)
* Remove "modify_object_macholib"

According to documentation, this function is used when installing
Mach-O binaries on linux. The implementation seems questionable at
least, and the code seems to be never hit (Spack currently doesn't
support installing Mach-O binaries on linux).

* Fix relocation on macOS, when store projection changes

---------

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-08 13:32:28 +02:00
James Smillie
a09b9f0659
Windows/Testing: enable spack view tests on Windows (#46335)
Enable tests for symlink-based views (this works with almost no
modifications to the view logic). View logic is not yet robust
for hardlink/junction-based views, so those are disabled for now
(both in the tests and as subcommands to `spack view`).
2024-10-07 16:05:23 -07:00
John W. Parent
717d4800e1
Qt package: Add Windows Port (#46788)
Also adds support for Paraview and CMake to build with Qt support on
Windows.

The remaining edits are to enable building of Qt itself on Windows:

* Several packages needed to update `.libs` to properly locate
  libraries on Windows
* Qt needed a patch to allow it to build using a Python with a space
  in the path
* Some Qt dependencies had not been ported to Windows yet
  (e.g. `harfbuzz` and `lcms`)

This PR does not provide a sufficient GL for Qt to use Qt Quick2, as
such Qt Quick2 is disabled on the Windows platform by this PR.

---------

Co-authored-by: Dan Lipsa <dan.lipsa@kitware.com>
2024-10-07 13:33:25 -07:00
Tamara Dahlgren
c77916146c
Bugfix/Installer: properly track task queueing (#46293)
* Bugfix/Installer: properly track task queueing
* Move ordinal() to llnl.string; change time to attempt
* Convert BuildTask to use kwargs (after pkg); convert STATUS_ to BuildStats enum
* BuildTask: instantiate with keyword only args after the request
* Installer: build request is required for initializing task
* Installer: only the initial BuildTask cannnot have status REMOVED
* Change queueing check
* ordinal(): simplify suffix determination [tgamblin]
* BuildStatus: ADDED -> QUEUED [becker33]
* BuildTask: clarify TypeError for 'installed' argument
2024-10-07 10:42:09 -07:00
Todd Gamblin
d763d6f738
gc: restrict to specific specs (#46790)
`spack gc` has so far been a global or environment-specific thing.
This adds the ability to restrict garbage collection to specific specs,
e.g. if you *just* want to get rid of all your unused python installations,
you could write:

```console
spack gc python
```

- [x] add `constraint` arg to `spack gc`
- [x] add a simple test

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-10-04 17:43:10 -07:00
Massimiliano Culpo
1756aeb45a
re2c: rework package to use multiple build systems (#46748)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-04 20:48:58 +03:00
Todd Gamblin
3c2a682876
Better docs and typing for _setup_pkg_and_run (#46709)
There was a bit of mystery surrounding the arguments for `_setup_pkg_and_run`. It passes
two file descriptors for handling the `gmake`'s job server in child processes, but they are
unsed in the method.

It turns out that there are good reasons to do this -- depending on the multiprocessing
backend, these file descriptors may be closed in the child if they're not passed
directly to it.

- [x] Document all args to `_setup_pkg_and_run`.
- [x] Document all arguments to `_setup_pkg_and_run`.
- [x] Add type hints for `_setup_pkg_and_run`.
- [x] Refactor exception handling in `_setup_pkg_and_run` so it's easier to add type
      hints. `exc_info()` was problematic because it *can* return `None` (just not
      in the context where it's used).  `mypy` was too dumb to notice this.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-10-03 14:36:53 -07:00
AcriusWinter
76243bfcd7
Stand-alone testing: remove deprecated methods (#45752)
* Stand-alone testing: remove deprecated methods
* audit: replace deprecated test method checks for test callbacks (AcriusWinter)
* install_test: replace deprecated with new test method name starts (AcriusWinter)
* package_base: removed deprecated test methods (AcriusWinter)
* test/package_class: remove deprecated test methods (AcriusWinter)
* test/reporters: remove deprecated test methods (AcriusWinter)
* reporters/extract: remove deprecated test-related methods (AcriusWinter)
* py-test-callback: rename test in callbacks and output (AcriusWinter)
* reporters/extract: remove deprecated expected failure output capture (AcriusWinter)
* stand-alone test cleanup: f-string, remove deprecation warning, etc. (AcriusWinter)
* stand-alone tests: f-string fix and remove unused imports (AcriusWinter)
* package_base: finish removing the rest of deprecated run_test method (AcriusWinter)
* py-test-callback: remove stand-alone test method (AcriusWinter)
* package_base: remove now unused imports (AcriusWinter)
* Python: test_imports replaces test (tldahlgren)
* mptensor, trivial-smoke-test: replace deprecated cache_extra_test_sources method (tldahlgren)
* trivial-smoke-test: replace deprecated install_test_root method (tldahlgren)
* docs: update perl and scons package's test methods (tldahlgren)
* builder: remove deprecated test() method (tldahlgren)
* Update legion and mfem test data for stand-alone tests (tldahlgren)
* py-test-callback: restore the test method
* Audit/stand-alone testing: Fix and added stand-alone test audit checks
   - fix audit failure message for build-time test callback check
   - remove empty test method check during stand-alone testing
   - change build-time test callback check to package_properties
   - add test method docstring audit check and mock fail-test-audit-docstring pkg
   - add test method implementation audit check and mock fail-test-audit-impl pkg
   - add new mock packages to test_package_audits and test_test_list_all
* audits: loosen docstring content constraints
* Add missing test method docstring
* py-test-callback: resolve builder issues
* Audits: Add checks for use of deprecated stand-alone test methods; improve output for other test-related checks
* Fix style issues
* test_test_list_all: add new fail-test-audit-deprecated package

---------

Signed-off-by: Tamara Dahlgren <dahlgren1@llnl.gov>
Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
2024-10-03 11:36:18 +00:00
kwryankrattiger
742e8142cf
Do not fail noop jobs in Spack CI (#46713) 2024-10-02 16:04:21 -06:00
Harmen Stoppels
fcf72201d3
aspell_dict: remove unused import (#46716) 2024-10-02 17:49:04 +02:00
Alec Scott
dcdc678b19
GoPackage: fix attributes to allow for custom build_directory values (#46707) 2024-10-02 06:23:13 -06:00
Andrew W Elble
4016172938
cuda: add conflict for aarch64 with gcc-13.2.0 and cuda@12.4 (#46694)
https://github.com/spack/spack/pull/39666#issuecomment-2377609263
2024-10-02 06:05:07 -06:00
Harmen Stoppels
8ccf244c6b
Revert "cc: ensure that RPATHs passed to linker are unique" (#46712)
* Revert "`cc`: ensure that RPATHs passed to linker are unique"

This reverts commit 2613a14c43.

* Revert "`cc`: simplify ordered list handling"

This reverts commit a76a48c42e.
2024-10-02 11:50:09 +02:00
Tamara Dahlgren
c8efea117f
Docs: environment update (#44087)
Updated the terminology for the two types of environments to be
consistent with that used in the tutorial for the last three years.

Additionally:
* changed 'anonymous' to 'independent in environment command+test for consistency.
2024-10-01 22:26:31 +02:00
Harmen Stoppels
e4f571b1ee
build_environment: small cleanup and add todo comments (#46687) 2024-10-01 18:35:23 +02:00
Harmen Stoppels
44618e31c8
stable_partition: use TypeVar (#46686) 2024-10-01 15:58:24 +02:00
Massimiliano Culpo
acce67241e
Do not use single letter packages in unit-tests (#46665)
#45205 already removed previous use of single letter packages
from unit tests, in view of reserving `c` as a language (see #45191).

Some use of them has been re-introduced accidentally in #46382, and
is making unit-tests fail in the feature branch #45189 since there
`c` is a virtual package.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-01 02:33:24 +00:00
Harmen Stoppels
02499c72c9
avoid rpath'ing default search paths (#44686)
On sysroot systems like gentoo prefix, as well as nix/guix, our "is
system path" logic is broken cause it's static.

Talking about "the system paths" is not helpful, we have to talk
about default search paths of the dynamic linker instead.

If glibc is recent enough, we can query the dynamic loader's default
search paths, which is a much more robust way to avoid registering
rpaths to system dirs, which can shadow Spack dirs.

This PR adds an **additional** filter on rpaths the compiler wrapper
adds, dropping rpaths that are default search paths. The PR **does
not** remove any of the original `is_system_path` code yet.

This fixes issues where build systems run just-built executables
linked against their *not-yet-installed libraries*, typically:

```
LD_LIBRARY_PATH=. ./exe
```

which happens in `perl`, `python`, and other non-cmake packages.
If a default path is rpath'ed, it takes precedence over
`LD_LIBRARY_PATH`, and a system library gets loaded instead
of the just-built library in the stage dir, breaking the build. If
default paths are not rpath'ed, then LD_LIBRARY_PATH takes
precedence, as is desired.

This PR additionally fixes an inconsistency in rpaths between
cmake and non-cmake packages. The cmake build system
computed rpaths by itself, but used a different order than
computed for the compiler wrapper. In fact it's not necessary
to compute rpaths at all, since we let cmake do that thanks to
`CMAKE_INSTALL_RPATH_USE_LINK_PATH`. This covers rpaths
for all dependencies. The only install rpaths we need to set are
`<install prefix>/{lib,lib64}`, which cmake unfortunately omits,
although it could also know these. Also, cmake does *not*
delete rpaths added by the toolchain (i.e. Spack's compiler
wrapper), so I don't think it should be controversial to simplify
things.
2024-09-30 20:32:50 +02:00
Alec Scott
5c8d22c597
Better shell completion support for packages (#44756) 2024-09-27 16:02:37 -07:00
Greg Becker
07e964c688
Spec.splice: Allow splices when multiples nodes in the DAG share a name (#46382)
The current `Spec.splice` model is very limited by the inability to splice specs that
contain multiple nodes with the same name.  This is an artifact of the original
algorithm design predating the separate concretization of build dependencies,
which was the first feature to allow multiple specs in a DAG to share a name.

This PR provides a complete reimplementation of `Spec.splice` to avoid that
limitation. At the same time, the new algorithm ensures that build dependencies
for spliced specs are not changed, since the splice by definition cannot change
the build-time information of the spec. This is handled by splitting the dependency
edges and link/run edges into separate dependencies as needed.

Signed-off-by: Gregory Becker <becker33@llnl.gov>
2024-09-27 13:58:43 -07:00
kwryankrattiger
35b2750407
CI: Add documentation for adding new stacks and runners (#42179)
* CI: Add documentation for adding new stacks and runners
* More docs for runner registration

---------

Co-authored-by: Zack Galbreath <zack.galbreath@kitware.com>
Co-authored-by: Bernhard Kaindl <contact@bernhard.kaindl.dev>
2024-09-27 13:09:41 -07:00
Massimiliano Culpo
639854ba8b
spec: simplify string formatting (#46609)
This PR shorten the string representation for concrete specs,
in order to make it more legible.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-09-27 12:59:14 -07:00
Alec Scott
9b5f15abec
docs: add --depth=2 to reduce download size (#46605)
* docs: add --depth=2 to reduce download size

* Add note to tell users about --depth=2 and manyFiles

* Fix inline code in info block
2024-09-27 09:09:19 -07:00
Todd Gamblin
2613a14c43 cc: ensure that RPATHs passed to linker are unique
macOS Sequoia's linker will complain if RPATHs on the CLI are specified more than once.
To avoid errors due to this, make `cc` only append unique RPATHs to the final args list.

This required a few improvements to the logic in `cc`:

1. List functions in `cc` didn't have any way to append unique elements to a list. Add a
   `contains()` shell function that works like our other list functions. Use it to implement
   an optional `"unique"` argument to `append()` and an `extend_unique()`. Use that to add
   RPATHs to the `args_list`.

2. In the pure `ld` case, we weren't actually parsing `RPATH` arguments separately as we
   do for `ccld`. Fix this by adding *another* nested case statement for raw `RPATH`
   parsing. There are now 3 places where we deal with `-rpath` and friends, but I don't
   see a great way to unify them, as `-Wl,`, `-Xlinker`, and raw `-rpath` arguments are
   all ever so slightly different.

3. Fix ordering of assertions to make `pytest` diffs more intelligible. The meaning of
   `+` and `-` in diffs changed in `pytest` 6.0 and the "preferred" order for assertions
   became `assert actual == expected` instead of the other way around.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-09-27 05:27:26 -07:00
Todd Gamblin
a76a48c42e cc: simplify ordered list handling
`cc` divides most paths up into system paths, spack managed paths, and other paths.
This gets really repetitive and makes the code hard to read. Simplify the script
by adding some functions to do most of the redundant work for us.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-09-27 05:27:26 -07:00
Richard Berger
7d6231b38a
aspell: various fixes and updates (#46383)
SimpleFilesystemView was producing an error due to looking for a
<prefix>/lib/.spack folder. Also, view_destination had no effect and
wasn't called. Changed this by instead patching in the correct
installation prefix for dictionaries.

Since aspell is using the resolved path of the executable prefix, the
runtime environment variable ASPELL_CONF is set to correct the prefix
when in a view. With this change aspell can now find installed
dictionaries. Verified with:

aspell dump config
aspell dump dicts
2024-09-27 10:48:08 +02:00
psakievich
ea6e39805a
Add a custom hook for dev_path changes (#46529)
* Add a custom hook for dev_path changes

Co-authored-by: Greg Becker <becker33@llnl.gov>
2024-09-26 08:59:13 -07:00
Harmen Stoppels
f01dbe2c35
Remove a few redundant imports (#46512) 2024-09-25 10:05:11 +02:00
Samuel Browne
022eca1cfe
Fix off-by-one padding bug (#46560)
If `add_padding()` is allowed to return a path with a trailing path
separator, it will get collapsed elsewhere in Spack. This can lead to
buildcache entries that have RPATHS that are too short to be replaced by
other users whose install root happens to be padded to the correct
length.  Detect this and replace the trailing path separator with a
concrete path character.

Signed-off-by: Samuel E. Browne <sebrown@sandia.gov>
2024-09-24 15:37:52 -06:00
Todd Gamblin
c070ddac97
database: don't call socket.getfqdn() on every write (#46554)
We've seen `getfqdn()` cause slowdowns on macOS in CI when added elsewhere. It's also
called by database.py every time we write the DB file.

- [x] replace the call with a memoized version so that it is only called once per process.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-09-23 23:59:07 -07:00
Massimiliano Culpo
679770b02c
solver: use a new heuristic (#46548)
This PR introduces a new heuristic for the solver, which behaves better when
compilers are treated as nodes. Apparently, it performs better also on `develop`,
where compilers are still node attributes.

The new heuristic:
- Sets an initial priority for guessing a few attributes. The order is "nodes" (300), 
  "dependencies" (150), "virtual dependencies" (60), "version" and "variants" (30), and
  "targets" and "compilers" (1). This initial priority decays over time during the solve, and
  falls back to the defaults.

- By default, it considers most guessed facts as "false". For instance, by default a node
  doesn't exist in the optimal answer set, or a version is not picked as a node version etc.

- There are certain conditions that override the default heuristic using the _priority_ of
  a rule, which previously we didn't use. For instance, by default we guess that a
  `attr("variant", Node, Variant, Value)` is false, but if we know that the node is already
  in the answer set, and the value is the default one, then we guess it is true.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-09-23 23:44:47 -07:00
Justin Cook
971577d853
spec: fix spelling (#46550)
Signed-off-by: Justin Cook <jscook@lbl.gov>
2024-09-24 07:06:54 +02:00
Massimiliano Culpo
b93c57cab9
Remove spack.target from code (#46503)
The `spack.target.Target` class is a weird entity, that is just needed to:

1. Sort microarchitectures in lists deterministically
2. Being able to use microarchitectures in hashed containers

This PR removes it, and uses `archspec.cpu.Microarchitecture` directly. To sort lists, we use a proper `key=` when needed. Being able to use `Microarchitecture` objects in sets is achieved by updating the external `archspec`.

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-09-21 14:05:41 +02:00
John W. Parent
cfee88a5bb
Docs/Windows: Clarify supported shells and caveats (#46381)
While the existing getting started guide does in fact reference the
powershell support, it's a footnote and easily missed. This PR adds
explicit, upfront mentions of the powershell support. Additionally
this PR adds notes about some of the issues with certain components
of the spec syntax when using CMD.
2024-09-20 11:55:17 -07:00
Harmen Stoppels
7711730f2c
spack.modules: move get_module up (#46428) 2024-09-20 19:30:09 +02:00
Massimiliano Culpo
b28583bc58
Remove code from Compiler that is not used anymore (#45982)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-09-20 10:00:34 +02:00
Tamara Dahlgren
f9f6f094c3
do_install: post #46423 cleanup (#46496) 2024-09-20 09:45:31 +02:00
Harmen Stoppels
e4927b35d1
package_base: break dependency on installer (#46423)
Removes `spack.package_base.PackageBase.do_{install,deprecate}` in favor of
`spack.installer.PackageInstaller.install` and `spack.installer.deprecate` resp.

That drops a dependency of `spack.package_base` on `spack.installer`, which is
necessary to get rid of circular dependencies in Spack.

Also change the signature of `PackageInstaller.__init__` from taking a dict as
positional argument, to an explicit list of keyword arguments.
2024-09-19 23:25:36 +02:00
Harmen Stoppels
db7aece186
require spec in develop entry (#46485) 2024-09-19 20:11:22 +02:00
Harmen Stoppels
1d18f571ae
url join: fix oci scheme (#46483)
* url.py: also special case oci scheme in join

* avoid fetching keys from oci mirror
2024-09-19 16:06:44 +02:00