Commit Graph

7651 Commits

Author SHA1 Message Date
Harmen Stoppels
2c51b5853f
spack.package: re-export EnvironmentModifications / Prefix (#48792) 2025-01-31 08:20:15 +01:00
Harmen Stoppels
d0cbd056a8
spack.package: wrap llnl.util.tty (#48793)
avoid import of llnl.util.tty in packages
2025-01-31 08:17:29 +01:00
Harmen Stoppels
b02dcf697d
Move from python2 compliant IOError and EnvironmentError to python3-only OSError (#48764)
* IOError -> OSError

* also do EnvironmentError
2025-01-30 09:32:57 -08:00
Tamara Dahlgren
2da8a1d1e3
Docs/bugfix: correct return for Adding flags to configure (#48434) 2025-01-29 13:04:22 -08:00
Massimiliano Culpo
3d82e5c573
Remove pipelines and images based on ppc64le (#48767) 2025-01-29 16:36:25 +01:00
Harmen Stoppels
92260b179d
package api: drop wildcard re-export (#48760)
* package api: drop wildcard re-export

To ensure package repos are forward/backward compatibility with Spack,
we should explicitly export all symbols we want to expose in the public
package API, and drop `from spack.something import *` because
removal/addition to the public API will go unnoticed.

Also `llnl.util.filesystem` has some methods that shouldn't be exposed
in the package API, so better to enumerate a subset explicitly.

* remove flatten_dependencies / install_dependency_symlinks
2025-01-29 15:00:39 +01:00
Massimiliano Culpo
196c912b8a
Deprecate frontend/backend os/target (#47756) 2025-01-29 13:22:51 +01:00
Massimiliano Culpo
40a1da4a73
spec.py: fix ArchSpec.intersects (#48741)
fixes a bug where `x86_64:` and `ppc64le:` intersected, and x86_64: and :haswell did not.
2025-01-28 16:46:09 +01:00
Harmen Stoppels
c054cb818d
import os.path -> os (#48709) 2025-01-28 09:45:43 +01:00
Dom Heinzeller
22ba366e85
Fix creating a bootstrap mirrors (#48252)
Regressed in #47126 

Spack was not interpreting mirrors using relative path with respect to the
metadata directory.

---------

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-01-27 22:37:29 +00:00
Massimiliano Culpo
13558269b5
Fix a few minor issues in tests (#48735)
* test_no_matching_compiler_specs: does not need mock_low_high_config,
  since mutable_config is already used at class level
* bindist.py: setup a configuration that doesn't super-impose builtin.mock
  over builtin
* builder.py: use a mock configuration for the tests
2025-01-27 23:36:27 +01:00
Joe
c764400338
Allowing environment variables to be set in a spack.yaml (#47587)
This adds a new configuration section called `env_vars:` that can be set in an environment.

It looks very similar to the existing `environment:` section that can be added to `modules.yaml`,
but it is global for an entire spack environment. It's called `env_vars:` to deconflate it with spack
environments (the term was too overloaded).

The syntax looks like this:

```yaml
spack:
  specs:
    - cmake%gcc
  env_vars:
    set:
      ENVAR_SET_IN_ENV_LOAD: "True"
```

Any of our standard environment modifications can be added to the `env_vars` section, e.g.
`prepend_path:`, `unset:`, `append_path:`, etc.  Operations in `env_vars:` are performed
on `spack env activate` and undone on `spack env deactivate`.
2025-01-27 12:20:22 -08:00
Alec Scott
ebc9f03dda
Go build system: reduce resulting installation sizes (#47943)
* Reduce the size of outputted go built binaries
* Remove unused import from go package
* go: remove comment from setup dependents build env
* Add back missing imports after rebase
2025-01-27 11:32:56 -08:00
Alec Scott
8ac0bd2825
GoPackage: respect -j concurrency (#48421) 2025-01-27 12:58:29 -05:00
Tara Drwenski
cc9e0137df
Initialize deque with path string (#48734) 2025-01-27 17:42:29 +01:00
Harmen Stoppels
c6202842ed
Improve error handling in urlopen / socket read (#48707)
* Backward compat with Python 3.9 for socket.timeout
* Forward compat with Python [unknown] as HTTPResponse.geturl is deprecated
* Catch timeout etc from .read()
* Some minor simplifications: json.load(...) takes file object in binary mode.
* Fix CDash code which does error handling wrong: non-2XX responses raise.
2025-01-27 16:59:05 +01:00
Greg Becker
0ec00a9c9a
rewiring.py: eliminate code duplication from bindist (#48723) 2025-01-27 10:09:04 +01:00
psakievich
5e3020ad02
filesystem.py: fix recursive_mtime_greater_than (#48718) 2025-01-26 08:29:29 +01:00
Harmen Stoppels
25a3e8ba59
Remove unused Tokenizer.full_match (#48650) 2025-01-24 15:53:42 +01:00
Juan Miguel Carceller
f95e27a159
SIPPackage: add gmake as a build dependency to be able to build py-pyqt5 (#48660) 2025-01-23 15:51:59 +01:00
Massimiliano Culpo
2db654bf5a
Define the DB index file name in a single place (#48681) 2025-01-23 12:17:34 +01:00
Harmen Stoppels
9992b563db
Improve spack.build_systems typing (#48590) 2025-01-23 12:15:43 +01:00
Harmen Stoppels
daba1a805e
build_environment.py: clear CONFIG_SITE for configure scripts (#48690)
Should be sufficient to set CONFIG_SITE to /dev/null before running configure to 
prevent any config site file to be loaded, which currently causes non-determinism in builds.

Setting the variable CONFIG_SITE prevents configure files to check $prefix/share/config.site, 
$prefix/etc/config.site, $ac_default_prefix/share/config.site, $ac_default_prefix/etc/config.site 
so we don't have to patch a block of code.
2025-01-23 11:45:52 +01:00
Tara Drwenski
518572e710
Use gcc toolchain when using hip and gcc host compiler (#48632) 2025-01-22 23:37:24 -08:00
jnhealy2
aba0a740c2
Address quoting issue impacting dev_paths containing @ symbols (#48555)
* Address quoting issue that casuses dev_paths containing @ symbols to parse as versions

* Fix additional location were dev_path was imporperly constructed

The dev_path must be quoted to avoid parsing issues when
paths contain '@' symbols. Also add tests to catch
regression of this behavior

* Format to fix line length

* fix failing tests

* Fix whitespace error

* Add binary_compatibility fixture to test

* Change string formatting to avoid multiline f string

* Update lib/spack/spack/test/concretization/core.py

* Add tmate debug session

* Revert "Add tmate debug session"

This reverts commit 24e2f77e3c.

* Move test and refactor to use env methods

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

---------

Co-authored-by: psakievich <psakiev@sandia.gov>
2025-01-22 18:03:13 +01:00
Harmen Stoppels
0fe8e763c3
bootstrap: do not show disabled sources as errors if enabled sources fail (#48676) 2025-01-22 17:02:23 +01:00
Harmen Stoppels
0e2d261b7e
bootstrap/status.py: remove make (#48677) 2025-01-22 17:00:25 +01:00
Harmen Stoppels
87a83db623
autotools.py: set lt_cv_apple_cc_single_mod=yes (#48671)
Since macOS 15 `ld -single_module` warns with a deprecation message,
which makes configure scripts believe the flag is unsupported. That
in turn triggers a code path where `archive_cmds` is set to

```
$CC -r -keep_private_externs -nostdlib ... -dynamiclib
```

instead of just

```
$CC -dynamiclib ...
```

This code path was meant to trigger only on ancient macOS <= 14.4 where
libtool had to add `-single_module`, which is the default since macos
14.4, and is now apparently deprecated because the flag is a no-op for
more than 15 years.

The wrong `archive_cmds` causes actual problems combined with a bug in
OpenMPI's compiler wrapper (`CC=mpicc`), which appends `-rpath` flags,
which cause an error when combined with the `-r` flag added by the
autotools.

Spack's compiler wrapper doesn't do this, but it's likely there are
other compiler wrappers out there that are not aware that `-r` and
`-rpath` cannot be combined.

The fix is to change defaults: `lt_cv_apple_cc_single_mod=yes`.
2025-01-22 11:29:50 +01:00
Harmen Stoppels
70df460fa7
PackageBase.detect_dev_src_change: speed up (#48618) 2025-01-21 16:48:37 +01:00
Harmen Stoppels
31a1b2fd6c
relocate.py, binary_distribution.py: cleanup (#48651) 2025-01-21 15:45:08 +01:00
Harmen Stoppels
ecd14f0ad9
archive.py: fix include_parent_directories=True with path_to_name (#48570) 2025-01-20 10:21:32 +01:00
Massimiliano Culpo
783eccfbd5
jsonschema: use draft7 validator and simplify schemas (#48621) 2025-01-20 09:51:29 +01:00
Harmen Stoppels
7e41288ca6
spack_yaml.py / spec.py: use dict instead of OrderedDict (#48616)
* for config: let `syaml_dict` inherit from `dict` instead of `OrderedDict`. `syaml_dict` now only exists as a mutable wrapper for yaml related metadata.
* for spec serialization / hashing: use `dict` directly

This is possible since we only support cpython 3.6+ in which dicts are ordered.

This improves performance of hash computation a bit. For a larger spec I'm getting 9.22ms instead of 11.9ms, so 22.5% reduction in runtime.
2025-01-20 17:33:44 +09:00
Tara Drwenski
3bb375a47f
Change llvm-amdgpu to a build dependency of rocm (#48612) 2025-01-20 17:28:15 +09:00
Harmen Stoppels
962498095d
compat with mypy 1.14 (#48626)
* OSError.errno apparently is int | None, but already part of __str__ anyway so drop

* fix disambiguate_spec_from_hashes

* List[Spec].sort() complains, ignore it

* fix typing of KnownCompiler, and use it in asp.py
2025-01-18 21:16:05 +01:00
John Gouwar
9f7cff1780
Stable splice-topo order for resolving splicing (#48605)
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-01-17 16:27:16 +01:00
Harmen Stoppels
bb43fa5444
spec.py: make hashing of extra_attributes order independent (#48615) 2025-01-17 13:50:36 +01:00
Massimiliano Culpo
59a71959e7
Fix wrong hash in spliced specs, and improve unit-tests (#48574)
Modifications:
* Fix a severe bug where a spliced spec has the same hash as the original build spec
* Removed CacheManager in favor of install_mockery. The latter sets up a temporary store, and removes it at the end 
   of the test.
* Deleted a couple of helper functions e.g. _has_dependencies
* Checked that SolverException is raised, rather than Exception (more specific)
* Extended, and renamed the splicing_setup fixture (now called install_specs)
* Added more specific assertions in each test

One test is currently flaky, due to some instability when sorting multiple specs. It's currently marked xfail
2025-01-15 19:43:55 +01:00
Harmen Stoppels
00e804a94b
package.py: expose types of common globals unconditionally (#48588) 2025-01-15 17:33:38 +01:00
Massimiliano Culpo
6fac041d40
Add type-hints to which and which_string (#48554) 2025-01-15 15:24:18 +01:00
Jordan Galby
c504304d39
Add version attributes up_to_1, up_to_2, up_to_3 (#38410)
Making them also available in spec format string
2025-01-15 13:07:17 +01:00
Harmen Stoppels
976f1c2198
flag_mixing.py: add missing import (#48579) 2025-01-15 10:48:34 +01:00
Greg Becker
e7c591a8b8
Deprecate Spec.concretize/Spec.concretized in favor of spack.concretize.concretize_one (#47971)
The methods spack.spec.Spec.concretize and spack.spec.Spec.concretized
are deprecated in favor of spack.concretize.concretize_one.

This will resolve a circular dependency between the spack.spec and
spack.concretize in the next Spack release.
2025-01-15 10:13:19 +01:00
jclause
335fca7049
Improve support using external modules with zsh (#48115)
* Improve support using external modules with zsh

Spack integrates with external modules by launching a python subprocess
to scrape the path from the module command. In zsh, subshells do not
inheret functions defined in the parent shell (only environment
variables). This breaks the module function in module_cmd.py.

As a workaround, source the module commands using $MODULESHOME prior to
running the module command.

* Fix formatting

* Fix flake error

* Add guard around sourcing module file

* Add improved unit testing to module src command

* Correct style

* Another attempt at style

* formatting again

* formatting again

---------

Co-authored-by: psakievich <psakiev@sandia.gov>
2025-01-14 21:29:15 -07:00
Greg Becker
2447d16e55
bugfix: associate nodes directly with specs for compiler flag reordering (#48496) 2025-01-14 10:15:57 -08:00
Harmen Stoppels
d72b371c8a
relocate_text: fix return value (#48568) 2025-01-14 13:29:06 +01:00
Todd Gamblin
d89ae7bcde
Database: make constructor safe for read-only filesystems (#48454)
`spack find` and other commands that read the DB will fail if the databse is in a
read-only location, because `FailureTracker` and `Database` can try to create their
parent directories when they are constructed, even if the DB root is read-only.

Instead, we should only write to the filesystem when needed.

- [x] don't create parent directories in constructors
- [x] have write operations create parents if needed
- [x] in tests, `chmod` databases to be read-only unless absolutely needed.

---------

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2025-01-14 00:10:51 -08:00
Harmen Stoppels
53d1665a8b
traverse: use deque and popleft (#48353)
Avoids a quadratic time operation. In practice it is not really felt, cause it has a tiny constant.
But maybe in very large DAGs it is.
2025-01-14 00:09:57 -08:00
Cody Balos
66e8523e14
add long_spec property to get fully enumerated spec string (#48389) 2025-01-13 16:43:39 -08:00
Tamara Dahlgren
f556ba46d9
bugfix/r: git property needs to be classproperty (#48228) 2025-01-13 12:14:26 -06:00
Harmen Stoppels
064e70990d
binary_distribution.py: stop relocation old /bin/bash sbang shebang (#48502) 2025-01-13 09:30:18 +01:00
Massimiliano Culpo
8ab6f33eb6
Deprecate make, gmake and ninja globals in package API (#48450)
Instead, depends_on("gmake", type="build") should be used, which makes the global available through `setup_dependent_package`.
2025-01-11 22:43:22 +01:00
Massimiliano Culpo
dd69b646ad
Add subscript notation to packages (#48467)
This PR allows using the subscript notation directly on packages. The
intent is to reduce the boilerplate needed to retrieve package
properties from nodes other than root.
2025-01-10 19:00:51 +01:00
Harmen Stoppels
d6d8800466
executable.py: fix overlapping overload set (#48503) 2025-01-10 16:34:04 +00:00
Harmen Stoppels
d46ac9b1e4
spec.py: fix return type of concretized() (#48504) 2025-01-10 13:31:41 +00:00
Harmen Stoppels
7edb525599
binary_distribution: improve deps_to_relocate (#48484) 2025-01-10 11:32:11 +01:00
Harmen Stoppels
93cd216603
binary_distribution: stop relocating tarballs with relative rpaths (#48488) 2025-01-10 11:30:18 +01:00
Harmen Stoppels
c1d385ada2
traverse: use overload for return type when depth=True vs depth=False (#48482) 2025-01-10 09:53:28 +01:00
Massimiliano Culpo
5085f635dd
Add type hints to spack.util.executable.Executable (#48468)
* Add type-hints to `spack.util.executable.Executable`
* Add type-hint to input
* Use overload, and remove assertions at calling sites
* Bump mypy to v1.11.2 (working locally), Python to 3.13
2025-01-09 14:16:24 -08:00
dependabot[bot]
e76677cbd5
build(deps): bump pygments from 2.18.0 to 2.19.1 in /lib/spack/docs (#48431)
Bumps [pygments](https://github.com/pygments/pygments) from 2.18.0 to 2.19.1.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.18.0...2.19.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-09 11:31:42 +01:00
Harmen Stoppels
c424611010
directory_layout.py: remove dependency on global spack.store.STORE (#48460) 2025-01-08 17:44:32 +01:00
Harmen Stoppels
fa9ef0ac89
config.py: deprecate config:install_path_scheme (#48463) 2025-01-08 16:02:11 +01:00
Harmen Stoppels
55d9fe20e5
warnings.showwarning: set earlier (#48462)
Co-authored-by: haampie <haampie@users.noreply.github.com>
2025-01-08 07:27:22 -07:00
Harmen Stoppels
434a8d54d4
directory_layout: types and remove kwargs (#48459) 2025-01-08 14:09:36 +01:00
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