Compare commits

...

304 Commits

Author SHA1 Message Date
Harmen Stoppels
10acffc92e fix incorrect type annotation of spack.provider_index._IndexBase.providers 2025-01-29 17:38:13 +01:00
Harmen Stoppels
f95e246355 index: avoid quadratic complexity through bulk update 2025-01-29 17:14:34 +01:00
Harmen Stoppels
a77f903f4d py-cmake: remove. remove deprecated cmake versions (#48763) 2025-01-29 15:06:32 +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
G-Ragghianti
0f54995e53 MAGMA: add v2.9.0 (#48750) 2025-01-29 00:17:37 -07:00
Filippo Spiga
9d1332f1a1 ucx: adding 1.18.0 (#48742)
* Adding UCX 1.18.0
* Verified and correct hash.
2025-01-28 09:26:19 -07: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
Satish Balay
82e091e2c2 petsc+rocm: add dependency on hipblas-common (#48644) 2025-01-28 09:45:12 -06:00
Thomas-Ulrich
c86112b0e8 update hypre version and add new memalign for petsc (#47831) 2025-01-28 09:42:42 -06:00
jmuddnv
bb25c04845 Changes for NVIDIA HPC SDK 25.1 (#48696) 2025-01-28 07:05:33 -07:00
Buldram
d69d26d9ce toybox: add v0.8.12 (#48657) 2025-01-28 14:47:22 +01:00
snehring
06d660b9ba autodock-vina: adding version 1.2.6 (#48684)
Signed-off-by: Shane Nehring <snehring@iastate.edu>
2025-01-28 14:28:28 +01:00
snehring
40b3196412 py-ipyrad: adding version 0.9.102 (#48686)
Signed-off-by: Shane Nehring <snehring@iastate.edu>
2025-01-28 14:27:16 +01:00
Juan Miguel Carceller
7e893da4a6 thepeg: extend the rivet@:3 dependency up to version 2.3 (#48691)
Co-authored-by: jmcarcell <jmcarcell@users.noreply.github.com>
2025-01-28 14:25:02 +01:00
David Schneller
13aa8b6867 easi: add v1.5.1; relax yaml-cpp and lua requirements (#48675) 2025-01-28 14:23:57 +01:00
Adam J. Stewart
b0afb619de py-geemap: add new package (#48602) 2025-01-28 14:12:25 +01:00
Adam J. Stewart
7a82c703c7 JAX: add v0.4.32+ (#46346)
* JAX: add v0.4.34

* Disable search for clang

* Update CUDA flags

* Add py-jax 0.4.33, comment out until py-jaxlib 0.4.33 is also released

* Fix GCC build

* Try TF_NVCC_CLANG

* py-jax: add v0.4.34

* jax no longer has separate tags for jaxlib

* Install compiled wheel

* Join path before glob

* Wheel is in spack stage, not tmp path

* Add 0.4.35

* Add newer versions

* Build system has been refactored yet again

* Drop clang

* Fix build with source tarball, rocm support

* Support GCC

* Remove clang-specific compiler flags

* enable_cuda flag was removed

* Fix logic

* py-jax: add v0.4.38

* Add patch to fix GCC support

* Patch no longer needed

* Skip patching, directly pass flags

* New flags

* Remove unused import

* Patch changed

* Use older version of patch

* Newer patch

* Add CUDA symlink

* Symlink more directories

* Recursive symlink

* Import function

* Recursive search

* Undo cuda changes

* Add v0.5.0

* I quit
2025-01-28 13:37:50 +01:00
G-Ragghianti
0d3667175a papi: fix error finding gmake during post-install testing (#48592) 2025-01-28 12:51:10 +01:00
Wouter Deconinck
a754341f6c hep stack: additional event generator packages (#48565)
* hep stack: additional event generator packages

* hep: adidtional packages

* hep: collier doesn't have +pic +shared

* py-awkward-cpp: fix scikit-build-core range of applicability

* hep: disable agile

* hep: disable garfieldpp and genie

* py-wxpython: depends_on pkgconfig even if using external wxwidgets

* hep: disable professor
2025-01-28 05:38:58 -06:00
Thomas Bouvier
a50c45f00c py-flash-attn: add missing triton dependency (#48645) 2025-01-28 11:43:27 +01:00
Sreenivasa Murthy Kolam
87e65e5377 Bump up the version for rocm-6.3.1 release (#48440)
This PR updates the versions for the rocm recipes for rocm-6.3.1 release.
2025-01-28 01:53:55 -08:00
Etienne Ndamlabin
50fe96aaf6 damaris: add v1.12.0, update maintainers (#48674)
Co-authored-by: Etienne Ndamlabin <jean-etienne.ndamlabin-mboula@inria.fr>
2025-01-28 10:13:21 +01:00
Rocco Meli
56495a8cd8 dftd4, mctc-lib: enable cmake builds and add multicharge package (#48594)
* enable cmake builds

* [@spackbot] updating style on behalf of RMeli

* Update var/spack/repos/builtin/packages/dftd4/package.py

Co-authored-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>

* Update var/spack/repos/builtin/packages/mctc-lib/package.py

* include

* fix

* use sha256

* update

---------

Co-authored-by: RMeli <RMeli@users.noreply.github.com>
Co-authored-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>
2025-01-28 09:53:22 +01:00
Harmen Stoppels
c054cb818d import os.path -> os (#48709) 2025-01-28 09:45:43 +01:00
Benjamin Meyers
bc28ec35d1 py-ogb: update version (#48740) 2025-01-27 17:10:53 -07:00
Massimiliano Culpo
e47a6059a7 Improve definition of a few placeholder packages (#48730)
* Improve definition of a few placeholder packages
   These packages are placeholders for vendor provided software,
   that is not buildable, and should be declared as external.
* ibm-java: remove package, as asked by maintainer
2025-01-27 15:34:34 -08:00
Matt Thompson
0d170b9ef3 mapl: fix too strict oneapi conflict (#48743)
* mapl: fix too strict oneapi conflict
* Use older style
* Add diag-disable flag
* Updates from Dom
2025-01-27 15:14:38 -08:00
Garth N. Wells
5174cb9180 Add nanobind 2.4.0 (#48721) 2025-01-27 15:07:11 -08: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
Stephen Nicholas Swatman
615b7a6ddb geomodel: Add version 6.8.0 (#48727)
This commit adds version 6.8.0 of GeoModel. As far as I can tell from
the change notes, there are no changes required to the build
configuration or dependencies.
2025-01-27 14:09:12 -08:00
Dennis Klein
0415b21d3d fairmq: add v1.9.1 (#48724) 2025-01-27 14:08:32 -08:00
Matthieu Dorier
053c9d2846 librdkafka: added version 2.6.1 and 2.8.0 (#48725) 2025-01-27 14:06:58 -08:00
Harmen Stoppels
1e763629f6 dealii: add vtk backward compat bound (#48744) 2025-01-27 15:00:32 -07:00
Harmen Stoppels
7568687f1e vtk: fix incorrect detection of -fvisibility (#48737) 2025-01-27 22:12:40 +01:00
Vicente Bolea
3b81c0e6b7 zfp: add smoke test (#48598) 2025-01-27 12:33:11 -08: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
Mikael Simberg
4e8a6eec1a fmt: Add 11.1.3 (#48726) 2025-01-27 13:03:43 -07: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
Adam J. Stewart
b8e448afa0 py-timm: add v1.0.14 (#48648) 2025-01-27 11:16:37 -05:00
Adam J. Stewart
209d670bf3 py-scikit-image: add v0.25.1 (#48728) 2025-01-27 11:13:41 -05: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
Taillefumier Mathieu
b2a75db030 Force rocm dependency on hipfft with +rocm is given (#48211)
Make sure that hipfft+rocm is explicit when +rocm is true.

Co-authored-by: Rocco Meli <r.meli@bluemail.ch>
2025-01-27 11:33:31 +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
Dave Keeshan
a0d0e6321f verible: v0.0.3929 (#48701) 2025-01-25 13:32:21 -07:00
Dave Keeshan
0afac0beaa yosys: add v0.49 (#48700) 2025-01-24 12:36:19 -08:00
Thomas-Ulrich
6155be8548 New Package: PUMGen (#48705)
* add pumgen package
* remove netcdf variant
* remove scorec variant, move zoltan dep
* fix license
2025-01-24 12:32:21 -08:00
Matt Thompson
611cb98b02 mapl: add v2.53.0 (#48712) 2025-01-24 13:09:14 -07:00
Mark W. Krentel
ea5742853f hpcviewer: add version 2025.01 (#48670) 2025-01-24 10:52:18 -08:00
Harmen Stoppels
25a3e8ba59 Remove unused Tokenizer.full_match (#48650) 2025-01-24 15:53:42 +01:00
Mikael Simberg
7fbb3df6b0 Revert "pika: Add conflict between HIP and GCC (libstdc++) >= 13 (#46291)" (#48693)
The conflict is too strict and prevents usable combinations from being
concretized. Some packages depend on pika, but do not include pika
headers in HIP device code files, and can thus be compiled even with the
bad combination of HIP and GCC versions.
2025-01-24 07:35:11 -07:00
AMD Toolchain Support
a728db95de Allow scipy to be built with AOCC again (#48505)
Co-authored-by: Phil Tooley <phil.tooley@amd.com>
2025-01-24 11:13:47 +01:00
Juan Miguel Carceller
7bc4069b9e py-awkward: add dependency for py-importlib-metadata (#47027)
* py-awkward: add dependency on py-importlib-metadata and py-fsspec
* Implement suggested constraint and dependency type changes

---------

Co-authored-by: jmcarcell <jmcarcell@users.noreply.github.com>
2025-01-23 16:22:28 -08:00
Dom Heinzeller
51fc195d14 Fix var/spack/repos/builtin/packages/ectrans/package.py: instead of declaring a conflict with Intel LLVM compilers, apply patch from upstream (#48687) 2025-01-23 16:18:48 -08:00
Harmen Stoppels
27a0593104 openmpi: do not pass --with-wrapper-ldflags (#48673)
On macOS you cannot unconditionally pass `-rpath`, it can conflict with
`-r`.

mpicc is not the place to inject rpaths to compiler runtime
libraries. That's up to the compiler's config files (spec files in gcc,
config files in llvm).

Also remove some patches that are redundant in newer versions of
openmpi.
2025-01-23 15:53:49 +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
Valentin Volkl
effe433c96 gaudi: set GAUDI_PLUGIN_PATH for runtime on macos (#48039)
* set GAUDI_PLUGIN_PATH

* [@spackbot] updating style on behalf of vvolkl

---------

Co-authored-by: vvolkl <vvolkl@users.noreply.github.com>
2025-01-23 07:55:21 -06:00
Juan Miguel Carceller
21988fbb18 pandoramonitoring: add patch for compiling with C++20 (#48659)
* pandoramonitoring: add patch for compiling with C++20

* Fix patch for PandoraMonitoring

---------

Co-authored-by: jmcarcell <jmcarcell@users.noreply.github.com>
2025-01-23 06:25:26 -06: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
Wouter Deconinck
832bf95aa4 fmt: add v11.1.{1,2}; spdlog: add v1.15.0 (#48402)
* fmt: add v11.1.1

* spdlog: add v1.15.0

* spdlog: terminate string

* fmt: add v11.1.2

* spdlog: apply fmt-11.1 support patch up to 1.15.0

* spdlog: add prereq patch to ensure intended patch applies cleanly

* spdlog: fix patch checksum
2025-01-23 09:34:20 +01:00
Wouter Deconinck
81e6dcd95c gaudi: add v39.2; CUDA support (#48557)
* gaudi: add v39.2; CUDA support
* gaudi: CUDAPackage -> CudaPackage
2025-01-23 08:41:38 +01:00
Tara Drwenski
518572e710 Use gcc toolchain when using hip and gcc host compiler (#48632) 2025-01-22 23:37:24 -08:00
Sinan
6f4ac31a67 alps: add new package (#48183) 2025-01-22 14:57:19 -07:00
Victor A. P. Magri
e291daaa17 Add OpenMP dependency to Kokkos and KokkosKernels (#48455)
* Add OpenMP dependency to Kokkos and KokkosKernels

* Add Chris' suggestions
2025-01-22 12:53:41 -07:00
Seth R. Johnson
58f1e791a0 Celeritas: new version 0.5.1 (#48678)
* Celeritas: add version 0.5

* Fix style

* Un-deprecate non-awful versions
2025-01-22 11:03:48 -07: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
Matthieu Dorier
85cb234861 pmdk: add cmake dependency back (#48664) 2025-01-22 14:44:04 +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
Taillefumier Mathieu
e1e17786c5 sirius: libxc 7 forward compat (#48663) 2025-01-22 11:27:19 +01:00
eugeneswalker
68af5cc4c0 e4s ci stacks: add libceed (#48668) 2025-01-21 14:13:55 -08: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
moloney
f8fd51e12f BF+ENH: Add wxwidgets 3.2.6 and py-wxpython 4.2.2, missing pkgconfig dep (#48597)
* BF+ENH: Add wxwidgets 3.2.6 and py-wxpython 4.2.2

Improves compat with newer Python (>3.9) and numpy.

Fix error during configure step (even on at least some older
versions) by including 'pkgconfig' as a build dep so gtk+ is found.

* BF: Make wxpython use spack built wxwidgets instead of rebuilding

* Update var/spack/repos/builtin/packages/py-wxpython/package.py

Avoid using too new version of py-setuptools as license file format is currently not compatible.

Co-authored-by: Wouter Deconinck <wdconinc@gmail.com>

---------

Co-authored-by: Wouter Deconinck <wdconinc@gmail.com>
2025-01-20 21:01:47 -06:00
Mirko Rahn
12784594aa gpi-space: add v24.12 (#48361) 2025-01-20 11:47:56 -07:00
Massimiliano Culpo
e0eb0aba37 netlib-lapack: add v3.12.1 (#48318)
Co-authored-by: Wouter Deconinck <wdconinc@gmail.com>
2025-01-20 18:23:54 +01:00
Stephen Nicholas Swatman
f47bf5f6b8 indicators: new package (#47786)
* indicators: new package

Indicators is a new package which aims to add easy-to-use progress bars
to modern C++.

* Update header

* Update dependencies
2025-01-20 09:00:37 -06:00
Seth R. Johnson
9296527775 npm, node-js, typescript: add external find (#48587)
* npm: add external find

* node-js: add external find

* Add external for typescript

* Match full executable string

* Fix style
2025-01-20 07:26:01 -06:00
Wouter Deconinck
08c53fa405 pythia8: correct with_or_without prefix for +openmpi (#48131)
* pythia8: correct with_or_without prefix for +openmpi

* pythia8: fix style

* pythia8: fix style
2025-01-20 06:50:29 -06:00
Harmen Stoppels
0c6f0c090d openldap: fix build (#48646) 2025-01-20 13:16:52 +01:00
Nathan Hanford
c623448f81 add affinity package (#48589) 2025-01-20 04:44:25 -07:00
Wouter Deconinck
df71341972 py-mplhep: add v0.3.55 (#48338) 2025-01-20 10:26:09 +01:00
Wouter Deconinck
75862c456d lhapdf: add v6.5.5 (#48336) 2025-01-20 10:25:38 +01:00
dmagdavector
e680a0c153 libslirp: add v4.8.0 (#48561) 2025-01-20 10:23:47 +01:00
Wouter Deconinck
9ad36080ca r: add v4.4.2 (#48329)
* r: add v4.4.2

* r-rcpp: add v1.0.13-1 spot release; conflict 1.0.13 with r@4.4.2
2025-01-20 10:23:23 +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
Rocco Meli
c44edf1e8d gnina: add v1.3 (#47711)
* gnina: add v1.3

* Update var/spack/repos/builtin/packages/gnina/package.py

Co-authored-by: Mikael Simberg <mikael.simberg@iki.fi>

* Update var/spack/repos/builtin/packages/gnina/package.py

Co-authored-by: Mikael Simberg <mikael.simberg@iki.fi>

* Update var/spack/repos/builtin/packages/gnina/package.py

Co-authored-by: Mikael Simberg <mikael.simberg@iki.fi>

* use github patch

* update

---------

Co-authored-by: Mikael Simberg <mikael.simberg@iki.fi>
2025-01-20 10:19:49 +01:00
Paul R. C. Kent
1eacdca5aa py-pyscf: add v2.8.0 (#48571) 2025-01-20 10:15:41 +01:00
Keita Iwabuchi
4a8f5efb38 Metall: add v0.29 and v0.30 (#48564)
Co-authored-by: Keita Iwabuchi <iwabuchi1@lln.gov>
2025-01-20 10:14:42 +01:00
Mickael PHILIT
2e753571bd cgns: add v4.5.0 (#48490) 2025-01-20 10:09:45 +01:00
Thomas Bouvier
da16336550 nvtx: fix missing import (#48580) 2025-01-20 10:08:47 +01:00
Alberto Sartori
1818e70e74 justbuild: add version 1.4.2 (#48581) 2025-01-20 10:07:55 +01:00
Chang Liu
1dde785e9a fusion-io: new package (#47699) 2025-01-20 10:06:13 +01:00
Alberto Invernizzi
a7af32c23b py-virtualenvwrapper: add v6.0.0, v6.1.0, v6.1.1 (#47785) 2025-01-20 10:04:40 +01:00
Simon Frasch
6c92ad439b spfft: add v1.1.1 (#48643) 2025-01-20 10:03:50 +01:00
snehring
93f555eb14 dorado: fixing typo on version restriction for hdf5 (#48591)
Signed-off-by: Shane Nehring <snehring@iastate.edu>
2025-01-20 10:01:29 +01:00
Vanessasaurus
fa3725e9de flux-pmix: add v0.6.0 (#48600)
Co-authored-by: github-actions <github-actions@users.noreply.github.com>
2025-01-20 10:00:35 +01:00
Vanessasaurus
870dd6206f flux-sched: add v0.41.0(#48599)
Co-authored-by: github-actions <github-actions@users.noreply.github.com>
2025-01-20 09:57:22 +01:00
Olivier Cessenat
b1d411ab06 octave: new version 9.3.0 (#48606) 2025-01-20 09:56:55 +01:00
Massimiliano Culpo
783eccfbd5 jsonschema: use draft7 validator and simplify schemas (#48621) 2025-01-20 09:51:29 +01:00
Wouter Deconinck
a842332b1b rsync: add v3.4.0, v3.4.1 (#48607) 2025-01-20 09:50:44 +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
Olivier Cessenat
478855728f ngspice: add v44 (#48611) 2025-01-20 09:27:51 +01:00
jgraciahlrs
5e3baeabfa scorep: update configure opts for libbfd (#48614) 2025-01-20 09:24:12 +01:00
Axel Huebl
58b9b54066 openPMD-api: add v0.16.1 (#48601)
* openpmd-api: add v0.16.1

Add the latest release of openPMD-api.

* TOML11: Latest Versions
2025-01-20 09:22:30 +01:00
Luca Heltai
3918deab74 dealii: add v9.6.1, and v9.6.2 (#48620) 2025-01-20 09:20:49 +01:00
Matt Thompson
ceb2ce352f mapl: add v2.52.0 (#48629) 2025-01-20 09:10:29 +01:00
Wouter Deconinck
7dc6bff7b1 root: depends_on r-rcpp@:1.0.12 when @:6.32.02 (#48625) 2025-01-20 09:05:55 +01:00
Adam J. Stewart
05fbbd7164 py-numpy: add v2.1.3, v2.2.1, v2.2.2 (#48640) 2025-01-20 08:48:56 +01:00
Juan Miguel Carceller
58421866c2 hepmc3: extend python when the python bindings are enabled (#47836)
Co-authored-by: jmcarcell <jmcarcell@users.noreply.github.com>
2025-01-20 08:46:08 +01: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
Anna Rift
d0217cf04e Fix two instances of duplicate 'https://' in URLs (#48628) 2025-01-17 22:59:02 -07:00
Olivier Cessenat
65745fa0df poppler: many improvements (#48627)
* poppler: many improvements

* Strangely I did not have the proper comment header

* Add a maintainer
2025-01-17 22:42:50 -07: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
Julien Loiseau
847f560a6e hard: new package (#48595) 2025-01-16 15:47:59 -07:00
Tamara Dahlgren
623ff835fc mypy: update python version to avoid error/warning (#48593)
* pyproject: remove mypy python version option since defaults to python used to run it (#48593)
2025-01-16 11:24:29 -07:00
Harmen Stoppels
ca19790ff2 py-executing: support python 3.13 (#48604) 2025-01-16 19:00:10 +01:00
acastanedam
f23366e4f8 Update elk to versions 8.8, 9.6, 10.2 (#48583) 2025-01-16 08:46:18 -08:00
Chris Marsh
42fb689501 py-pint-xarray: add version 0.4 (#47599) 2025-01-16 16:57:49 +01:00
arezaii
c33bbdb77d add Arkouda server and client packages (#48054)
Adds packages for the Arkouda server (`arkouda`) and Arkouda python client  (`py-arkouda`).

Arkouda server and client are divided into separate packages to allow for them to be
installed independently of one another. 

Future work remains to add a `+dev` variant to `py-arkouda`, but that will require additional
supporting packages made available through spack (e.g. for `py-pytest-env`
2025-01-15 21:39:23 -08:00
Laurent Chardon
1af6aa22c1 py-basemap: add v1.4.1 (#48548)
* py-basemap: add v1.4.1
* py-basemap: remove broken v1.2.1
* py-basemap: add hires variant
2025-01-15 18:05:05 -08:00
Laurent Chardon
03d9373e5c py-pycuda: add version 2024.1.2 (#48547)
* py-pycuda: add version 2024.1.2
* py-pycuda: add version 2024.1.2
* py-pycuda: Improve dependencies versions
2025-01-15 17:33:14 -08:00
HELICS-bot
f469a3d6ab helics: Add version 3.6.0 (#48000)
* helics: Add version 3.6.0
* helics: Add constraints for new minimum CMake (3.22+), Boost (1.75+), GCC (11+), Clang (15+), and ICC (21+) versions in HELICS 3.6+

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ryan Mast <mast9@llnl.gov>
2025-01-15 17:32:27 -07:00
Xuefeng Ding
25f24d947a add root to rpath of python (#48491)
* add root to rpath of python?

* fix #48446

* [@spackbot] updating style on behalf of DingXuefeng

---------

Co-authored-by: DingXuefeng <DingXuefeng@users.noreply.github.com>
Co-authored-by: Patrick Gartung <gartung@fnal.gov>
2025-01-15 14:27:59 -07:00
Sergio Sánchez Ramírez
af25a84a56 julia: bump 1.11 and 1.10 patch versions (#48149) 2025-01-15 20:23:09 +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
Harmen Stoppels
db997229f2 julia: fix forward compat with curl (#48585) 2025-01-15 16:13:37 +01:00
Massimiliano Culpo
6fac041d40 Add type-hints to which and which_string (#48554) 2025-01-15 15:24:18 +01:00
Paul R. C. Kent
f8b2c65ddf llvm: add v19.1.7 (#48572) 2025-01-15 15:22:14 +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
arezaii
f3522cba74 Chapel 2.3 (#48053)
* add python bindings variant to chapel
* fix chpl_home, update chapel frontend rpath in venv
* fix chpl frontend shared lib rpath hack
* patch chapel env var line length limit
* patch chapel python shared lib location by chapel version
* unhack chpl frontend lib rpath
* fix postinstall main version number file path
* update chapel version number to 2.3
* use chapel releases instead of source tarballs, remove dead code
* Chapel 2.3 adds support for LLVM 19
* Bundled LLVM always requires CMake 3.20:
* Apply 2.3 patch for LLVM include search path

Fixes build errors for `chapel@2.3+rocm` of the form:

```
compiler/llvm/llvmDebug.cpp:174:9: error: cannot convert 'const char*' to 'llvm::dwarf::MemorySpace'
compiler/llvm/llvmDebug.cpp:254:15: error: cannot convert 'const char*' to 'llvm::dwarf::MemorySpace'
```

* fix style

* Fix misreporting of test_hello failures

`test_part` was aliasing the enclosing test name, leading to confusing and incorrect reporting on test failure.

* Ensure `libxml2` optional dep of `hwloc` is also added to `PKG_CONFIG_PATH` in the run env

* patch chplCheck for GPU + multilocale configs, install docs

* Adjust patch for checkChplInstall

* Ensure `CHPL_DEVELOPER` is unset for `~developer`

---------

Co-authored-by: Dan Bonachea <dobonachea@lbl.gov>
2025-01-14 21:48:44 -08:00
Hubertus van Dam
0bd9c235a0 lammps: enable scafacos (#47638)
* Enable Scafacos in LAMMPS
* lammps: make scafacos work with +lib

---------

Co-authored-by: Richard Berger <rberger@lanl.gov>
2025-01-14 21:33:44 -07: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
Alex Richert
ce5ef14fdb crtm: add v3.1.1-build1 (#48451)
* add crtm@3.1.1-build1
* fix url_for_version's version check

Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>

---------

Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
2025-01-14 19:03:50 -07:00
Greg Becker
2447d16e55 bugfix: associate nodes directly with specs for compiler flag reordering (#48496) 2025-01-14 10:15:57 -08:00
Wouter Deconinck
8196c68ff3 py-dask: fix py-versioneer version pin (#47980)
* py-dask: fix py-versioneer version pin
* py-dask: depends_on py-click@8.1 when @2023.11.0:
* py-dask: reorder dependency lines

Co-authored-by: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>

---------

Co-authored-by: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
2025-01-14 09:44:24 -08:00
Taillefumier Mathieu
308f74fe8b trexio: add v2.2.3 -> master (#48543)
* Update trexio
   - update version
   - add cmake support

* Fix formating

* hdf5+hl only needed when < 2.3.0

---------

Co-authored-by: Mathieu Taillefumier <mathieu.taillefumier@free.fr>
2025-01-14 09:39:43 -08:00
Ludovic Räss
864f09fef0 pism: add v2.0.7, v2.1.1 (#47921)
* Update recipe

* Update

* Update

* Cleanup

* Fixup
2025-01-14 09:20:16 -08:00
Juan Miguel Carceller
29b53581e2 bdsim: update to point to the new location in github and add 1.7.7 (#48458)
* bdsim: update to point to the new location in github and add 1.7.7

* Remove the C++ standard patch

* Remove the cmake_args and add a comment instead

---------

Co-authored-by: jmcarcell <jmcarcell@users.noreply.github.com>
2025-01-14 09:18:22 -08:00
Wouter Deconinck
e441e780b9 flatbuffers: add v24.12.23 (#48563)
* flatbuffers: add v24.12.23

* flatbuffers: fix style
2025-01-14 09:12:08 -08:00
Jean Luca Bez
4c642df5ae drishti: add v0.5, v0.6 (#39262)
* include new versions, update dependencies, add test
* Update package.py
* requested changes
* link dependency
* include commit
* fix style
2025-01-14 08:48:35 -07:00
Matt Thompson
217774c972 mepo: add v2.2.1, v2.3.0 (#48552) 2025-01-14 08:44:57 -07:00
Matthieu Dorier
8ec89fc54c pmdk: add gmake dependency, remove cmake dependency (#48544) 2025-01-14 08:44:43 -07:00
Marc T. Henry de Frahan
66ce93a2e3 Openfast version update (#48558) 2025-01-14 08:44:26 -07:00
AMD Toolchain Support
116ffe5809 ICON: Fix missing ocean variant logic handling (#48550)
Co-authored-by: Phil Tooley <phil.tooley@amd.com>
2025-01-14 08:44:01 -07:00
Hans Fangohr
6b0ea2db1d octopus: add v15.1 (#48514) 2025-01-14 08:43:45 -07:00
Harmen Stoppels
d72b371c8a relocate_text: fix return value (#48568) 2025-01-14 13:29:06 +01:00
Mikael Simberg
aa88ced154 Set CMake policy CMP0074 to the new behaviour in hip package (#48549) 2025-01-14 04:48:09 -07: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
Harmen Stoppels
9fa1654102 builtin: add missing deps on gmake (#48545) 2025-01-13 22:51:20 -07:00
Julien Bigot
2c692a5755 doxygen: new versions 1.13 (#48541) 2025-01-13 21:29:40 -07:00
Hubertus van Dam
c0df012b18 py-mdi: new package (#47636)
* Adding MDI
* py-mdi: update package
* lammps: py-mdi needs to be usable at runtime
* py-mdi: update dependency constraints

---------

Co-authored-by: Richard Berger <rberger@lanl.gov>
2025-01-13 20:54:06 -07:00
Cody Balos
66e8523e14 add long_spec property to get fully enumerated spec string (#48389) 2025-01-13 16:43:39 -08:00
Paul R. C. Kent
3932299768 Add v0.3.29 (#48536) 2025-01-13 16:36:29 -08:00
Buldram
3eba6b8379 qemacs, texi2html: new packages (#48537)
* qemacs, texi2html: new packages
* Make plugin support variant
2025-01-13 16:23:40 -08:00
Wouter Deconinck
369928200a py-histoprint: add v2.5.0, v2.6.0 (switch to hatchling) (#48452)
* py-histoprint: add v2.5.0, v2.6.0 (switch to hatchling)
* py-histoprint: add tag hep
2025-01-13 13:44:39 -08:00
Olivier Cessenat
81ed0f8d87 visit: external find requires import re (#48469) 2025-01-13 13:27:31 -07:00
Adam J. Stewart
194b6311e9 GDAL: add v3.10.1 (#48551) 2025-01-13 12:04:47 -08:00
Vicente Bolea
8420898f79 vtk: add v9.4.1 (#48325) 2025-01-13 11:49:41 -08:00
Tamara Dahlgren
f556ba46d9 bugfix/r: git property needs to be classproperty (#48228) 2025-01-13 12:14:26 -06:00
Hubertus van Dam
ddaa9d5d81 pace: new package (#47561)
* Adding the PACE library to the LAMMPS build
* Adding the PACE library for ML-PACE in LAMMPS

---------

Co-authored-by: Richard Berger <rberger@lanl.gov>
2025-01-13 10:28:05 -07:00
Wouter Deconinck
b878fe5555 boost: add v1.87.0, update depdendents' constraints (#48475)
* boost: add 1.87.0

* boost: revert addition of parser variant

* precice: forward compatibility boost@:1.86 when @:3.1.2

* faodel: forward compatibility boost@:1.86 when @:1.2108.1

* boost: conflicts ~python when +mpi @1.87.0:
2025-01-13 09:19:30 -08:00
afzpatel
b600bfc779 hipsparselt, rocalution and omniperf: update hipsparselt and rocalutuion to 6.3.0 and fix omniperf typo (#48374)
* hipsparselt and omniperf: update hipsparselt to 6.3.0 and fix typo in omniperf

* fix style

* update rocalution to 6.3.0
2025-01-13 09:18:28 -08:00
Wouter Deconinck
612c289c41 dbus: add v1.16.0 (#48531) 2025-01-13 16:41:16 +01:00
Harmen Stoppels
e42c76cccf py-ipython: relax py-jedi forward compat (#48542) 2025-01-13 15:12:24 +01:00
Wouter Deconinck
25013bacf2 hep stack: add pandora PFA suite (#48497) 2025-01-13 13:41:01 +01:00
Carlos Bederián
3d554db198 hpl: build v2.3 with timers (#48206)
Co-authored-by: zzzoom <zzzoom@users.noreply.github.com>
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-01-13 13:04:49 +01:00
Wouter Deconinck
b6def50dcb py-webcolors: add v24.8.0, v24.11.1 (switch to pdm-backend) (#48398) 2025-01-13 13:03:56 +01:00
Wouter Deconinck
bf591c96bd py-llvmlite: add v0.42.0, v0.43.0; py-numba: add v0.59.1, v0.60.0 (#48399) 2025-01-13 13:03:33 +01:00
Wouter Deconinck
edf1d2ec40 py-pre-commit: add v3.6.2, v3.7.1, v3.8.0, v4.0.1 (#48400) 2025-01-13 13:03:06 +01:00
Adam J. Stewart
07f607ec9f PyTorch: remove +onnx_ml variant (#48406) 2025-01-13 13:02:21 +01:00
Olivier Cessenat
93747c5e24 gxsview: making sure -lstdc++fs is added (#47703)
Co-authored-by: Olivier Cessenat <cessenat@jliana.magic>
2025-01-13 13:01:03 +01:00
Thomas Helfer
b746d4596a tfel: update package to transition from boost/python to pybind11 (#48237) 2025-01-13 12:59:22 +01:00
G-Ragghianti
8814705936 papi: fix erroneous patch application (#48428) 2025-01-13 12:56:28 +01:00
Harmen Stoppels
c989541ebc lmod: fix build on macOS (#48438) 2025-01-13 12:53:11 +01:00
Krishna Chilleri
1759ce05dd py-graphviz: add v0.20.3 (#48280) 2025-01-13 12:49:57 +01:00
Wouter Deconinck
c0c1a4aea1 podio: add v1.2; conflicts +rntuple ^root@6.32: when @:0.99 (#47991)
Co-authored-by: Thomas Madlener <thomas.madlener@desy.de>
2025-01-13 12:48:25 +01:00
Wouter Deconinck
53353ae64e hep stack: add scikit-hep packages (#48412) 2025-01-13 12:40:29 +01:00
Wouter Deconinck
62f7a4c9b1 py-wxpython: depends_on wxwidgets +gui (#48499) 2025-01-13 12:31:13 +01:00
Massimiliano Culpo
39679d0882 otf2: add a dependency on Fortran (#48506)
See https://gitlab.spack.io/spack/spack/-/jobs/14423941

From https://gitlab.com/score-p/scorep/-/blob/master/INSTALL?ref_type=heads

> Score-P requires a full compiler suite with language support for C99,
> C++11 and optionally Fortran 77 and Fortran 90.
2025-01-13 12:28:14 +01:00
Ufuk Turunçoğlu
50e6bf9979 esmf: add v8.8.0 (#48495) 2025-01-13 12:25:04 +01:00
Olivier Cessenat
b874c31cc8 keepassxc: adding versions 2.7.8 and 2.7.9 (#48518) 2025-01-13 12:22:55 +01:00
Adam J. Stewart
04baad90f5 py-lightning-uq-box: add v0.2.0 (#48305) 2025-01-13 12:22:04 +01:00
Adam J. Stewart
1022527923 py-ruff: add v0.9.1 (#48519) 2025-01-13 12:20:53 +01:00
Alberto Invernizzi
7ef19ec1d8 gnupg: bump versions and update libassuan requirement (#48520) 2025-01-13 12:19:38 +01:00
Wouter Deconinck
6e45b51f27 cepgen: add v1.2.5 (#48524) 2025-01-13 12:16:31 +01:00
Adam J. Stewart
5f9cd0991b py-timm: add v1.0.13 (#48526) 2025-01-13 12:15:19 +01:00
Wouter Deconinck
98c44fc351 hep stack: root +postgres (#48498) 2025-01-13 12:11:19 +01:00
Adam J. Stewart
b99f850c8e py-scipy: add v1.15.1 (#48523) 2025-01-13 12:07:30 +01:00
Adam J. Stewart
cbbd68d16b py-scikit-learn: add v1.6.1 (#48525) 2025-01-13 12:07:06 +01:00
Wouter Deconinck
e4fbf99497 dcap: depends_on openssl and zlib-api (#48529) 2025-01-13 12:06:29 +01:00
Wouter Deconinck
6a225d5405 dpmjet: add v19.3.6, v19.3.7; add to hep stack (#48530) 2025-01-13 12:05:45 +01:00
Wouter Deconinck
af9fd82476 acts: conflict ~svg ~json when +traccc (#48534) 2025-01-13 11:51:05 +01:00
Carson Woods
29c1152484 py-rich-click: added new versions and dependencies (#48270) 2025-01-13 11:48:10 +01:00
Wouter Deconinck
d6a8af6a1d py-asdf: depends_on py-setuptools-scm@8: (#48538) 2025-01-13 11:44:44 +01:00
Adam J. Stewart
3c3dad0a7a py-kornia: add v0.8.0 (#48522) 2025-01-13 11:43:33 +01:00
Wouter Deconinck
109efdff88 vbfnlo: deprecated 3.0.0beta* since 3.0 < 3.0.0beta (#48516) 2025-01-13 11:35:38 +01:00
Wouter Deconinck
fa318e2c92 lcio: add v2.22.3 (#48532) 2025-01-13 10:45:28 +01:00
Harmen Stoppels
064e70990d binary_distribution.py: stop relocation old /bin/bash sbang shebang (#48502) 2025-01-13 09:30:18 +01:00
Michael Kuhn
c40139b7d6 builtin: fix pkgconfig dependencies (#48533)
`pkgconfig` is the virtual dependency, `pkg-config` and `pkgconf` are
implementations.
2025-01-13 08:40:49 +01:00
Wouter Deconinck
c302e1a768 builtin: add undeclared gmake dependencies (#48535) 2025-01-13 08:38:37 +01:00
Harmen Stoppels
7171015f1c py-mypy: add v1.13.0 and v1.14.1 (#48508)
* py-setuptools: add v75.3.0, v75.8.0
* py-radical-utils: forward compat with setuptools
2025-01-12 17:18:09 +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
John W. Parent
a66ab9cc6c CMake: add versions 3.31.3 and 3.31.4 (#48509) 2025-01-11 11:38:36 -07:00
Mosè Giordano
70534ac9d4 r-deseq2: add new versions (#48157) 2025-01-10 14:36:53 -08:00
Chris Marsh
b369d8b250 py-netcdf4: add v1.7.2 and fix variant (#47824) 2025-01-10 21:52:42 +01:00
Mosè Giordano
4d2319a785 r-sparsematrixstats: add new versions (#48154)
Also, specify incompatibility with `r-matrixstats` versions.
2025-01-10 10:50:04 -08:00
Dom Heinzeller
d6a9511f39 py-cylc-flow package: update package and dependents/dependencies
* Add py-protobuf@4.24.4 (needed for py-cylc-flow@8.3.6).
* Add py-cylc-flow@8.3.6 and enable png output when creating graphs
  by requesting variant pangocairo for graphviz dependency.
* Add corresponding versions of py-metomi-rose@2.3.2,
  py-cylc-rose@1.4.2, py-cylc-uiserver@1.4.2.
* Add myself as maintainer to all the cylc-related packages.
2025-01-10 10:12:41 -08: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
Niklas Bölter
b670205e54 py-nvitop: new package (#48426)
* Adding nvitop package

* [@spackbot] updating style on behalf of nboelte

* Adding dependency constraints and types

* Adding maintainer

* Adding python version dependency

* Style fix

* Commented out unused platform=windows dependency
2025-01-10 09:18:12 -08:00
Harmen Stoppels
d6d8800466 executable.py: fix overlapping overload set (#48503) 2025-01-10 16:34:04 +00:00
Rocco Meli
7a32954f7f dftd4: add v3.6.0 and v3.7.0, update URL (#48500) 2025-01-10 16:13:15 +01:00
Massimiliano Culpo
92564ecd42 palace: add a dependency on c (#48315) 2025-01-10 15:15:57 +01:00
Massimiliano Culpo
c1258a1431 chai: add dependency on C (#48316) 2025-01-10 15:15:14 +01:00
Harmen Stoppels
d46ac9b1e4 spec.py: fix return type of concretized() (#48504) 2025-01-10 13:31:41 +00:00
Massimiliano Culpo
2e472a13e5 llvm: minimal fix for llvm_config method (#48501) 2025-01-10 11:36:07 +01: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
Dom Heinzeller
464390962f Comment out py-arrow@1.3.0 because of build errors with basic gcc stack (#48478)
* Comment out py-arrow@1.3.0 because of build errors with basic gcc stack
* Also comment out 1.3.0-specific depends_on lines
2025-01-09 19:43:47 -07:00
Wouter Deconinck
16734cd8c6 mlpack: add v4.5.1 (#48334)
* mlpack: add v4.5.1
* mlpack: variant +go when=@4.5.1:
2025-01-09 18:40:49 -08:00
Alec Scott
1dd9eeb0c6 rust: fix dependency version constraint (#48445) 2025-01-09 18:37:25 -08:00
Wouter Deconinck
f4ef0aec28 armadillo: add v14.2.2 (#48480)
* armadillo: add v14.2.2
* armadillo: hdf5 support ends with v10
2025-01-09 18:34:58 -08:00
Buldram
ea2c70a21a toybox: depend on virtual zlib (#48486) 2025-01-09 18:33:20 -08:00
Weiqun Zhang
72ddc03da9 amrex: add v25.01 (#48423)
* amrex: add v25.01
* Add dependency on rocsparse

---------

Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
2025-01-09 17:37:26 -08:00
Alec Scott
32de71b0b6 gnutls: add v3.8.8 (#48373) 2025-01-09 19:23:20 -06:00
Stephen Nicholas Swatman
e94d5b935f acts dependencies: new versions as of 2025/01/08 (#48465)
New year, new versions of the ACTS dependencies. This time, we have a
new version of detray, a new version of algebra plugins, as well as a
new version of ACTS itself.
2025-01-09 19:22:20 -06:00
Alberto Invernizzi
85649be232 py-stevedore: bump to version 5.4.0 (plus some intermediate ones as well) (#47784) 2025-01-09 16:55:40 -08:00
Harmen Stoppels
c23d2cdb2b lmod: add v8.7.55 (#48439) 2025-01-09 16:43:08 -08:00
Wouter Deconinck
dc5dd896a2 ensmallen: add v2.22.1 (#48481) 2025-01-09 16:41:46 -08:00
Dave Keeshan
43f23589ef verilator: add v5.032 (#48493) 2025-01-09 16:40:24 -08: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
Paul R. C. Kent
46da7952d3 llvm: add v19.1.6 (#48162) 2025-01-09 13:51:46 -08:00
Adam J. Stewart
72783bcb0a py-keras: add v3.8.0, remove optional deps (#48461) 2025-01-09 09:16:57 -08:00
Olivier Cessenat
f4d2ff0068 ocaml: compile versions before 4.8.0 again (#48470) 2025-01-09 09:15:12 -08:00
Adam J. Stewart
a2b7fee3fe py-timm: add v1.0.12 (#48474) 2025-01-09 09:11:08 -08:00
Mikael Simberg
2ebf2df421 mold: Add 2.36.0 (#48483) 2025-01-09 13:20:40 +01:00
dependabot[bot]
e725aa527e build(deps): bump codecov/codecov-action from 5.0.3 to 5.1.2 (#48200)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.0.3 to 5.1.2.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](05f5a9cfad...1e68e06f1d)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  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 12:33:45 +01:00
Richard Berger
7455c8d173 libmesh: add newer versions up to 1.7.6 (#48476) 2025-01-09 04:07:48 -07:00
Vanessasaurus
99e2bce99f Automated deployment to update package flux-core 2025-01-08 (#48466)
Co-authored-by: github-actions <github-actions@users.noreply.github.com>
2025-01-09 03:38:42 -07:00
Buldram
4204d16fd3 toybox: new package (#48472) 2025-01-09 03:33:28 -07: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
Wouter Deconinck
57357a540f py-iminuit: new versions through v2.30.1 (#48471)
* py-iminuit: new versions through v2.30.1
* py-iminuit: add tag hep

---------

Co-authored-by: wdconinc <wdconinc@users.noreply.github.com>
2025-01-09 03:18:18 -07:00
Adam J. Stewart
97e0b39b32 py-segmentation-models-pytorch: add v0.4.0 (#48473) 2025-01-08 15:32:09 -08:00
Paul Gessinger
247da9ea7a root: Patch range restriction and gcc lower bound (#48449)
* root: Restrict patch range

* root: Set minimum gcc version for cxxstd=20

* root: fix gcc range when cxxstd 20

Co-authored-by: Paul Gessinger <hello@paulgessinger.com>

---------

Co-authored-by: Wouter Deconinck <wdconinc@gmail.com>
2025-01-08 16:03:08 -06:00
Sinan
07f89a73d1 libspatialite: fix for newer libxml2 (#48125)
* package/libspatialite fix for newer libxml
* clarify constraint
* fix issue properly via variant

---------

Co-authored-by: sbulut <sbulut@3vgeomatics.com>
2025-01-08 12:58:14 -08:00
Krishna Chilleri
60cfdcb6cc py-neo4j: new package (#48383)
* add neo4j package

* [@spackbot] updating style on behalf of kchilleri

* modifying license header
2025-01-08 13:46:32 -06:00
Seth R. Johnson
1c9b042d3a googletest: new version, absl support, c++20 flag (#48328)
* googletest: new version, absl support, c++20 flag
* Update googletest header
2025-01-08 11:22:38 -08:00
Harmen Stoppels
c424611010 directory_layout.py: remove dependency on global spack.store.STORE (#48460) 2025-01-08 17:44:32 +01:00
Xuefeng Ding
35963d7d7d geant4-data: support G4TENDL (#48310)
* add parse tool, json, and load json

bug fix

add variants and conflictions for g4tendl

* correct format

* correct format

* update version mapping

* remove 1.0

* Update var/spack/repos/builtin/packages/geant4-data/package.py

Co-authored-by: Seth R. Johnson <johnsonsr@ornl.gov>

* add options

* depends on it

* fix typo

---------

Co-authored-by: Seth R. Johnson <johnsonsr@ornl.gov>
2025-01-08 10:40:06 -06:00
Wouter Deconinck
7e62ca864a ninja: support tests for 1.12 and later (#48385)
* ninja: support tests for 1.12:

* ninja: fix style
2025-01-08 16:57:25 +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
eugeneswalker
25ce6cce47 e4s cray rhel ci stack: re-enable and update for new cpe (#47697)
* e4s cray rhel ci stack: re-enable and update for new cpe, should fix cray libsci issue

* only run e4s-cray-rhel stack

* Mkae Autotools build_system point at correct build_directory

* remove selective enable of cray-rhel stacks

* restore SPACK_CI_DISABLE_STACKS

* use dot prefix to hide cray-sles jobs instead of comment-out

---------

Co-authored-by: Ryan Krattiger <ryan.krattiger@kitware.com>
2025-01-07 08:56:10 -08:00
eugeneswalker
418a9194e7 util-linux: add missing include for errno.h (#48433) 2025-01-07 08:48:25 -08:00
Seth R. Johnson
d16a578242 geant4: fix 10.7 build with c++20 (#48347) 2025-01-07 16:14:18 +01:00
Wouter Deconinck
aee2f5cf41 hep stack: add celeritas (#48404) 2025-01-07 09:47:17 -05: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
Paul Gessinger
3b21ff109f edm4hep: Add lower clang version bounds (#48419)
* edm4hep: Add lower clang version bounds

EDM4hep 0.99.1 introduced usage of consteval. While this is technically
supported in clang versions below 17, the implementation seems to be
incomplete and fail compilation of EDM4hep 0.99.1 and up.

* Update var/spack/repos/builtin/packages/edm4hep/package.py

Co-authored-by: Thomas Madlener <thomas.madlener@desy.de>

---------

Co-authored-by: Thomas Madlener <thomas.madlener@desy.de>
2025-01-06 22:14:50 -06:00
Gerry Knapp
d503f03473 additivefoam: update build scripts for @main (#48223) 2025-01-06 18:32:09 -08:00
Sinan
770d2fe4d7 libxml2: add version 2.13.5 and variant http (#48124)
* package/libxml2 add version 2.13.5

* add http variant

* Update var/spack/repos/builtin/packages/libxml2/package.py

Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>

* Update var/spack/repos/builtin/packages/libxml2/package.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

---------

Co-authored-by: sbulut <sbulut@3vgeomatics.com>
Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2025-01-06 18:01:19 -08:00
Wouter Deconinck
fcc35b70bb py-six: add v1.17.0 (#48401) 2025-01-06 17:11:16 -08:00
Wouter Deconinck
074387b29c wayland: add v1.23.0, v1.23.1; wayland-protocols: add v1.38, v1.39 (#48403)
* wayland-protocols: add v1.38, v1.39

* wayland: add v1.23.0, v1.23.1
2025-01-06 17:09:54 -08:00
Adam J. Stewart
4d26b93070 XNNPACK: add new versions, pin resources (#48405) 2025-01-06 17:07:02 -08:00
Wouter Deconinck
9d15a006f8 py-rucio-clients: add through v36.0.0.post2 (#48407)
* py-rucio-clients: add through v36.0.0.post2

* [@spackbot] updating style on behalf of wdconinc

---------

Co-authored-by: wdconinc <wdconinc@users.noreply.github.com>
2025-01-06 17:01:24 -08:00
Wouter Deconinck
7e69650806 py-deepdiff: add through v8.1.1 (#48410)
* py-deepdiff: add through v8.1.1
* py-orderly-set: new package
* py-orderly-set: add v5.2.1, v5.2.2 to satisfy audit
2025-01-06 15:14:26 -08:00
G-Ragghianti
142469f92e Fixing description (#48429) 2025-01-06 14:57:03 -08:00
Wouter Deconinck
cb6cb023d2 py-click: add v8.1.8 (switch to flit-core) (#48422) 2025-01-06 13:50:15 -08:00
Olivier Cessenat
920614a799 hevea: add v2.36 (#48273) 2025-01-06 12:57:29 -07:00
rfbgo
5be40f1a5a py-espresso: add v4.1.0 -> v4.2.2 (#47864)
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2025-01-06 20:44:23 +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
Krishna Chilleri
2842c6d191 py-typer: add version 0.5.0 (#48285) 2025-01-06 18:08:27 +01:00
Wouter Deconinck
e8309b16fc thepeg: restrict rivet versions; evtgen: new variant sherpa (#48264)
* thepeg: restrict to rivet@:3 when @:2.2

* evtgen: new variant sherpa

* herwig3: require at least one external EvtGen component

* evtgen: fix typo

* evtgen: rm deprecated 01.* and autotools build system

* thepeg: fix typo

* herwig3: fix conflicts ^evtgen
2025-01-06 09:27:48 -07:00
dmagdavector
4dd55e1b67 podman: add v4.6.2, 4.7.2, 4.8.3, 4.9.3 (#48112) 2025-01-06 10:42:18 -05:00
Wouter Deconinck
227fa1a482 gh: check_args needs ./... and some skipped tests (#48408) 2025-01-06 10:40:30 -05:00
Thomas Madlener
ee47d877ff rivet, yoda: Add new versions with back-port fixes (#48141)
* rivet: add version 3.1.11 with some back-port fixes

Some back-ported fixes from the 4.x series. Most importantly the
possibility to build against HepMC 3.3.0.

* yoda: Add version 1.9.11

* Add a conflict with hepmc=2

* Unify hepmc@3.3.0 conflicts into one statement

* Remove conflict and update conditional hepmc variant

* Use caret to signify conflict with dependency

Co-authored-by: Wouter Deconinck <wdconinc@gmail.com>

* Make conflict and msg more specific

* Add dedicated version dependency to yoda

---------

Co-authored-by: Wouter Deconinck <wdconinc@gmail.com>
2025-01-06 08:32:52 -06:00
Harmen Stoppels
4b4be2e2c2 cmd/__init__.py: pass tests in case n=1 (#48417) 2025-01-06 15:30:29 +01:00
Valentin Volkl
0e6e61b32f alpgen: update website (#48415) 2025-01-06 08:07:26 -06:00
Harmen Stoppels
79027884c7 Add spack API warning with file/line (#48416) 2025-01-06 03:43:04 -07:00
Olivier Cessenat
beadf06caa ocamlbuild: add v0.14.1 -> v0.15.0 (#48272) 2025-01-06 08:36:16 +01:00
Niclas Jansson
fc24be5c2b neko: add v0.9.1 and deprecate old versions (#48306) 2025-01-06 07:57:14 +01:00
Tim Fuller
8d5ece07d1 Update openmpi/package.py to allow for non-standard cxx name (#48168)
Allows user to define an alternative name for `mpic++` in `packages:openmpi:package_attributes:cxxname`.
2025-01-05 03:22:57 -07:00
Wouter Deconinck
cf06b395b7 snakemake: skip_modules snakemake.common.tests (#48395) 2025-01-04 23:19:50 +01:00
Seth R. Johnson
fd51f1ce65 RCCL: only build tests when requested (#48387) 2025-01-04 09:46:15 -05:00
Matt Thompson
0576ef081a mapl: add v2.51.2 (#48220) 2025-01-04 13:49:00 +01:00
Dom Heinzeller
20a8ba77b0 ectrans: add conflict for versions 1.5.x with oneapi@2025: (#48238) 2025-01-04 13:44:10 +01:00
Kacper Kornet
9b4c5d1c55 python: add v3.13.1 and v3.12.8 (#48356) 2025-01-04 13:42:12 +01:00
778 changed files with 8389 additions and 5462 deletions

View File

@@ -29,7 +29,7 @@ jobs:
- run: coverage xml
- name: "Upload coverage report to CodeCov"
uses: codecov/codecov-action@05f5a9cfad807516dbbef9929c4a42df3eb78766
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303
with:
verbose: true
fail_ci_if_error: false

View File

@@ -2,6 +2,6 @@ black==24.10.0
clingo==5.7.1
flake8==7.1.1
isort==5.13.2
mypy==1.8.0
mypy==1.11.2
types-six==1.17.0.20241205
vermin==1.6.0

View File

@@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: '3.11'
python-version: '3.13'
cache: 'pip'
- name: Install Python Packages
run: |
@@ -39,7 +39,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: '3.11'
python-version: '3.13'
cache: 'pip'
- name: Install Python packages
run: |
@@ -58,7 +58,7 @@ jobs:
secrets: inherit
with:
with_coverage: ${{ inputs.with_coverage }}
python_version: '3.11'
python_version: '3.13'
# Check that spack can bootstrap the development environment on Python 3.6 - RHEL8
bootstrap-dev-rhel8:
runs-on: ubuntu-latest

View File

@@ -25,7 +25,6 @@ exit 1
# The code above runs this file with our preferred python interpreter.
import os
import os.path
import sys
min_python3 = (3, 6)

View File

@@ -36,7 +36,7 @@ packages:
go-or-gccgo-bootstrap: [go-bootstrap, gcc]
iconv: [libiconv]
ipp: [intel-oneapi-ipp]
java: [openjdk, jdk, ibm-java]
java: [openjdk, jdk]
jpeg: [libjpeg-turbo, libjpeg]
lapack: [openblas, amdlibflame]
libc: [glibc, musl]
@@ -73,15 +73,27 @@ packages:
permissions:
read: world
write: user
cray-fftw:
buildable: false
cray-libsci:
buildable: false
cray-mpich:
buildable: false
cray-mvapich2:
buildable: false
cray-pmi:
buildable: false
egl:
buildable: false
essl:
buildable: false
fujitsu-mpi:
buildable: false
fujitsu-ssl2:
buildable: false
hpcx-mpi:
buildable: false
mpt:
buildable: false
spectrum-mpi:
buildable: false

View File

@@ -170,7 +170,7 @@ bootstrapping.
To register the mirror on the platform where it's supposed to be used run the following command(s):
% spack bootstrap add --trust local-sources /opt/bootstrap/metadata/sources
% spack bootstrap add --trust local-binaries /opt/bootstrap/metadata/binaries
% spack buildcache update-index /opt/bootstrap/bootstrap_cache
This command needs to be run on a machine with internet access and the resulting folder
has to be moved over to the air-gapped system. Once the local sources are added using the

View File

@@ -56,13 +56,13 @@ If you look at the ``perl`` package, you'll see:
.. code-block:: python
phases = ["configure", "build", "install"]
phases = ("configure", "build", "install")
Similarly, ``cmake`` defines:
.. code-block:: python
phases = ["bootstrap", "build", "install"]
phases = ("bootstrap", "build", "install")
If we look at the ``cmake`` example, this tells Spack's ``PackageBase``
class to run the ``bootstrap``, ``build``, and ``install`` functions

View File

@@ -25,14 +25,23 @@ These settings can be overridden in ``etc/spack/config.yaml`` or
The location where Spack will install packages and their dependencies.
Default is ``$spack/opt/spack``.
---------------------------------------------------
``install_hash_length`` and ``install_path_scheme``
---------------------------------------------------
---------------
``projections``
---------------
The default Spack installation path can be very long and can create problems
for scripts with hardcoded shebangs. Additionally, when using the Intel
compiler, and if there is also a long list of dependencies, the compiler may
segfault. If you see the following:
.. warning::
Modifying projections of the install tree is strongly discouraged.
By default Spack installs all packages into a unique directory relative to the install
tree root with the following layout:
.. code-block::
{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}
In very rare cases, it may be necessary to reduce the length of this path. For example,
very old versions of the Intel compiler are known to segfault when input paths are too long:
.. code-block:: console
@@ -40,36 +49,25 @@ segfault. If you see the following:
** Segmentation violation signal raised. **
Access violation or stack overflow. Please contact Intel Support for assistance.
it may be because variables containing dependency specs may be too long. There
are two parameters to help with long path names. Firstly, the
``install_hash_length`` parameter can set the length of the hash in the
installation path from 1 to 32. The default path uses the full 32 characters.
Another case is Python and R packages with many runtime dependencies, which can result
in very large ``PYTHONPATH`` and ``R_LIBS`` environment variables. This can cause the
``execve`` system call to fail with ``E2BIG``, preventing processes from starting.
Secondly, it is also possible to modify the entire installation
scheme. By default Spack uses
``{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}``
where the tokens that are available for use in this directive are the
same as those understood by the :meth:`~spack.spec.Spec.format`
method. Using this parameter it is possible to use a different package
layout or reduce the depth of the installation paths. For example
For this reason, Spack allows users to modify the installation layout through custom
projections. For example
.. code-block:: yaml
config:
install_path_scheme: '{name}/{version}/{hash:7}'
install_tree:
root: $spack/opt/spack
projections:
all: "{name}/{version}/{hash:16}"
would install packages into sub-directories using only the package
name, version and a hash length of 7 characters.
would install packages into sub-directories using only the package name, version and a
hash length of 16 characters.
When using either parameter to set the hash length it only affects the
representation of the hash in the installation directory. You
should be aware that the smaller the hash length the more likely
naming conflicts will occur. These parameters are independent of those
used to configure module names.
.. warning:: Modifying the installation hash length or path scheme after
packages have been installed will prevent Spack from being
able to find the old installation directories.
Notice that reducing the hash length increases the likelihood of hash collisions.
--------------------
``build_stage``

View File

@@ -543,10 +543,10 @@ With either interpreter you can run a single command:
.. code-block:: console
$ spack python -c 'from spack.spec import Spec; Spec("python").concretized()'
$ spack python -c 'from spack.concretize import concretize_one; concretize_one("python")'
...
$ spack python -i ipython -c 'from spack.spec import Spec; Spec("python").concretized()'
$ spack python -i ipython -c 'from spack.concretize import concretize_one; concretize_one("python")'
Out[1]: ...
or a file:

View File

@@ -456,14 +456,13 @@ For instance, the following config options,
tcl:
all:
suffixes:
^python@3: 'python{^python.version}'
^python@3: 'python{^python.version.up_to_2}'
^openblas: 'openblas'
will add a ``python-3.12.1`` version string to any packages compiled with
Python matching the spec, ``python@3``. This is useful to know which
version of Python a set of Python extensions is associated with. Likewise, the
``openblas`` string is attached to any program that has openblas in the spec,
most likely via the ``+blas`` variant specification.
will add a ``python3.12`` to module names of packages compiled with Python 3.12, and similarly for
all specs depending on ``python@3``. This is useful to know which version of Python a set of Python
extensions is associated with. Likewise, the ``openblas`` string is attached to any program that
has openblas in the spec, most likely via the ``+blas`` variant specification.
The most heavyweight solution to module naming is to change the entire
naming convention for module files. This uses the projections format

View File

@@ -4,7 +4,7 @@ sphinx_design==0.6.1
sphinx-rtd-theme==3.0.2
python-levenshtein==0.26.1
docutils==0.21.2
pygments==2.18.0
pygments==2.19.1
urllib3==2.3.0
pytest==8.3.4
isort==5.13.2

View File

@@ -3,7 +3,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""URL primitives that just require Python standard library."""
import itertools
import os.path
import os
import re
from typing import Optional, Set, Tuple
from urllib.parse import urlsplit, urlunsplit

View File

@@ -75,7 +75,6 @@
"install_tree",
"is_exe",
"join_path",
"last_modification_time_recursive",
"library_extensions",
"mkdirp",
"partition_path",
@@ -1470,15 +1469,36 @@ def set_executable(path):
@system_path_filter
def last_modification_time_recursive(path):
path = os.path.abspath(path)
times = [os.stat(path).st_mtime]
times.extend(
os.lstat(os.path.join(root, name)).st_mtime
for root, dirs, files in os.walk(path)
for name in dirs + files
)
return max(times)
def recursive_mtime_greater_than(path: str, time: float) -> bool:
"""Returns true if any file or dir recursively under `path` has mtime greater than `time`."""
# use bfs order to increase likelihood of early return
queue: Deque[str] = collections.deque([path])
if os.stat(path).st_mtime > time:
return True
while queue:
current = queue.popleft()
try:
entries = os.scandir(current)
except OSError:
continue
with entries:
for entry in entries:
try:
st = entry.stat(follow_symlinks=False)
except OSError:
continue
if st.st_mtime > time:
return True
if entry.is_dir(follow_symlinks=False):
queue.append(entry.path)
return False
@system_path_filter
@@ -1740,8 +1760,7 @@ def find(
def _log_file_access_issue(e: OSError, path: str) -> None:
errno_name = errno.errorcode.get(e.errno, "UNKNOWN")
tty.debug(f"find must skip {path}: {errno_name} {e}")
tty.debug(f"find must skip {path}: {e}")
def _file_id(s: os.stat_result) -> Tuple[int, int]:

View File

@@ -1356,14 +1356,8 @@ def _test_detection_by_executable(pkgs, debug_log, error_cls):
def _compare_extra_attribute(_expected, _detected, *, _spec):
result = []
# Check items are of the same type
if not isinstance(_detected, type(_expected)):
_summary = f'{pkg_name}: error when trying to detect "{_expected}"'
_details = [f"{_detected} was detected instead"]
return [error_cls(summary=_summary, details=_details)]
# If they are string expected is a regex
if isinstance(_expected, str):
if isinstance(_expected, str) and isinstance(_detected, str):
try:
_regex = re.compile(_expected)
except re.error:
@@ -1379,7 +1373,7 @@ def _compare_extra_attribute(_expected, _detected, *, _spec):
_details = [f"{_detected} does not match the regex"]
return [error_cls(summary=_summary, details=_details)]
if isinstance(_expected, dict):
elif isinstance(_expected, dict) and isinstance(_detected, dict):
_not_detected = set(_expected.keys()) - set(_detected.keys())
if _not_detected:
_summary = f"{pkg_name}: cannot detect some attributes for spec {_spec}"
@@ -1394,6 +1388,10 @@ def _compare_extra_attribute(_expected, _detected, *, _spec):
result.extend(
_compare_extra_attribute(_expected[_key], _detected[_key], _spec=_spec)
)
else:
_summary = f'{pkg_name}: error when trying to detect "{_expected}"'
_details = [f"{_detected} was detected instead"]
return [error_cls(summary=_summary, details=_details)]
return result

View File

@@ -5,6 +5,7 @@
import codecs
import collections
import concurrent.futures
import contextlib
import copy
import hashlib
import io
@@ -23,7 +24,7 @@
import urllib.request
import warnings
from contextlib import closing
from typing import IO, Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, Union
from typing import IO, Callable, Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, Union
import llnl.util.filesystem as fsys
import llnl.util.lang
@@ -91,6 +92,9 @@
CURRENT_BUILD_CACHE_LAYOUT_VERSION = 2
INDEX_HASH_FILE = "index.json.hash"
class BuildCacheDatabase(spack_db.Database):
"""A database for binary buildcaches.
@@ -502,7 +506,7 @@ def _fetch_and_cache_index(self, mirror_url, cache_entry={}):
scheme = urllib.parse.urlparse(mirror_url).scheme
if scheme != "oci" and not web_util.url_exists(
url_util.join(mirror_url, BUILD_CACHE_RELATIVE_PATH, "index.json")
url_util.join(mirror_url, BUILD_CACHE_RELATIVE_PATH, spack_db.INDEX_JSON_FILE)
):
return False
@@ -591,32 +595,18 @@ def file_matches(f: IO[bytes], regex: llnl.util.lang.PatternBytes) -> bool:
f.seek(0)
def deps_to_relocate(spec):
"""Return the transitive link and direct run dependencies of the spec.
This is a special traversal for dependencies we need to consider when relocating a package.
Package binaries, scripts, and other files may refer to the prefixes of dependencies, so
we need to rewrite those locations when dependencies are in a different place at install time
than they were at build time.
This traversal covers transitive link dependencies and direct run dependencies because:
1. Spack adds RPATHs for transitive link dependencies so that packages can find needed
dependency libraries.
2. Packages may call any of their *direct* run dependencies (and may bake their paths into
binaries or scripts), so we also need to search for run dependency prefixes when relocating.
This returns a deduplicated list of transitive link dependencies and direct run dependencies.
"""
deps = [
def specs_to_relocate(spec: spack.spec.Spec) -> List[spack.spec.Spec]:
"""Return the set of specs that may be referenced in the install prefix of the provided spec.
We currently include non-external transitive link and direct run dependencies."""
specs = [
s
for s in itertools.chain(
spec.traverse(root=True, deptype="link"), spec.dependencies(deptype="run")
spec.traverse(root=True, deptype="link", order="breadth", key=traverse.by_dag_hash),
spec.dependencies(deptype="run"),
)
if not s.external
]
return llnl.util.lang.dedupe(deps, key=lambda s: s.dag_hash())
return list(llnl.util.lang.dedupe(specs, key=lambda s: s.dag_hash()))
def get_buildinfo_dict(spec):
@@ -630,7 +620,7 @@ def get_buildinfo_dict(spec):
# "relocate_binaries": [],
# "relocate_links": [],
"hardlinks_deduped": True,
"hash_to_prefix": {d.dag_hash(): str(d.prefix) for d in deps_to_relocate(spec)},
"hash_to_prefix": {d.dag_hash(): str(d.prefix) for d in specs_to_relocate(spec)},
}
@@ -683,19 +673,24 @@ def sign_specfile(key: str, specfile_path: str) -> str:
def _read_specs_and_push_index(
file_list, read_method, cache_prefix, db: BuildCacheDatabase, temp_dir, concurrency
file_list: List[str],
read_method: Callable,
cache_prefix: str,
db: BuildCacheDatabase,
temp_dir: str,
concurrency: int,
):
"""Read all the specs listed in the provided list, using thread given thread parallelism,
generate the index, and push it to the mirror.
Args:
file_list (list(str)): List of urls or file paths pointing at spec files to read
file_list: List of urls or file paths pointing at spec files to read
read_method: A function taking a single argument, either a url or a file path,
and which reads the spec file at that location, and returns the spec.
cache_prefix (str): prefix of the build cache on s3 where index should be pushed.
cache_prefix: prefix of the build cache on s3 where index should be pushed.
db: A spack database used for adding specs and then writing the index.
temp_dir (str): Location to write index.json and hash for pushing
concurrency (int): Number of parallel processes to use when fetching
temp_dir: Location to write index.json and hash for pushing
concurrency: Number of parallel processes to use when fetching
"""
for file in file_list:
contents = read_method(file)
@@ -713,7 +708,7 @@ def _read_specs_and_push_index(
# Now generate the index, compute its hash, and push the two files to
# the mirror.
index_json_path = os.path.join(temp_dir, "index.json")
index_json_path = os.path.join(temp_dir, spack_db.INDEX_JSON_FILE)
with open(index_json_path, "w", encoding="utf-8") as f:
db._write_to_file(f)
@@ -723,14 +718,14 @@ def _read_specs_and_push_index(
index_hash = compute_hash(index_string)
# Write the hash out to a local file
index_hash_path = os.path.join(temp_dir, "index.json.hash")
index_hash_path = os.path.join(temp_dir, INDEX_HASH_FILE)
with open(index_hash_path, "w", encoding="utf-8") as f:
f.write(index_hash)
# Push the index itself
web_util.push_to_url(
index_json_path,
url_util.join(cache_prefix, "index.json"),
url_util.join(cache_prefix, spack_db.INDEX_JSON_FILE),
keep_original=False,
extra_args={"ContentType": "application/json", "CacheControl": "no-cache"},
)
@@ -738,7 +733,7 @@ def _read_specs_and_push_index(
# Push the hash
web_util.push_to_url(
index_hash_path,
url_util.join(cache_prefix, "index.json.hash"),
url_util.join(cache_prefix, INDEX_HASH_FILE),
keep_original=False,
extra_args={"ContentType": "text/plain", "CacheControl": "no-cache"},
)
@@ -807,7 +802,7 @@ def url_read_method(url):
try:
_, _, spec_file = web_util.read_from_url(url)
contents = codecs.getreader("utf-8")(spec_file).read()
except web_util.SpackWebError as e:
except (web_util.SpackWebError, OSError) as e:
tty.error(f"Error reading specfile: {url}: {e}")
return contents
@@ -875,9 +870,12 @@ def _url_generate_package_index(url: str, tmpdir: str, concurrency: int = 32):
tty.debug(f"Retrieving spec descriptor files from {url} to build index")
db = BuildCacheDatabase(tmpdir)
db._write()
try:
_read_specs_and_push_index(file_list, read_fn, url, db, db.database_directory, concurrency)
_read_specs_and_push_index(
file_list, read_fn, url, db, str(db.database_directory), concurrency
)
except Exception as e:
raise GenerateIndexError(f"Encountered problem pushing package index to {url}: {e}") from e
@@ -1112,7 +1110,7 @@ def _exists_in_buildcache(spec: spack.spec.Spec, tmpdir: str, out_url: str) -> E
def prefixes_to_relocate(spec):
prefixes = [s.prefix for s in deps_to_relocate(spec)]
prefixes = [s.prefix for s in specs_to_relocate(spec)]
prefixes.append(spack.hooks.sbang.sbang_install_path())
prefixes.append(str(spack.store.STORE.layout.root))
return prefixes
@@ -1791,7 +1789,7 @@ def _oci_update_index(
db.mark(spec, "in_buildcache", True)
# Create the index.json file
index_json_path = os.path.join(tmpdir, "index.json")
index_json_path = os.path.join(tmpdir, spack_db.INDEX_JSON_FILE)
with open(index_json_path, "w", encoding="utf-8") as f:
db._write_to_file(f)
@@ -2012,7 +2010,7 @@ def fetch_url_to_mirror(url):
# Download the config = spec.json and the relevant tarball
try:
manifest = json.loads(response.read())
manifest = json.load(response)
spec_digest = spack.oci.image.Digest.from_string(manifest["config"]["digest"])
tarball_digest = spack.oci.image.Digest.from_string(
manifest["layers"][-1]["digest"]
@@ -2139,10 +2137,9 @@ def fetch_url_to_mirror(url):
def dedupe_hardlinks_if_necessary(root, buildinfo):
"""Updates a buildinfo dict for old archives that did
not dedupe hardlinks. De-duping hardlinks is necessary
when relocating files in parallel and in-place. This
means we must preserve inodes when relocating."""
"""Updates a buildinfo dict for old archives that did not dedupe hardlinks. De-duping hardlinks
is necessary when relocating files in parallel and in-place. This means we must preserve inodes
when relocating."""
# New archives don't need this.
if buildinfo.get("hardlinks_deduped", False):
@@ -2171,65 +2168,48 @@ def dedupe_hardlinks_if_necessary(root, buildinfo):
buildinfo[key] = new_list
def relocate_package(spec):
"""
Relocate the given package
"""
workdir = str(spec.prefix)
buildinfo = read_buildinfo_file(workdir)
new_layout_root = str(spack.store.STORE.layout.root)
new_prefix = str(spec.prefix)
new_rel_prefix = str(os.path.relpath(new_prefix, new_layout_root))
new_spack_prefix = str(spack.paths.prefix)
old_sbang_install_path = None
if "sbang_install_path" in buildinfo:
old_sbang_install_path = str(buildinfo["sbang_install_path"])
def relocate_package(spec: spack.spec.Spec) -> None:
"""Relocate binaries and text files in the given spec prefix, based on its buildinfo file."""
spec_prefix = str(spec.prefix)
buildinfo = read_buildinfo_file(spec_prefix)
old_layout_root = str(buildinfo["buildpath"])
old_spack_prefix = str(buildinfo.get("spackprefix"))
old_rel_prefix = buildinfo.get("relative_prefix")
old_prefix = os.path.join(old_layout_root, old_rel_prefix)
rel = buildinfo.get("relative_rpaths", False)
# In the past prefix_to_hash was the default and externals were not dropped, so prefixes
# were not unique.
# Warn about old style tarballs created with the --rel flag (removed in Spack v0.20)
if buildinfo.get("relative_rpaths", False):
tty.warn(
f"Tarball for {spec} uses relative rpaths, which can cause library loading issues."
)
# In Spack 0.19 and older prefix_to_hash was the default and externals were not dropped, so
# prefixes were not unique.
if "hash_to_prefix" in buildinfo:
hash_to_old_prefix = buildinfo["hash_to_prefix"]
elif "prefix_to_hash" in buildinfo:
hash_to_old_prefix = dict((v, k) for (k, v) in buildinfo["prefix_to_hash"].items())
hash_to_old_prefix = {v: k for (k, v) in buildinfo["prefix_to_hash"].items()}
else:
hash_to_old_prefix = dict()
raise NewLayoutException(
"Package tarball was created from an install prefix with a different directory layout "
"and an older buildcache create implementation. It cannot be relocated."
)
if old_rel_prefix != new_rel_prefix and not hash_to_old_prefix:
msg = "Package tarball was created from an install "
msg += "prefix with a different directory layout and an older "
msg += "buildcache create implementation. It cannot be relocated."
raise NewLayoutException(msg)
prefix_to_prefix: Dict[str, str] = {}
# Spurious replacements (e.g. sbang) will cause issues with binaries
# For example, the new sbang can be longer than the old one.
# Hence 2 dictionaries are maintained here.
prefix_to_prefix_text = collections.OrderedDict()
prefix_to_prefix_bin = collections.OrderedDict()
if "sbang_install_path" in buildinfo:
old_sbang_install_path = str(buildinfo["sbang_install_path"])
prefix_to_prefix[old_sbang_install_path] = spack.hooks.sbang.sbang_install_path()
if old_sbang_install_path:
install_path = spack.hooks.sbang.sbang_install_path()
prefix_to_prefix_text[old_sbang_install_path] = install_path
# First match specific prefix paths. Possibly the *local* install prefix of some dependency is
# in an upstream, so we cannot assume the original spack store root can be mapped uniformly to
# the new spack store root.
# First match specific prefix paths. Possibly the *local* install prefix
# of some dependency is in an upstream, so we cannot assume the original
# spack store root can be mapped uniformly to the new spack store root.
#
# If the spec is spliced, we need to handle the simultaneous mapping
# from the old install_tree to the new install_tree and from the build_spec
# to the spliced spec.
# Because foo.build_spec is foo for any non-spliced spec, we can simplify
# by checking for spliced-in nodes by checking for nodes not in the build_spec
# without any explicit check for whether the spec is spliced.
# An analog in this algorithm is any spec that shares a name or provides the same virtuals
# in the context of the relevant root spec. This ensures that the analog for a spec s
# is the spec that s replaced when we spliced.
relocation_specs = deps_to_relocate(spec)
# If the spec is spliced, we need to handle the simultaneous mapping from the old install_tree
# to the new install_tree and from the build_spec to the spliced spec. Because foo.build_spec
# is foo for any non-spliced spec, we can simplify by checking for spliced-in nodes by checking
# for nodes not in the build_spec without any explicit check for whether the spec is spliced.
# An analog in this algorithm is any spec that shares a name or provides the same virtuals in
# the context of the relevant root spec. This ensures that the analog for a spec s is the spec
# that s replaced when we spliced.
relocation_specs = specs_to_relocate(spec)
build_spec_ids = set(id(s) for s in spec.build_spec.traverse(deptype=dt.ALL & ~dt.BUILD))
for s in relocation_specs:
analog = s
@@ -2248,98 +2228,66 @@ def relocate_package(spec):
lookup_dag_hash = analog.dag_hash()
if lookup_dag_hash in hash_to_old_prefix:
old_dep_prefix = hash_to_old_prefix[lookup_dag_hash]
prefix_to_prefix_bin[old_dep_prefix] = str(s.prefix)
prefix_to_prefix_text[old_dep_prefix] = str(s.prefix)
prefix_to_prefix[old_dep_prefix] = str(s.prefix)
# Only then add the generic fallback of install prefix -> install prefix.
prefix_to_prefix_text[old_prefix] = new_prefix
prefix_to_prefix_bin[old_prefix] = new_prefix
prefix_to_prefix_text[old_layout_root] = new_layout_root
prefix_to_prefix_bin[old_layout_root] = new_layout_root
prefix_to_prefix[old_layout_root] = str(spack.store.STORE.layout.root)
# This is vestigial code for the *old* location of sbang. Previously,
# sbang was a bash script, and it lived in the spack prefix. It is
# now a POSIX script that lives in the install prefix. Old packages
# will have the old sbang location in their shebangs.
orig_sbang = "#!/bin/bash {0}/bin/sbang".format(old_spack_prefix)
new_sbang = spack.hooks.sbang.sbang_shebang_line()
prefix_to_prefix_text[orig_sbang] = new_sbang
# Delete identity mappings from prefix_to_prefix
prefix_to_prefix = {k: v for k, v in prefix_to_prefix.items() if k != v}
tty.debug("Relocating package from", "%s to %s." % (old_layout_root, new_layout_root))
# If there's nothing to relocate, we're done.
if not prefix_to_prefix:
return
# Old archives maybe have hardlinks repeated.
dedupe_hardlinks_if_necessary(workdir, buildinfo)
for old, new in prefix_to_prefix.items():
tty.debug(f"Relocating: {old} => {new}.")
def is_backup_file(file):
return file.endswith("~")
# Old archives may have hardlinks repeated.
dedupe_hardlinks_if_necessary(spec_prefix, buildinfo)
# Text files containing the prefix text
text_names = list()
for filename in buildinfo["relocate_textfiles"]:
text_name = os.path.join(workdir, filename)
# Don't add backup files generated by filter_file during install step.
if not is_backup_file(text_name):
text_names.append(text_name)
textfiles = [os.path.join(spec_prefix, f) for f in buildinfo["relocate_textfiles"]]
binaries = [os.path.join(spec_prefix, f) for f in buildinfo.get("relocate_binaries")]
links = [os.path.join(spec_prefix, f) for f in buildinfo.get("relocate_links", [])]
# If we are not installing back to the same install tree do the relocation
if old_prefix != new_prefix:
files_to_relocate = [
os.path.join(workdir, filename) for filename in buildinfo.get("relocate_binaries")
]
# If the buildcache was not created with relativized rpaths
# do the relocation of path in binaries
platform = spack.platforms.by_name(spec.platform)
if "macho" in platform.binary_formats:
relocate.relocate_macho_binaries(
files_to_relocate,
old_layout_root,
new_layout_root,
prefix_to_prefix_bin,
rel,
old_prefix,
new_prefix,
)
elif "elf" in platform.binary_formats and not rel:
# The new ELF dynamic section relocation logic only handles absolute to
# absolute relocation.
relocate.new_relocate_elf_binaries(files_to_relocate, prefix_to_prefix_bin)
elif "elf" in platform.binary_formats and rel:
relocate.relocate_elf_binaries(
files_to_relocate,
old_layout_root,
new_layout_root,
prefix_to_prefix_bin,
rel,
old_prefix,
new_prefix,
)
platform = spack.platforms.by_name(spec.platform)
if "macho" in platform.binary_formats:
relocate.relocate_macho_binaries(binaries, prefix_to_prefix)
elif "elf" in platform.binary_formats:
relocate.relocate_elf_binaries(binaries, prefix_to_prefix)
# Relocate links to the new install prefix
links = [os.path.join(workdir, f) for f in buildinfo.get("relocate_links", [])]
relocate.relocate_links(links, prefix_to_prefix_bin)
relocate.relocate_links(links, prefix_to_prefix)
relocate.relocate_text(textfiles, prefix_to_prefix)
changed_files = relocate.relocate_text_bin(binaries, prefix_to_prefix)
# For all buildcaches
# relocate the install prefixes in text files including dependencies
relocate.relocate_text(text_names, prefix_to_prefix_text)
# Add ad-hoc signatures to patched macho files when on macOS.
if "macho" in platform.binary_formats and sys.platform == "darwin":
codesign = which("codesign")
if not codesign:
return
for binary in changed_files:
# preserve the original inode by running codesign on a copy
with fsys.edit_in_place_through_temporary_file(binary) as tmp_binary:
codesign("-fs-", tmp_binary)
# relocate the install prefixes in binary files including dependencies
changed_files = relocate.relocate_text_bin(files_to_relocate, prefix_to_prefix_bin)
install_manifest = os.path.join(
spec.prefix,
spack.store.STORE.layout.metadata_dir,
spack.store.STORE.layout.manifest_file_name,
)
if not os.path.exists(install_manifest):
spec_id = spec.format("{name}/{hash:7}")
tty.warn("No manifest file in tarball for spec %s" % spec_id)
# Add ad-hoc signatures to patched macho files when on macOS.
if "macho" in platform.binary_formats and sys.platform == "darwin":
codesign = which("codesign")
if not codesign:
return
for binary in changed_files:
# preserve the original inode by running codesign on a copy
with fsys.edit_in_place_through_temporary_file(binary) as tmp_binary:
codesign("-fs-", tmp_binary)
# overwrite old metadata with new
if spec.spliced:
# rewrite spec on disk
spack.store.STORE.layout.write_spec(spec, spack.store.STORE.layout.spec_file_path(spec))
# If we are installing back to the same location
# relocate the sbang location if the spack directory changed
else:
if old_spack_prefix != new_spack_prefix:
relocate.relocate_text(text_names, prefix_to_prefix_text)
# de-cache the install manifest
with contextlib.suppress(FileNotFoundError):
os.unlink(install_manifest)
def _extract_inner_tarball(spec, filename, extract_to, signature_required: bool, remote_checksum):
@@ -2507,15 +2455,6 @@ def extract_tarball(spec, download_result, force=False, timer=timer.NULL_TIMER):
except Exception as e:
shutil.rmtree(spec.prefix, ignore_errors=True)
raise e
else:
manifest_file = os.path.join(
spec.prefix,
spack.store.STORE.layout.metadata_dir,
spack.store.STORE.layout.manifest_file_name,
)
if not os.path.exists(manifest_file):
spec_id = spec.format("{name}/{hash:7}")
tty.warn("No manifest file in tarball for spec %s" % spec_id)
finally:
if tmpdir:
shutil.rmtree(tmpdir, ignore_errors=True)
@@ -2620,10 +2559,6 @@ def install_root_node(
tty.msg('Installing "{0}" from a buildcache'.format(spec.format()))
extract_tarball(spec, download_result, force)
spec.package.windows_establish_runtime_linkage()
if spec.spliced: # overwrite old metadata with new
spack.store.STORE.layout.write_spec(
spec, spack.store.STORE.layout.spec_file_path(spec)
)
spack.hooks.post_install(spec, False)
spack.store.STORE.db.add(spec, allow_missing=allow_missing)
@@ -2661,11 +2596,14 @@ def try_direct_fetch(spec, mirrors=None):
)
try:
_, _, fs = web_util.read_from_url(buildcache_fetch_url_signed_json)
specfile_contents = codecs.getreader("utf-8")(fs).read()
specfile_is_signed = True
except web_util.SpackWebError as e1:
except (web_util.SpackWebError, OSError) as e1:
try:
_, _, fs = web_util.read_from_url(buildcache_fetch_url_json)
except web_util.SpackWebError as e2:
specfile_contents = codecs.getreader("utf-8")(fs).read()
specfile_is_signed = False
except (web_util.SpackWebError, OSError) as e2:
tty.debug(
f"Did not find {specfile_name} on {buildcache_fetch_url_signed_json}",
e1,
@@ -2675,7 +2613,6 @@ def try_direct_fetch(spec, mirrors=None):
f"Did not find {specfile_name} on {buildcache_fetch_url_json}", e2, level=2
)
continue
specfile_contents = codecs.getreader("utf-8")(fs).read()
# read the spec from the build cache file. All specs in build caches
# are concrete (as they are built) so we need to mark this spec
@@ -2769,8 +2706,9 @@ def get_keys(install=False, trust=False, force=False, mirrors=None):
try:
_, _, json_file = web_util.read_from_url(keys_index)
json_index = sjson.load(codecs.getreader("utf-8")(json_file))
except web_util.SpackWebError as url_err:
json_index = sjson.load(json_file)
except (web_util.SpackWebError, OSError, ValueError) as url_err:
# TODO: avoid repeated request
if web_util.url_exists(keys_index):
tty.error(
f"Unable to find public keys in {url_util.format(fetch_url)},"
@@ -3017,14 +2955,14 @@ def __init__(self, url, local_hash, urlopen=web_util.urlopen):
def get_remote_hash(self):
# Failure to fetch index.json.hash is not fatal
url_index_hash = url_util.join(self.url, BUILD_CACHE_RELATIVE_PATH, "index.json.hash")
url_index_hash = url_util.join(self.url, BUILD_CACHE_RELATIVE_PATH, INDEX_HASH_FILE)
try:
response = self.urlopen(urllib.request.Request(url_index_hash, headers=self.headers))
except (TimeoutError, urllib.error.URLError):
remote_hash = response.read(64)
except OSError:
return None
# Validate the hash
remote_hash = response.read(64)
if not re.match(rb"[a-f\d]{64}$", remote_hash):
return None
return remote_hash.decode("utf-8")
@@ -3038,17 +2976,17 @@ def conditional_fetch(self) -> FetchIndexResult:
return FetchIndexResult(etag=None, hash=None, data=None, fresh=True)
# Otherwise, download index.json
url_index = url_util.join(self.url, BUILD_CACHE_RELATIVE_PATH, "index.json")
url_index = url_util.join(self.url, BUILD_CACHE_RELATIVE_PATH, spack_db.INDEX_JSON_FILE)
try:
response = self.urlopen(urllib.request.Request(url_index, headers=self.headers))
except (TimeoutError, urllib.error.URLError) as e:
raise FetchIndexError("Could not fetch index from {}".format(url_index), e) from e
except OSError as e:
raise FetchIndexError(f"Could not fetch index from {url_index}", e) from e
try:
result = codecs.getreader("utf-8")(response).read()
except ValueError as e:
raise FetchIndexError("Remote index {} is invalid".format(url_index), e) from e
except (ValueError, OSError) as e:
raise FetchIndexError(f"Remote index {url_index} is invalid") from e
computed_hash = compute_hash(result)
@@ -3082,7 +3020,7 @@ def __init__(self, url, etag, urlopen=web_util.urlopen):
def conditional_fetch(self) -> FetchIndexResult:
# Just do a conditional fetch immediately
url = url_util.join(self.url, BUILD_CACHE_RELATIVE_PATH, "index.json")
url = url_util.join(self.url, BUILD_CACHE_RELATIVE_PATH, spack_db.INDEX_JSON_FILE)
headers = {"User-Agent": web_util.SPACK_USER_AGENT, "If-None-Match": f'"{self.etag}"'}
try:
@@ -3092,12 +3030,12 @@ def conditional_fetch(self) -> FetchIndexResult:
# Not modified; that means fresh.
return FetchIndexResult(etag=None, hash=None, data=None, fresh=True)
raise FetchIndexError(f"Could not fetch index {url}", e) from e
except (TimeoutError, urllib.error.URLError) as e:
except OSError as e: # URLError, socket.timeout, etc.
raise FetchIndexError(f"Could not fetch index {url}", e) from e
try:
result = codecs.getreader("utf-8")(response).read()
except ValueError as e:
except (ValueError, OSError) as e:
raise FetchIndexError(f"Remote index {url} is invalid", e) from e
headers = response.headers
@@ -3129,11 +3067,11 @@ def conditional_fetch(self) -> FetchIndexResult:
headers={"Accept": "application/vnd.oci.image.manifest.v1+json"},
)
)
except (TimeoutError, urllib.error.URLError) as e:
except OSError as e:
raise FetchIndexError(f"Could not fetch manifest from {url_manifest}", e) from e
try:
manifest = json.loads(response.read())
manifest = json.load(response)
except Exception as e:
raise FetchIndexError(f"Remote index {url_manifest} is invalid", e) from e
@@ -3148,14 +3086,16 @@ def conditional_fetch(self) -> FetchIndexResult:
return FetchIndexResult(etag=None, hash=None, data=None, fresh=True)
# Otherwise fetch the blob / index.json
response = self.urlopen(
urllib.request.Request(
url=self.ref.blob_url(index_digest),
headers={"Accept": "application/vnd.oci.image.layer.v1.tar+gzip"},
try:
response = self.urlopen(
urllib.request.Request(
url=self.ref.blob_url(index_digest),
headers={"Accept": "application/vnd.oci.image.layer.v1.tar+gzip"},
)
)
)
result = codecs.getreader("utf-8")(response).read()
result = codecs.getreader("utf-8")(response).read()
except (OSError, ValueError) as e:
raise FetchIndexError(f"Remote index {url_manifest} is invalid", e) from e
# Make sure the blob we download has the advertised hash
if compute_hash(result) != index_digest.digest:

View File

@@ -5,12 +5,14 @@
import fnmatch
import glob
import importlib
import os.path
import os
import re
import sys
import sysconfig
import warnings
from typing import Dict, Optional, Sequence, Union
from typing import Optional, Sequence, Union
from typing_extensions import TypedDict
import archspec.cpu
@@ -18,13 +20,17 @@
from llnl.util import tty
import spack.platforms
import spack.spec
import spack.store
import spack.util.environment
import spack.util.executable
from .config import spec_for_current_python
QueryInfo = Dict[str, "spack.spec.Spec"]
class QueryInfo(TypedDict, total=False):
spec: spack.spec.Spec
command: spack.util.executable.Executable
def _python_import(module: str) -> bool:
@@ -211,7 +217,9 @@ def _executables_in_store(
):
spack.util.environment.path_put_first("PATH", [bin_dir])
if query_info is not None:
query_info["command"] = spack.util.executable.which(*executables, path=bin_dir)
query_info["command"] = spack.util.executable.which(
*executables, path=bin_dir, required=True
)
query_info["spec"] = concrete_spec
return True
return False

View File

@@ -27,9 +27,9 @@
class ClingoBootstrapConcretizer:
def __init__(self, configuration):
self.host_platform = spack.platforms.host()
self.host_os = self.host_platform.operating_system("frontend")
self.host_os = self.host_platform.default_operating_system()
self.host_target = archspec.cpu.host().family
self.host_architecture = spack.spec.ArchSpec.frontend_arch()
self.host_architecture = spack.spec.ArchSpec.default_arch()
self.host_architecture.target = str(self.host_target)
self.host_compiler = self._valid_compiler_or_raise()
self.host_python = self.python_external_spec()

View File

@@ -4,7 +4,7 @@
"""Manage configuration swapping for bootstrapping purposes"""
import contextlib
import os.path
import os
import sys
from typing import Any, Dict, Generator, MutableSequence, Sequence
@@ -141,7 +141,7 @@ def _bootstrap_config_scopes() -> Sequence["spack.config.ConfigScope"]:
def _add_compilers_if_missing() -> None:
arch = spack.spec.ArchSpec.frontend_arch()
arch = spack.spec.ArchSpec.default_arch()
if not spack.compilers.compilers_for_arch(arch):
spack.compilers.find_compilers()

View File

@@ -25,7 +25,6 @@
import functools
import json
import os
import os.path
import sys
import uuid
from typing import Any, Callable, Dict, List, Optional, Tuple
@@ -34,8 +33,10 @@
from llnl.util.lang import GroupedExceptionHandler
import spack.binary_distribution
import spack.concretize
import spack.config
import spack.detection
import spack.error
import spack.mirrors.mirror
import spack.platforms
import spack.spec
@@ -44,10 +45,17 @@
import spack.util.executable
import spack.util.path
import spack.util.spack_yaml
import spack.util.url
import spack.version
from spack.installer import PackageInstaller
from ._common import _executables_in_store, _python_import, _root_spec, _try_import_from_store
from ._common import (
QueryInfo,
_executables_in_store,
_python_import,
_root_spec,
_try_import_from_store,
)
from .clingo import ClingoBootstrapConcretizer
from .config import spack_python_interpreter, spec_for_current_python
@@ -89,8 +97,12 @@ def __init__(self, conf: ConfigDictionary) -> None:
self.name = conf["name"]
self.metadata_dir = spack.util.path.canonicalize_path(conf["metadata"])
# Promote (relative) paths to file urls
self.url = spack.mirrors.mirror.Mirror(conf["info"]["url"]).fetch_url
# Check for relative paths, and turn them into absolute paths
# root is the metadata_dir
maybe_url = conf["info"]["url"]
if spack.util.url.is_path_instead_of_url(maybe_url) and not os.path.isabs(maybe_url):
maybe_url = os.path.join(self.metadata_dir, maybe_url)
self.url = spack.mirrors.mirror.Mirror(maybe_url).fetch_url
@property
def mirror_scope(self) -> spack.config.InternalConfigScope:
@@ -134,7 +146,7 @@ class BuildcacheBootstrapper(Bootstrapper):
def __init__(self, conf) -> None:
super().__init__(conf)
self.last_search: Optional[ConfigDictionary] = None
self.last_search: Optional[QueryInfo] = None
self.config_scope_name = f"bootstrap_buildcache-{uuid.uuid4()}"
@staticmethod
@@ -211,14 +223,14 @@ def _install_and_test(
for _, pkg_hash, pkg_sha256 in item["binaries"]:
self._install_by_hash(pkg_hash, pkg_sha256, bincache_platform)
info: ConfigDictionary = {}
info: QueryInfo = {}
if test_fn(query_spec=abstract_spec, query_info=info):
self.last_search = info
return True
return False
def try_import(self, module: str, abstract_spec_str: str) -> bool:
info: ConfigDictionary
info: QueryInfo
test_fn, info = functools.partial(_try_import_from_store, module), {}
if test_fn(query_spec=abstract_spec_str, query_info=info):
return True
@@ -231,7 +243,7 @@ def try_import(self, module: str, abstract_spec_str: str) -> bool:
return self._install_and_test(abstract_spec, bincache_platform, data, test_fn)
def try_search_path(self, executables: Tuple[str], abstract_spec_str: str) -> bool:
info: ConfigDictionary
info: QueryInfo
test_fn, info = functools.partial(_executables_in_store, executables), {}
if test_fn(query_spec=abstract_spec_str, query_info=info):
self.last_search = info
@@ -249,11 +261,11 @@ class SourceBootstrapper(Bootstrapper):
def __init__(self, conf) -> None:
super().__init__(conf)
self.last_search: Optional[ConfigDictionary] = None
self.last_search: Optional[QueryInfo] = None
self.config_scope_name = f"bootstrap_source-{uuid.uuid4()}"
def try_import(self, module: str, abstract_spec_str: str) -> bool:
info: ConfigDictionary = {}
info: QueryInfo = {}
if _try_import_from_store(module, abstract_spec_str, query_info=info):
self.last_search = info
return True
@@ -270,10 +282,10 @@ def try_import(self, module: str, abstract_spec_str: str) -> bool:
bootstrapper = ClingoBootstrapConcretizer(configuration=spack.config.CONFIG)
concrete_spec = bootstrapper.concretize()
else:
concrete_spec = spack.spec.Spec(
abstract_spec = spack.spec.Spec(
abstract_spec_str + " ^" + spec_for_current_python()
)
concrete_spec.concretize()
concrete_spec = spack.concretize.concretize_one(abstract_spec)
msg = "[BOOTSTRAP MODULE {0}] Try installing '{1}' from sources"
tty.debug(msg.format(module, abstract_spec_str))
@@ -288,7 +300,7 @@ def try_import(self, module: str, abstract_spec_str: str) -> bool:
return False
def try_search_path(self, executables: Tuple[str], abstract_spec_str: str) -> bool:
info: ConfigDictionary = {}
info: QueryInfo = {}
if _executables_in_store(executables, abstract_spec_str, query_info=info):
self.last_search = info
return True
@@ -299,7 +311,7 @@ def try_search_path(self, executables: Tuple[str], abstract_spec_str: str) -> bo
# might reduce compilation time by a fair amount
_add_externals_if_missing()
concrete_spec = spack.spec.Spec(abstract_spec_str).concretized()
concrete_spec = spack.concretize.concretize_one(abstract_spec_str)
msg = "[BOOTSTRAP] Try installing '{0}' from sources"
tty.debug(msg.format(abstract_spec_str))
with spack.config.override(self.mirror_scope):
@@ -316,11 +328,9 @@ def create_bootstrapper(conf: ConfigDictionary):
return _bootstrap_methods[btype](conf)
def source_is_enabled_or_raise(conf: ConfigDictionary):
"""Raise ValueError if the source is not enabled for bootstrapping"""
trusted, name = spack.config.get("bootstrap:trusted"), conf["name"]
if not trusted.get(name, False):
raise ValueError("source is not trusted")
def source_is_enabled(conf: ConfigDictionary) -> bool:
"""Returns true if the source is not enabled for bootstrapping"""
return spack.config.get("bootstrap:trusted").get(conf["name"], False)
def ensure_module_importable_or_raise(module: str, abstract_spec: Optional[str] = None):
@@ -350,24 +360,23 @@ def ensure_module_importable_or_raise(module: str, abstract_spec: Optional[str]
exception_handler = GroupedExceptionHandler()
for current_config in bootstrapping_sources():
if not source_is_enabled(current_config):
continue
with exception_handler.forward(current_config["name"], Exception):
source_is_enabled_or_raise(current_config)
current_bootstrapper = create_bootstrapper(current_config)
if current_bootstrapper.try_import(module, abstract_spec):
if create_bootstrapper(current_config).try_import(module, abstract_spec):
return
assert exception_handler, (
f"expected at least one exception to have been raised at this point: "
f"while bootstrapping {module}"
)
msg = f'cannot bootstrap the "{module}" Python module '
if abstract_spec:
msg += f'from spec "{abstract_spec}" '
if tty.is_debug():
if not exception_handler:
msg += ": no bootstrapping sources are enabled"
elif spack.error.debug or spack.error.SHOW_BACKTRACE:
msg += exception_handler.grouped_message(with_tracebacks=True)
else:
msg += exception_handler.grouped_message(with_tracebacks=False)
msg += "\nRun `spack --debug ...` for more detailed errors"
msg += "\nRun `spack --backtrace ...` for more detailed errors"
raise ImportError(msg)
@@ -405,8 +414,9 @@ def ensure_executables_in_path_or_raise(
exception_handler = GroupedExceptionHandler()
for current_config in bootstrapping_sources():
if not source_is_enabled(current_config):
continue
with exception_handler.forward(current_config["name"], Exception):
source_is_enabled_or_raise(current_config)
current_bootstrapper = create_bootstrapper(current_config)
if current_bootstrapper.try_search_path(executables, abstract_spec):
# Additional environment variables needed
@@ -414,6 +424,7 @@ def ensure_executables_in_path_or_raise(
current_bootstrapper.last_search["spec"],
current_bootstrapper.last_search["command"],
)
assert cmd is not None, "expected an Executable"
cmd.add_default_envmod(
spack.user_environment.environment_modifications_for_specs(
concrete_spec, set_package_py_globals=False
@@ -421,18 +432,17 @@ def ensure_executables_in_path_or_raise(
)
return cmd
assert exception_handler, (
f"expected at least one exception to have been raised at this point: "
f"while bootstrapping {executables_str}"
)
msg = f"cannot bootstrap any of the {executables_str} executables "
if abstract_spec:
msg += f'from spec "{abstract_spec}" '
if tty.is_debug():
if not exception_handler:
msg += ": no bootstrapping sources are enabled"
elif spack.error.debug or spack.error.SHOW_BACKTRACE:
msg += exception_handler.grouped_message(with_tracebacks=True)
else:
msg += exception_handler.grouped_message(with_tracebacks=False)
msg += "\nRun `spack --debug ...` for more detailed errors"
msg += "\nRun `spack --backtrace ...` for more detailed errors"
raise RuntimeError(msg)

View File

@@ -63,7 +63,6 @@ def _missing(name: str, purpose: str, system_only: bool = True) -> str:
def _core_requirements() -> List[RequiredResponseType]:
_core_system_exes = {
"make": _missing("make", "required to build software from sources"),
"patch": _missing("patch", "required to patch source code before building"),
"tar": _missing("tar", "required to manage code archives"),
"gzip": _missing("gzip", "required to compress/decompress code archives"),

View File

@@ -44,7 +44,19 @@
from enum import Flag, auto
from itertools import chain
from multiprocessing.connection import Connection
from typing import Callable, Dict, List, Optional, Set, Tuple
from typing import (
Callable,
Dict,
List,
Optional,
Sequence,
Set,
TextIO,
Tuple,
Type,
Union,
overload,
)
import archspec.cpu
@@ -146,48 +158,128 @@ def get_effective_jobs(jobs, parallel=True, supports_jobserver=False):
class MakeExecutable(Executable):
"""Special callable executable object for make so the user can specify
parallelism options on a per-invocation basis. Specifying
'parallel' to the call will override whatever the package's
global setting is, so you can either default to true or false and
override particular calls. Specifying 'jobs_env' to a particular
call will name an environment variable which will be set to the
parallelism level (without affecting the normal invocation with
-j).
"""Special callable executable object for make so the user can specify parallelism options
on a per-invocation basis.
"""
def __init__(self, name, jobs, **kwargs):
supports_jobserver = kwargs.pop("supports_jobserver", True)
super().__init__(name, **kwargs)
def __init__(self, name: str, *, jobs: int, supports_jobserver: bool = True) -> None:
super().__init__(name)
self.supports_jobserver = supports_jobserver
self.jobs = jobs
def __call__(self, *args, **kwargs):
"""parallel, and jobs_env from kwargs are swallowed and used here;
remaining arguments are passed through to the superclass.
"""
parallel = kwargs.pop("parallel", True)
jobs_env = kwargs.pop("jobs_env", None)
jobs_env_supports_jobserver = kwargs.pop("jobs_env_supports_jobserver", False)
@overload
def __call__(
self,
*args: str,
parallel: bool = ...,
jobs_env: Optional[str] = ...,
jobs_env_supports_jobserver: bool = ...,
fail_on_error: bool = ...,
ignore_errors: Union[int, Sequence[int]] = ...,
ignore_quotes: Optional[bool] = ...,
timeout: Optional[int] = ...,
env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
extra_env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
input: Optional[TextIO] = ...,
output: Union[Optional[TextIO], str] = ...,
error: Union[Optional[TextIO], str] = ...,
_dump_env: Optional[Dict[str, str]] = ...,
) -> None: ...
@overload
def __call__(
self,
*args: str,
parallel: bool = ...,
jobs_env: Optional[str] = ...,
jobs_env_supports_jobserver: bool = ...,
fail_on_error: bool = ...,
ignore_errors: Union[int, Sequence[int]] = ...,
ignore_quotes: Optional[bool] = ...,
timeout: Optional[int] = ...,
env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
extra_env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
input: Optional[TextIO] = ...,
output: Union[Type[str], Callable] = ...,
error: Union[Optional[TextIO], str, Type[str], Callable] = ...,
_dump_env: Optional[Dict[str, str]] = ...,
) -> str: ...
@overload
def __call__(
self,
*args: str,
parallel: bool = ...,
jobs_env: Optional[str] = ...,
jobs_env_supports_jobserver: bool = ...,
fail_on_error: bool = ...,
ignore_errors: Union[int, Sequence[int]] = ...,
ignore_quotes: Optional[bool] = ...,
timeout: Optional[int] = ...,
env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
extra_env: Optional[Union[Dict[str, str], EnvironmentModifications]] = ...,
input: Optional[TextIO] = ...,
output: Union[Optional[TextIO], str, Type[str], Callable] = ...,
error: Union[Type[str], Callable] = ...,
_dump_env: Optional[Dict[str, str]] = ...,
) -> str: ...
def __call__(
self,
*args: str,
parallel: bool = True,
jobs_env: Optional[str] = None,
jobs_env_supports_jobserver: bool = False,
**kwargs,
) -> Optional[str]:
"""Runs this "make" executable in a subprocess.
Args:
parallel: if False, parallelism is disabled
jobs_env: environment variable that will be set to the current level of parallelism
jobs_env_supports_jobserver: whether the jobs env supports a job server
For all the other **kwargs, refer to the base class.
"""
jobs = get_effective_jobs(
self.jobs, parallel=parallel, supports_jobserver=self.supports_jobserver
)
if jobs is not None:
args = ("-j{0}".format(jobs),) + args
args = (f"-j{jobs}",) + args
if jobs_env:
# Caller wants us to set an environment variable to
# control the parallelism.
# Caller wants us to set an environment variable to control the parallelism
jobs_env_jobs = get_effective_jobs(
self.jobs, parallel=parallel, supports_jobserver=jobs_env_supports_jobserver
)
if jobs_env_jobs is not None:
kwargs["extra_env"] = {jobs_env: str(jobs_env_jobs)}
extra_env = kwargs.setdefault("extra_env", {})
extra_env.update({jobs_env: str(jobs_env_jobs)})
return super().__call__(*args, **kwargs)
class UndeclaredDependencyError(spack.error.SpackError):
"""Raised if a dependency is invoking an executable through a module global, without
declaring a dependency on it.
"""
class DeprecatedExecutable:
def __init__(self, pkg: str, exe: str, exe_pkg: str) -> None:
self.pkg = pkg
self.exe = exe
self.exe_pkg = exe_pkg
def __call__(self, *args, **kwargs):
raise UndeclaredDependencyError(
f"{self.pkg} is using {self.exe} without declaring a dependency on {self.exe_pkg}"
)
def add_default_env(self, key: str, value: str):
self.__call__()
def clean_environment():
# Stuff in here sanitizes the build environment to eliminate
# anything the user has set that may interfere. We apply it immediately
@@ -209,11 +301,13 @@ def clean_environment():
env.unset("CPLUS_INCLUDE_PATH")
env.unset("OBJC_INCLUDE_PATH")
# prevent configure scripts from sourcing variables from config site file (AC_SITE_LOAD).
env.set("CONFIG_SITE", os.devnull)
env.unset("CMAKE_PREFIX_PATH")
env.unset("PYTHONPATH")
env.unset("R_HOME")
env.unset("R_ENVIRON")
env.unset("LUA_PATH")
env.unset("LUA_CPATH")
@@ -621,10 +715,9 @@ def set_package_py_globals(pkg, context: Context = Context.BUILD):
module.std_meson_args = spack.build_systems.meson.MesonBuilder.std_args(pkg)
module.std_pip_args = spack.build_systems.python.PythonPipBuilder.std_args(pkg)
# TODO: make these build deps that can be installed if not found.
module.make = MakeExecutable("make", jobs)
module.gmake = MakeExecutable("gmake", jobs)
module.ninja = MakeExecutable("ninja", jobs, supports_jobserver=False)
module.make = DeprecatedExecutable(pkg.name, "make", "gmake")
module.gmake = DeprecatedExecutable(pkg.name, "gmake", "gmake")
module.ninja = DeprecatedExecutable(pkg.name, "ninja", "ninja")
# TODO: johnwparent: add package or builder support to define these build tools
# for now there is no entrypoint for builders to define these on their
# own

View File

@@ -6,7 +6,9 @@
import llnl.util.filesystem as fs
import spack.directives
import spack.spec
import spack.util.executable
import spack.util.prefix
from .autotools import AutotoolsBuilder, AutotoolsPackage
@@ -17,19 +19,18 @@ class AspellBuilder(AutotoolsBuilder):
to the Aspell extensions.
"""
def configure(self, pkg, spec, prefix):
def configure(
self,
pkg: "AspellDictPackage", # type: ignore[override]
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
):
aspell = spec["aspell"].prefix.bin.aspell
prezip = spec["aspell"].prefix.bin.prezip
destdir = prefix
sh = spack.util.executable.which("sh")
sh(
"./configure",
"--vars",
"ASPELL={0}".format(aspell),
"PREZIP={0}".format(prezip),
"DESTDIR={0}".format(destdir),
)
sh = spack.util.executable.Executable("/bin/sh")
sh("./configure", "--vars", f"ASPELL={aspell}", f"PREZIP={prezip}", f"DESTDIR={destdir}")
# Aspell dictionaries install their bits into their prefix.lib

View File

@@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import os.path
import stat
import subprocess
from typing import Callable, List, Optional, Set, Tuple, Union
@@ -356,6 +355,13 @@ def _do_patch_libtool_configure(self) -> None:
)
# Support Libtool 2.4.2 and older:
x.filter(regex=r'^(\s*test \$p = "-R")(; then\s*)$', repl=r'\1 || test x-l = x"$p"\2')
# Configure scripts generated with libtool < 2.5.4 have a faulty test for the
# -single_module linker flag. A deprecation warning makes it think the default is
# -multi_module, triggering it to use problematic linker flags (such as ld -r). The
# linker default is `-single_module` from (ancient) macOS 10.4, so override by setting
# `lt_cv_apple_cc_single_mod=yes`. See the fix in libtool commit
# 82f7f52123e4e7e50721049f7fa6f9b870e09c9d.
x.filter("lt_cv_apple_cc_single_mod=no", "lt_cv_apple_cc_single_mod=yes", string=True)
@spack.phase_callbacks.run_after("configure")
def _do_patch_libtool(self) -> None:
@@ -527,7 +533,7 @@ def build_directory(self) -> str:
return build_dir
@spack.phase_callbacks.run_before("autoreconf")
def delete_configure_to_force_update(self) -> None:
def _delete_configure_to_force_update(self) -> None:
if self.force_autoreconf:
fs.force_remove(self.configure_abs_path)
@@ -540,7 +546,7 @@ def autoreconf_search_path_args(self) -> List[str]:
return _autoreconf_search_path_args(self.spec)
@spack.phase_callbacks.run_after("autoreconf")
def set_configure_or_die(self) -> None:
def _set_configure_or_die(self) -> None:
"""Ensure the presence of a "configure" script, or raise. If the "configure"
is found, a module level attribute is set.
@@ -564,10 +570,7 @@ def configure_args(self) -> List[str]:
return []
def autoreconf(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: AutotoolsPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Not needed usually, configure should be already there"""
@@ -596,10 +599,7 @@ def autoreconf(
self.pkg.module.autoreconf(*autoreconf_args)
def configure(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: AutotoolsPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run "configure", with the arguments specified by the builder and an
appropriately set prefix.
@@ -612,10 +612,7 @@ def configure(
pkg.module.configure(*options)
def build(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: AutotoolsPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run "make" on the build targets specified by the builder."""
# See https://autotools.io/automake/silent.html
@@ -625,10 +622,7 @@ def build(
pkg.module.make(*params)
def install(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: AutotoolsPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run "make" on the install targets specified by the builder."""
with fs.working_dir(self.build_directory):
@@ -825,7 +819,7 @@ def installcheck(self) -> None:
self.pkg._if_make_target_execute("installcheck")
@spack.phase_callbacks.run_after("install")
def remove_libtool_archives(self) -> None:
def _remove_libtool_archives(self) -> None:
"""Remove all .la files in prefix sub-folders if the package sets
``install_libtool_archives`` to be False.
"""

View File

@@ -10,6 +10,8 @@
import llnl.util.tty as tty
import spack.phase_callbacks
import spack.spec
import spack.util.prefix
from .cmake import CMakeBuilder, CMakePackage
@@ -293,12 +295,26 @@ def initconfig_hardware_entries(self):
entries.append(cmake_cache_string("AMDGPU_TARGETS", arch_str))
entries.append(cmake_cache_string("GPU_TARGETS", arch_str))
if spec.satisfies("%gcc"):
entries.append(
cmake_cache_string(
"CMAKE_HIP_FLAGS", f"--gcc-toolchain={self.pkg.compiler.prefix}"
)
)
return entries
def std_initconfig_entries(self):
cmake_prefix_path_env = os.environ["CMAKE_PREFIX_PATH"]
cmake_prefix_path = cmake_prefix_path_env.replace(os.pathsep, ";")
complete_rpath_list = ";".join(
[
self.pkg.spec.prefix.lib,
self.pkg.spec.prefix.lib64,
*os.environ.get("SPACK_COMPILER_EXTRA_RPATHS", "").split(":"),
*os.environ.get("SPACK_COMPILER_IMPLICIT_RPATHS", "").split(":"),
]
)
return [
"#------------------{0}".format("-" * 60),
"# !!!! This is a generated file, edit at own risk !!!!",
@@ -307,6 +323,8 @@ def std_initconfig_entries(self):
"#------------------{0}\n".format("-" * 60),
cmake_cache_string("CMAKE_PREFIX_PATH", cmake_prefix_path),
cmake_cache_string("CMAKE_INSTALL_RPATH_USE_LINK_PATH", "ON"),
cmake_cache_string("CMAKE_BUILD_RPATH", complete_rpath_list),
cmake_cache_string("CMAKE_INSTALL_RPATH", complete_rpath_list),
self.define_cmake_cache_from_variant("CMAKE_BUILD_TYPE", "build_type"),
]
@@ -314,7 +332,9 @@ def initconfig_package_entries(self):
"""This method is to be overwritten by the package"""
return []
def initconfig(self, pkg, spec, prefix):
def initconfig(
self, pkg: "CachedCMakePackage", spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
cache_entries = (
self.std_initconfig_entries()
+ self.initconfig_compiler_entries()

View File

@@ -7,6 +7,8 @@
import spack.builder
import spack.package_base
import spack.phase_callbacks
import spack.spec
import spack.util.prefix
from spack.directives import build_system, depends_on
from spack.multimethod import when
@@ -71,19 +73,26 @@ def build_directory(self):
@property
def build_args(self):
"""Arguments for ``cargo build``."""
return []
return ["-j", str(self.pkg.module.make_jobs)]
@property
def check_args(self):
"""Argument for ``cargo test`` during check phase"""
return []
def build(self, pkg, spec, prefix):
def setup_build_environment(self, env):
env.set("CARGO_HOME", self.stage.path)
def build(
self, pkg: CargoPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Runs ``cargo install`` in the source directory"""
with fs.working_dir(self.build_directory):
pkg.module.cargo("install", "--root", "out", "--path", ".", *self.build_args)
def install(self, pkg, spec, prefix):
def install(
self, pkg: CargoPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Copy build files into package prefix."""
with fs.working_dir(self.build_directory):
fs.install_tree("out", prefix)

View File

@@ -454,10 +454,7 @@ def cmake_args(self) -> List[str]:
return []
def cmake(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: CMakePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Runs ``cmake`` in the build directory"""
@@ -474,10 +471,7 @@ def cmake(
pkg.module.cmake(*options)
def build(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: CMakePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Make the build targets"""
with fs.working_dir(self.build_directory):
@@ -488,10 +482,7 @@ def build(
pkg.module.ninja(*self.build_targets)
def install(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: CMakePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Make the install targets"""
with fs.working_dir(self.build_directory):

View File

@@ -7,6 +7,8 @@
import spack.directives
import spack.package_base
import spack.phase_callbacks
import spack.spec
import spack.util.prefix
from ._checks import BuilderWithDefaults, apply_macos_rpath_fixups, execute_install_time_tests
@@ -48,3 +50,8 @@ class GenericBuilder(BuilderWithDefaults):
# unconditionally perform any post-install phase tests
spack.phase_callbacks.run_after("install")(execute_install_time_tests)
def install(
self, pkg: Package, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
raise NotImplementedError

View File

@@ -7,7 +7,9 @@
import spack.builder
import spack.package_base
import spack.phase_callbacks
from spack.directives import build_system, extends
import spack.spec
import spack.util.prefix
from spack.directives import build_system, depends_on
from spack.multimethod import when
from ._checks import BuilderWithDefaults, execute_install_time_tests
@@ -26,9 +28,7 @@ class GoPackage(spack.package_base.PackageBase):
build_system("go")
with when("build_system=go"):
# TODO: this seems like it should be depends_on, see
# setup_dependent_build_environment in go for why I kept it like this
extends("go@1.14:", type="build")
depends_on("go", type="build")
@spack.builder.builder("go")
@@ -71,6 +71,7 @@ class GoBuilder(BuilderWithDefaults):
def setup_build_environment(self, env):
env.set("GO111MODULE", "on")
env.set("GOTOOLCHAIN", "local")
env.set("GOPATH", fs.join_path(self.pkg.stage.path, "go"))
@property
def build_directory(self):
@@ -81,19 +82,31 @@ def build_directory(self):
def build_args(self):
"""Arguments for ``go build``."""
# Pass ldflags -s = --strip-all and -w = --no-warnings by default
return ["-modcacherw", "-ldflags", "-s -w", "-o", f"{self.pkg.name}"]
return [
"-p",
str(self.pkg.module.make_jobs),
"-modcacherw",
"-ldflags",
"-s -w",
"-o",
f"{self.pkg.name}",
]
@property
def check_args(self):
"""Argument for ``go test`` during check phase"""
return []
def build(self, pkg, spec, prefix):
def build(
self, pkg: GoPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Runs ``go build`` in the source directory"""
with fs.working_dir(self.build_directory):
pkg.module.go("build", *self.build_args)
def install(self, pkg, spec, prefix):
def install(
self, pkg: GoPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Install built binaries into prefix bin."""
with fs.working_dir(self.build_directory):
fs.mkdirp(prefix.bin)

View File

@@ -7,7 +7,9 @@
import spack.builder
import spack.package_base
import spack.spec
import spack.util.executable
import spack.util.prefix
from spack.directives import build_system, depends_on, extends
from spack.multimethod import when
@@ -55,7 +57,9 @@ class LuaBuilder(spack.builder.Builder):
#: Names associated with package attributes in the old build-system format
legacy_attributes = ()
def unpack(self, pkg, spec, prefix):
def unpack(
self, pkg: LuaPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
if os.path.splitext(pkg.stage.archive_file)[1] == ".rock":
directory = pkg.luarocks("unpack", pkg.stage.archive_file, output=str)
dirlines = directory.split("\n")
@@ -66,15 +70,16 @@ def unpack(self, pkg, spec, prefix):
def _generate_tree_line(name, prefix):
return """{{ name = "{name}", root = "{prefix}" }};""".format(name=name, prefix=prefix)
def generate_luarocks_config(self, pkg, spec, prefix):
def generate_luarocks_config(
self, pkg: LuaPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
spec = self.pkg.spec
table_entries = []
for d in spec.traverse(deptype=("build", "run")):
if d.package.extends(self.pkg.extendee_spec):
table_entries.append(self._generate_tree_line(d.name, d.prefix))
path = self._luarocks_config_path()
with open(path, "w", encoding="utf-8") as config:
with open(self._luarocks_config_path(), "w", encoding="utf-8") as config:
config.write(
"""
deps_mode="all"
@@ -85,23 +90,26 @@ def generate_luarocks_config(self, pkg, spec, prefix):
"\n".join(table_entries)
)
)
return path
def preprocess(self, pkg, spec, prefix):
def preprocess(
self, pkg: LuaPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Override this to preprocess source before building with luarocks"""
pass
def luarocks_args(self):
return []
def install(self, pkg, spec, prefix):
def install(
self, pkg: LuaPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
rock = "."
specs = find(".", "*.rockspec", recursive=False)
if specs:
rock = specs[0]
rocks_args = self.luarocks_args()
rocks_args.append(rock)
self.pkg.luarocks("--tree=" + prefix, "make", *rocks_args)
pkg.luarocks("--tree=" + prefix, "make", *rocks_args)
def _luarocks_config_path(self):
return os.path.join(self.pkg.stage.source_path, "spack_luarocks.lua")

View File

@@ -98,29 +98,20 @@ def build_directory(self) -> str:
return self.pkg.stage.source_path
def edit(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: MakefilePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Edit the Makefile before calling make. The default is a no-op."""
pass
def build(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: MakefilePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run "make" on the build targets specified by the builder."""
with fs.working_dir(self.build_directory):
pkg.module.make(*self.build_targets)
def install(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: MakefilePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run "make" on the install targets specified by the builder."""
with fs.working_dir(self.build_directory):

View File

@@ -5,6 +5,8 @@
import spack.builder
import spack.package_base
import spack.spec
import spack.util.prefix
from spack.directives import build_system, depends_on
from spack.multimethod import when
from spack.util.executable import which
@@ -58,16 +60,20 @@ def build_args(self):
"""List of args to pass to build phase."""
return []
def build(self, pkg, spec, prefix):
def build(
self, pkg: MavenPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Compile code and package into a JAR file."""
with fs.working_dir(self.build_directory):
mvn = which("mvn")
mvn = which("mvn", required=True)
if self.pkg.run_tests:
mvn("verify", *self.build_args())
else:
mvn("package", "-DskipTests", *self.build_args())
def install(self, pkg, spec, prefix):
def install(
self, pkg: MavenPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Copy to installation prefix."""
with fs.working_dir(self.build_directory):
fs.install_tree(".", prefix)

View File

@@ -188,10 +188,7 @@ def meson_args(self) -> List[str]:
return []
def meson(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: MesonPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run ``meson`` in the build directory"""
options = []
@@ -204,10 +201,7 @@ def meson(
pkg.module.meson(*options)
def build(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: MesonPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Make the build targets"""
options = ["-v"]
@@ -216,10 +210,7 @@ def build(
pkg.module.ninja(*options)
def install(
self,
pkg: spack.package_base.PackageBase,
spec: spack.spec.Spec,
prefix: spack.util.prefix.Prefix,
self, pkg: MesonPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Make the install targets"""
with fs.working_dir(self.build_directory):

View File

@@ -7,6 +7,8 @@
import spack.builder
import spack.package_base
import spack.spec
import spack.util.prefix
from spack.directives import build_system, conflicts
from ._checks import BuilderWithDefaults
@@ -99,7 +101,9 @@ def msbuild_install_args(self):
as `msbuild_args` by default."""
return self.msbuild_args()
def build(self, pkg, spec, prefix):
def build(
self, pkg: MSBuildPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run "msbuild" on the build targets specified by the builder."""
with fs.working_dir(self.build_directory):
pkg.module.msbuild(
@@ -108,7 +112,9 @@ def build(self, pkg, spec, prefix):
self.define_targets(*self.build_targets),
)
def install(self, pkg, spec, prefix):
def install(
self, pkg: MSBuildPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run "msbuild" on the install targets specified by the builder.
This is INSTALL by default"""
with fs.working_dir(self.build_directory):

View File

@@ -7,6 +7,8 @@
import spack.builder
import spack.package_base
import spack.spec
import spack.util.prefix
from spack.directives import build_system, conflicts
from ._checks import BuilderWithDefaults
@@ -123,7 +125,9 @@ def nmake_install_args(self):
Individual packages should override to specify NMake args to command line"""
return []
def build(self, pkg, spec, prefix):
def build(
self, pkg: NMakePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run "nmake" on the build targets specified by the builder."""
opts = self.std_nmake_args
opts += self.nmake_args()
@@ -132,7 +136,9 @@ def build(self, pkg, spec, prefix):
with fs.working_dir(self.build_directory):
pkg.module.nmake(*opts, *self.build_targets, ignore_quotes=self.ignore_quotes)
def install(self, pkg, spec, prefix):
def install(
self, pkg: NMakePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run "nmake" on the install targets specified by the builder.
This is INSTALL by default"""
opts = self.std_nmake_args

View File

@@ -3,6 +3,8 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import spack.builder
import spack.package_base
import spack.spec
import spack.util.prefix
from spack.directives import build_system, extends
from spack.multimethod import when
@@ -42,7 +44,9 @@ class OctaveBuilder(BuilderWithDefaults):
#: Names associated with package attributes in the old build-system format
legacy_attributes = ()
def install(self, pkg, spec, prefix):
def install(
self, pkg: OctavePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Install the package from the archive file"""
pkg.module.octave(
"--quiet",

View File

@@ -10,8 +10,11 @@
import spack.builder
import spack.package_base
import spack.phase_callbacks
from spack.directives import build_system, extends
import spack.spec
import spack.util.prefix
from spack.directives import build_system, depends_on, extends
from spack.install_test import SkipTest, test_part
from spack.multimethod import when
from spack.util.executable import Executable
from ._checks import BuilderWithDefaults, execute_build_time_tests
@@ -28,7 +31,9 @@ class PerlPackage(spack.package_base.PackageBase):
build_system("perl")
extends("perl", when="build_system=perl")
with when("build_system=perl"):
extends("perl")
depends_on("gmake", type="build")
@property
@memoized
@@ -146,7 +151,9 @@ def configure_args(self):
"""
return []
def configure(self, pkg, spec, prefix):
def configure(
self, pkg: PerlPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run Makefile.PL or Build.PL with arguments consisting of
an appropriate installation base directory followed by the
list returned by :py:meth:`~.PerlBuilder.configure_args`.
@@ -170,7 +177,9 @@ def fix_shebang(self):
repl = "#!/usr/bin/env perl"
filter_file(pattern, repl, "Build", backup=False)
def build(self, pkg, spec, prefix):
def build(
self, pkg: PerlPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Builds a Perl package."""
self.build_executable()
@@ -181,6 +190,8 @@ def check(self):
"""Runs built-in tests of a Perl package."""
self.build_executable("test")
def install(self, pkg, spec, prefix):
def install(
self, pkg: PerlPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Installs a Perl package."""
self.build_executable("install")

View File

@@ -28,6 +28,7 @@
import spack.repo
import spack.spec
import spack.store
import spack.util.prefix
from spack.directives import build_system, depends_on, extends
from spack.error import NoHeadersError, NoLibrariesError
from spack.install_test import test_part
@@ -263,16 +264,17 @@ def update_external_dependencies(self, extendee_spec=None):
# Ensure architecture information is present
if not python.architecture:
host_platform = spack.platforms.host()
host_os = host_platform.operating_system("default_os")
host_target = host_platform.target("default_target")
host_os = host_platform.default_operating_system()
host_target = host_platform.default_target()
python.architecture = spack.spec.ArchSpec(
(str(host_platform), str(host_os), str(host_target))
)
else:
if not python.architecture.platform:
python.architecture.platform = spack.platforms.host()
platform = spack.platforms.by_name(python.architecture.platform)
if not python.architecture.os:
python.architecture.os = "default_os"
python.architecture.os = platform.default_operating_system()
if not python.architecture.target:
python.architecture.target = archspec.cpu.host().family.name

View File

@@ -6,6 +6,8 @@
import spack.builder
import spack.package_base
import spack.phase_callbacks
import spack.spec
import spack.util.prefix
from spack.directives import build_system, depends_on
from ._checks import BuilderWithDefaults, execute_build_time_tests
@@ -27,6 +29,7 @@ class QMakePackage(spack.package_base.PackageBase):
build_system("qmake")
depends_on("qmake", type="build", when="build_system=qmake")
depends_on("gmake", type="build")
@spack.builder.builder("qmake")
@@ -61,17 +64,23 @@ def qmake_args(self):
"""List of arguments passed to qmake."""
return []
def qmake(self, pkg, spec, prefix):
def qmake(
self, pkg: QMakePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Run ``qmake`` to configure the project and generate a Makefile."""
with working_dir(self.build_directory):
pkg.module.qmake(*self.qmake_args())
def build(self, pkg, spec, prefix):
def build(
self, pkg: QMakePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Make the build targets"""
with working_dir(self.build_directory):
pkg.module.make()
def install(self, pkg, spec, prefix):
def install(
self, pkg: QMakePackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Make the install targets"""
with working_dir(self.build_directory):
pkg.module.make("install")

View File

@@ -94,7 +94,7 @@ def list_url(cls):
if cls.cran:
return f"https://cloud.r-project.org/src/contrib/Archive/{cls.cran}/"
@property
def git(self):
if self.bioc:
return f"https://git.bioconductor.org/packages/{self.bioc}"
@lang.classproperty
def git(cls):
if cls.bioc:
return f"https://git.bioconductor.org/packages/{cls.bioc}"

View File

@@ -9,6 +9,8 @@
import llnl.util.tty as tty
import spack.builder
import spack.spec
import spack.util.prefix
from spack.build_environment import SPACK_NO_PARALLEL_MAKE
from spack.config import determine_number_of_jobs
from spack.directives import build_system, extends, maintainers
@@ -74,18 +76,22 @@ def build_directory(self):
ret = os.path.join(ret, self.subdirectory)
return ret
def install(self, pkg, spec, prefix):
def install(
self, pkg: RacketPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Install everything from build directory."""
raco = Executable("raco")
with fs.working_dir(self.build_directory):
parallel = self.pkg.parallel and (not env_flag(SPACK_NO_PARALLEL_MAKE))
parallel = pkg.parallel and (not env_flag(SPACK_NO_PARALLEL_MAKE))
name = pkg.racket_name
assert name is not None, "Racket package name is not set"
args = [
"pkg",
"install",
"-t",
"dir",
"-n",
self.pkg.racket_name,
name,
"--deps",
"fail",
"--ignore-implies",
@@ -101,8 +107,7 @@ def install(self, pkg, spec, prefix):
except ProcessError:
args.insert(-2, "--skip-installed")
raco(*args)
msg = (
"Racket package {0} was already installed, uninstalling via "
tty.warn(
f"Racket package {name} was already installed, uninstalling via "
"Spack may make someone unhappy!"
)
tty.warn(msg.format(self.pkg.racket_name))

View File

@@ -140,7 +140,7 @@ class ROCmPackage(PackageBase):
when="+rocm",
)
depends_on("llvm-amdgpu", when="+rocm")
depends_on("llvm-amdgpu", type="build", when="+rocm")
depends_on("hsa-rocr-dev", when="+rocm")
depends_on("hip +rocm", when="+rocm")

View File

@@ -5,6 +5,8 @@
import spack.builder
import spack.package_base
import spack.spec
import spack.util.prefix
from spack.directives import build_system, extends, maintainers
from ._checks import BuilderWithDefaults
@@ -42,7 +44,9 @@ class RubyBuilder(BuilderWithDefaults):
#: Names associated with package attributes in the old build-system format
legacy_attributes = ()
def build(self, pkg, spec, prefix):
def build(
self, pkg: RubyPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Build a Ruby gem."""
# ruby-rake provides both rake.gemspec and Rakefile, but only
@@ -58,7 +62,9 @@ def build(self, pkg, spec, prefix):
# Some Ruby packages only ship `*.gem` files, so nothing to build
pass
def install(self, pkg, spec, prefix):
def install(
self, pkg: RubyPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Install a Ruby gem.
The ruby package sets ``GEM_HOME`` to tell gem where to install to."""

View File

@@ -4,6 +4,8 @@
import spack.builder
import spack.package_base
import spack.phase_callbacks
import spack.spec
import spack.util.prefix
from spack.directives import build_system, depends_on
from ._checks import BuilderWithDefaults, execute_build_time_tests
@@ -59,7 +61,9 @@ def build_args(self, spec, prefix):
"""Arguments to pass to build."""
return []
def build(self, pkg, spec, prefix):
def build(
self, pkg: SConsPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Build the package."""
pkg.module.scons(*self.build_args(spec, prefix))
@@ -67,7 +71,9 @@ def install_args(self, spec, prefix):
"""Arguments to pass to install."""
return []
def install(self, pkg, spec, prefix):
def install(
self, pkg: SConsPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Install the package."""
pkg.module.scons("install", *self.install_args(spec, prefix))

View File

@@ -11,6 +11,8 @@
import spack.install_test
import spack.package_base
import spack.phase_callbacks
import spack.spec
import spack.util.prefix
from spack.directives import build_system, depends_on, extends
from spack.multimethod import when
from spack.util.executable import Executable
@@ -41,6 +43,7 @@ class SIPPackage(spack.package_base.PackageBase):
with when("build_system=sip"):
extends("python", type=("build", "link", "run"))
depends_on("py-sip", type="build")
depends_on("gmake", type="build")
@property
def import_modules(self):
@@ -130,7 +133,9 @@ class SIPBuilder(BuilderWithDefaults):
build_directory = "build"
def configure(self, pkg, spec, prefix):
def configure(
self, pkg: SIPPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Configure the package."""
# https://www.riverbankcomputing.com/static/Docs/sip/command_line_tools.html
@@ -148,7 +153,9 @@ def configure_args(self):
"""Arguments to pass to configure."""
return []
def build(self, pkg, spec, prefix):
def build(
self, pkg: SIPPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Build the package."""
args = self.build_args()
@@ -159,7 +166,9 @@ def build_args(self):
"""Arguments to pass to build."""
return []
def install(self, pkg, spec, prefix):
def install(
self, pkg: SIPPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Install the package."""
args = self.install_args()

View File

@@ -6,6 +6,8 @@
import spack.builder
import spack.package_base
import spack.phase_callbacks
import spack.spec
import spack.util.prefix
from spack.directives import build_system, depends_on
from ._checks import BuilderWithDefaults, execute_build_time_tests, execute_install_time_tests
@@ -97,7 +99,9 @@ def waf(self, *args, **kwargs):
with working_dir(self.build_directory):
self.python("waf", "-j{0}".format(jobs), *args, **kwargs)
def configure(self, pkg, spec, prefix):
def configure(
self, pkg: WafPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Configures the project."""
args = ["--prefix={0}".format(self.pkg.prefix)]
args += self.configure_args()
@@ -108,7 +112,9 @@ def configure_args(self):
"""Arguments to pass to configure."""
return []
def build(self, pkg, spec, prefix):
def build(
self, pkg: WafPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Executes the build."""
args = self.build_args()
@@ -118,7 +124,9 @@ def build_args(self):
"""Arguments to pass to build."""
return []
def install(self, pkg, spec, prefix):
def install(
self, pkg: WafPackage, spec: spack.spec.Spec, prefix: spack.util.prefix.Prefix
) -> None:
"""Installs the targets on the system."""
args = self.install_args()

View File

@@ -14,7 +14,6 @@
import zipfile
from collections import namedtuple
from typing import Callable, Dict, List, Set
from urllib.error import HTTPError, URLError
from urllib.request import HTTPHandler, Request, build_opener
import llnl.util.filesystem as fs
@@ -472,12 +471,9 @@ def generate_pipeline(env: ev.Environment, args) -> None:
# Use all unpruned specs to populate the build group for this set
cdash_config = cfg.get("cdash")
if options.cdash_handler and options.cdash_handler.auth_token:
try:
options.cdash_handler.populate_buildgroup(
[options.cdash_handler.build_name(s) for s in pipeline_specs]
)
except (SpackError, HTTPError, URLError, TimeoutError) as err:
tty.warn(f"Problem populating buildgroup: {err}")
options.cdash_handler.populate_buildgroup(
[options.cdash_handler.build_name(s) for s in pipeline_specs]
)
elif cdash_config:
# warn only if there was actually a CDash configuration.
tty.warn("Unable to populate buildgroup without CDash credentials")

View File

@@ -1,23 +1,21 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import codecs
import copy
import json
import os
import re
import ssl
import sys
import time
from collections import deque
from enum import Enum
from typing import Dict, Generator, List, Optional, Set, Tuple
from urllib.parse import quote, urlencode, urlparse
from urllib.request import HTTPHandler, HTTPSHandler, Request, build_opener
from urllib.request import Request
import llnl.util.filesystem as fs
import llnl.util.tty as tty
from llnl.util.lang import Singleton, memoized
from llnl.util.lang import memoized
import spack.binary_distribution as bindist
import spack.config as cfg
@@ -35,32 +33,11 @@
from spack.reporters.cdash import SPACK_CDASH_TIMEOUT
from spack.reporters.cdash import build_stamp as cdash_build_stamp
def _urlopen():
error_handler = web_util.SpackHTTPDefaultErrorHandler()
# One opener with HTTPS ssl enabled
with_ssl = build_opener(
HTTPHandler(), HTTPSHandler(context=web_util.ssl_create_default_context()), error_handler
)
# One opener with HTTPS ssl disabled
without_ssl = build_opener(
HTTPHandler(), HTTPSHandler(context=ssl._create_unverified_context()), error_handler
)
# And dynamically dispatch based on the config:verify_ssl.
def dispatch_open(fullurl, data=None, timeout=None, verify_ssl=True):
opener = with_ssl if verify_ssl else without_ssl
timeout = timeout or cfg.get("config:connect_timeout", 1)
return opener.open(fullurl, data, timeout)
return dispatch_open
IS_WINDOWS = sys.platform == "win32"
SPACK_RESERVED_TAGS = ["public", "protected", "notary"]
_dyn_mapping_urlopener = Singleton(_urlopen)
# this exists purely for testing purposes
_urlopen = web_util.urlopen
def copy_files_to_artifacts(src, artifacts_dir):
@@ -279,26 +256,25 @@ def copy_test_results(self, source, dest):
reports = fs.join_path(source, "*_Test*.xml")
copy_files_to_artifacts(reports, dest)
def create_buildgroup(self, opener, headers, url, group_name, group_type):
def create_buildgroup(self, headers, url, group_name, group_type):
data = {"newbuildgroup": group_name, "project": self.project, "type": group_type}
enc_data = json.dumps(data).encode("utf-8")
request = Request(url, data=enc_data, headers=headers)
response = opener.open(request, timeout=SPACK_CDASH_TIMEOUT)
response_code = response.getcode()
if response_code not in [200, 201]:
msg = f"Creating buildgroup failed (response code = {response_code})"
tty.warn(msg)
try:
response_text = _urlopen(request, timeout=SPACK_CDASH_TIMEOUT).read()
except OSError as e:
tty.warn(f"Failed to create CDash buildgroup: {e}")
return None
response_text = response.read()
response_json = json.loads(response_text)
build_group_id = response_json["id"]
return build_group_id
try:
response_json = json.loads(response_text)
return response_json["id"]
except (json.JSONDecodeError, KeyError) as e:
tty.warn(f"Failed to parse CDash response: {e}")
return None
def populate_buildgroup(self, job_names):
url = f"{self.url}/api/v1/buildgroup.php"
@@ -308,16 +284,11 @@ def populate_buildgroup(self, job_names):
"Content-Type": "application/json",
}
opener = build_opener(HTTPHandler)
parent_group_id = self.create_buildgroup(opener, headers, url, self.build_group, "Daily")
group_id = self.create_buildgroup(
opener, headers, url, f"Latest {self.build_group}", "Latest"
)
parent_group_id = self.create_buildgroup(headers, url, self.build_group, "Daily")
group_id = self.create_buildgroup(headers, url, f"Latest {self.build_group}", "Latest")
if not parent_group_id or not group_id:
msg = f"Failed to create or retrieve buildgroups for {self.build_group}"
tty.warn(msg)
tty.warn(f"Failed to create or retrieve buildgroups for {self.build_group}")
return
data = {
@@ -329,15 +300,12 @@ def populate_buildgroup(self, job_names):
enc_data = json.dumps(data).encode("utf-8")
request = Request(url, data=enc_data, headers=headers)
request.get_method = lambda: "PUT"
request = Request(url, data=enc_data, headers=headers, method="PUT")
response = opener.open(request, timeout=SPACK_CDASH_TIMEOUT)
response_code = response.getcode()
if response_code != 200:
msg = f"Error response code ({response_code}) in populate_buildgroup"
tty.warn(msg)
try:
_urlopen(request, timeout=SPACK_CDASH_TIMEOUT)
except OSError as e:
tty.warn(f"Failed to populate CDash buildgroup: {e}")
def report_skipped(self, spec: spack.spec.Spec, report_dir: str, reason: Optional[str]):
"""Explicitly report skipping testing of a spec (e.g., it's CI
@@ -735,9 +703,6 @@ def _apply_section(dest, src):
for value in header.values():
value = os.path.expandvars(value)
verify_ssl = mapping.get("verify_ssl", spack.config.get("config:verify_ssl", True))
timeout = mapping.get("timeout", spack.config.get("config:connect_timeout", 1))
required = mapping.get("require", [])
allowed = mapping.get("allow", [])
ignored = mapping.get("ignore", [])
@@ -771,19 +736,15 @@ def job_query(job):
endpoint_url._replace(query=query).geturl(), headers=header, method="GET"
)
try:
response = _dyn_mapping_urlopener(
request, verify_ssl=verify_ssl, timeout=timeout
)
response = _urlopen(request)
config = json.load(response)
except Exception as e:
# For now just ignore any errors from dynamic mapping and continue
# This is still experimental, and failures should not stop CI
# from running normally
tty.warn(f"Failed to fetch dynamic mapping for query:\n\t{query}")
tty.warn(f"{e}")
tty.warn(f"Failed to fetch dynamic mapping for query:\n\t{query}: {e}")
continue
config = json.load(codecs.getreader("utf-8")(response))
# Strip ignore keys
if ignored:
for key in ignored:

View File

@@ -171,7 +171,9 @@ def quote_kvp(string: str) -> str:
def parse_specs(
args: Union[str, List[str]], concretize: bool = False, tests: bool = False
args: Union[str, List[str]],
concretize: bool = False,
tests: spack.concretize.TestsType = False,
) -> List[spack.spec.Spec]:
"""Convenience function for parsing arguments from specs. Handles common
exceptions and dies if there are errors.
@@ -183,11 +185,13 @@ def parse_specs(
if not concretize:
return specs
to_concretize = [(s, None) for s in specs]
to_concretize: List[spack.concretize.SpecPairInput] = [(s, None) for s in specs]
return _concretize_spec_pairs(to_concretize, tests=tests)
def _concretize_spec_pairs(to_concretize, tests=False):
def _concretize_spec_pairs(
to_concretize: List[spack.concretize.SpecPairInput], tests: spack.concretize.TestsType = False
) -> List[spack.spec.Spec]:
"""Helper method that concretizes abstract specs from a list of abstract,concrete pairs.
Any spec with a concrete spec associated with it will concretize to that spec. Any spec
@@ -198,7 +202,7 @@ def _concretize_spec_pairs(to_concretize, tests=False):
# Special case for concretizing a single spec
if len(to_concretize) == 1:
abstract, concrete = to_concretize[0]
return [concrete or abstract.concretized()]
return [concrete or spack.concretize.concretize_one(abstract, tests=tests)]
# Special case if every spec is either concrete or has an abstract hash
if all(
@@ -250,9 +254,9 @@ def matching_spec_from_env(spec):
"""
env = ev.active_environment()
if env:
return env.matching_spec(spec) or spec.concretized()
return env.matching_spec(spec) or spack.concretize.concretize_one(spec)
else:
return spec.concretized()
return spack.concretize.concretize_one(spec)
def matching_specs_from_env(specs):
@@ -293,7 +297,7 @@ def disambiguate_spec(
def disambiguate_spec_from_hashes(
spec: spack.spec.Spec,
hashes: List[str],
hashes: Optional[List[str]],
local: bool = False,
installed: Union[bool, InstallRecordStatus] = True,
first: bool = False,

View File

@@ -3,6 +3,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import collections
import warnings
import archspec.cpu
@@ -51,10 +52,10 @@ def setup_parser(subparser):
"-t", "--target", action="store_true", default=False, help="print only the target"
)
parts2.add_argument(
"-f", "--frontend", action="store_true", default=False, help="print frontend"
"-f", "--frontend", action="store_true", default=False, help="print frontend (DEPRECATED)"
)
parts2.add_argument(
"-b", "--backend", action="store_true", default=False, help="print backend"
"-b", "--backend", action="store_true", default=False, help="print backend (DEPRECATED)"
)
@@ -98,15 +99,14 @@ def arch(parser, args):
display_targets(archspec.cpu.TARGETS)
return
os_args, target_args = "default_os", "default_target"
if args.frontend:
os_args, target_args = "frontend", "frontend"
warnings.warn("the argument --frontend is deprecated, and will be removed in Spack v1.0")
elif args.backend:
os_args, target_args = "backend", "backend"
warnings.warn("the argument --backend is deprecated, and will be removed in Spack v1.0")
host_platform = spack.platforms.host()
host_os = host_platform.operating_system(os_args)
host_target = host_platform.target(target_args)
host_os = host_platform.default_operating_system()
host_target = host_platform.default_target()
if args.family:
host_target = host_target.family
elif args.generic:

View File

@@ -1,7 +1,7 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
import os
import shutil
import sys
import tempfile
@@ -14,9 +14,9 @@
import spack.bootstrap
import spack.bootstrap.config
import spack.bootstrap.core
import spack.concretize
import spack.config
import spack.mirrors.utils
import spack.spec
import spack.stage
import spack.util.path
import spack.util.spack_yaml
@@ -397,7 +397,7 @@ def _mirror(args):
llnl.util.tty.msg(msg.format(spec_str, mirror_dir))
# Suppress tty from the call below for terser messages
llnl.util.tty.set_msg_enabled(False)
spec = spack.spec.Spec(spec_str).concretized()
spec = spack.concretize.concretize_one(spec_str)
for node in spec.traverse():
spack.mirrors.utils.create(mirror_dir, [node])
llnl.util.tty.set_msg_enabled(True)
@@ -436,6 +436,7 @@ def write_metadata(subdir, metadata):
shutil.copy(spack.util.path.canonicalize_path(GNUPG_JSON), abs_directory)
shutil.copy(spack.util.path.canonicalize_path(PATCHELF_JSON), abs_directory)
instructions += cmd.format("local-binaries", rel_directory)
instructions += " % spack buildcache update-index <final-path>/bootstrap_cache\n"
print(instructions)

View File

@@ -16,6 +16,7 @@
import spack.binary_distribution as bindist
import spack.cmd
import spack.concretize
import spack.config
import spack.deptypes as dt
import spack.environment as ev
@@ -554,8 +555,7 @@ def check_fn(args: argparse.Namespace):
tty.msg("No specs provided, exiting.")
return
for spec in specs:
spec.concretize()
specs = [spack.concretize.concretize_one(s) for s in specs]
# Next see if there are any configured binary mirrors
configured_mirrors = spack.config.get("mirrors", scope=args.scope)
@@ -623,7 +623,7 @@ def save_specfile_fn(args):
root = specs[0]
if not root.concrete:
root.concretize()
root = spack.concretize.concretize_one(root)
save_dependency_specfiles(
root, args.specfile_dir, dependencies=spack.cmd.parse_specs(args.specs)

View File

@@ -4,7 +4,7 @@
import argparse
import os.path
import os
import textwrap
from llnl.util.lang import stable_partition

View File

@@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import os.path
import llnl.util.tty

View File

@@ -86,8 +86,8 @@ def create_db_tarball(args):
def report(args):
host_platform = spack.platforms.host()
host_os = host_platform.operating_system("frontend")
host_target = host_platform.target("frontend")
host_os = host_platform.default_operating_system()
host_target = host_platform.default_target()
architecture = spack.spec.ArchSpec((str(host_platform), str(host_os), str(host_target)))
print("* **Spack:**", spack.get_version())
print("* **Python:**", platform.python_version())

View File

@@ -18,6 +18,7 @@
from llnl.util.symlink import symlink
import spack.cmd
import spack.concretize
import spack.environment as ev
import spack.installer
import spack.store
@@ -103,7 +104,7 @@ def deprecate(parser, args):
)
if args.install:
deprecator = specs[1].concretized()
deprecator = spack.concretize.concretize_one(specs[1])
else:
deprecator = spack.cmd.disambiguate_spec(specs[1], env, local=True)

View File

@@ -10,6 +10,7 @@
import spack.build_environment
import spack.cmd
import spack.cmd.common.arguments
import spack.concretize
import spack.config
import spack.repo
from spack.cmd.common import arguments
@@ -113,8 +114,8 @@ def dev_build(self, args):
source_path = os.path.abspath(source_path)
# Forces the build to run out of the source directory.
spec.constrain("dev_path=%s" % source_path)
spec.concretize()
spec.constrain(f'dev_path="{source_path}"')
spec = spack.concretize.concretize_one(spec)
if spec.installed:
tty.error("Already installed in %s" % spec.prefix)

View File

@@ -54,10 +54,6 @@
@m{target=target} specific <target> processor
@m{arch=platform-os-target} shortcut for all three above
cross-compiling:
@m{os=backend} or @m{os=be} build for compute node (backend)
@m{os=frontend} or @m{os=fe} build for login node (frontend)
dependencies:
^dependency [constraints] specify constraints on dependencies
^@K{/hash} build with a specific installed

View File

@@ -13,6 +13,7 @@
from llnl.util import lang, tty
import spack.cmd
import spack.concretize
import spack.config
import spack.environment as ev
import spack.paths
@@ -450,7 +451,7 @@ def concrete_specs_from_file(args):
else:
s = spack.spec.Spec.from_json(f)
concretized = s.concretized()
concretized = spack.concretize.concretize_one(s)
if concretized.dag_hash() != s.dag_hash():
msg = 'skipped invalid file "{0}". '
msg += "The file does not contain a concrete spec."

View File

@@ -7,9 +7,9 @@
from llnl.path import convert_to_posix_path
import spack.concretize
import spack.paths
import spack.util.executable
from spack.spec import Spec
description = "generate Windows installer"
section = "admin"
@@ -65,8 +65,7 @@ def make_installer(parser, args):
"""
if sys.platform == "win32":
output_dir = args.output_dir
cmake_spec = Spec("cmake")
cmake_spec.concretize()
cmake_spec = spack.concretize.concretize_one("cmake")
cmake_path = os.path.join(cmake_spec.prefix, "bin", "cmake.exe")
cpack_path = os.path.join(cmake_spec.prefix, "bin", "cpack.exe")
spack_source = args.spack_source

View File

@@ -492,7 +492,7 @@ def extend_with_additional_versions(specs, num_versions):
mirror_specs = spack.mirrors.utils.get_all_versions(specs)
else:
mirror_specs = spack.mirrors.utils.get_matching_versions(specs, num_versions=num_versions)
mirror_specs = [x.concretized() for x in mirror_specs]
mirror_specs = [spack.concretize.concretize_one(x) for x in mirror_specs]
return mirror_specs

View File

@@ -5,7 +5,7 @@
"""Implementation details of the ``spack module`` command."""
import collections
import os.path
import os
import shutil
import sys

View File

@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
import os
import shutil
import llnl.util.tty as tty

View File

@@ -144,7 +144,7 @@ def is_installed(spec):
record = spack.store.STORE.db.query_local_by_spec_hash(spec.dag_hash())
return record and record.installed
specs = traverse.traverse_nodes(
all_specs = traverse.traverse_nodes(
specs,
root=False,
order="breadth",
@@ -155,7 +155,7 @@ def is_installed(spec):
)
with spack.store.STORE.db.read_transaction():
return [spec for spec in specs if is_installed(spec)]
return [spec for spec in all_specs if is_installed(spec)]
def dependent_environments(

View File

@@ -5,7 +5,7 @@
import argparse
import collections
import io
import os.path
import os
import re
import sys

View File

@@ -749,12 +749,18 @@ def __init__(self, compiler, feature, flag_name, ver_string=None):
class CompilerCacheEntry:
"""Deserialized cache entry for a compiler"""
__slots__ = ["c_compiler_output", "real_version"]
__slots__ = ("c_compiler_output", "real_version")
def __init__(self, c_compiler_output: Optional[str], real_version: str):
self.c_compiler_output = c_compiler_output
self.real_version = real_version
@property
def empty(self) -> bool:
"""Sometimes the compiler is temporarily broken, preventing us from getting output. The
call site determines if that is a problem."""
return self.c_compiler_output is None
@classmethod
def from_dict(cls, data: Dict[str, Optional[str]]):
if not isinstance(data, dict):
@@ -792,9 +798,10 @@ def __init__(self, cache: "FileCache") -> None:
self.cache.init_entry(self.name)
self._data: Dict[str, Dict[str, Optional[str]]] = {}
def _get_entry(self, key: str) -> Optional[CompilerCacheEntry]:
def _get_entry(self, key: str, *, allow_empty: bool) -> Optional[CompilerCacheEntry]:
try:
return CompilerCacheEntry.from_dict(self._data[key])
entry = CompilerCacheEntry.from_dict(self._data[key])
return entry if allow_empty or not entry.empty else None
except ValueError:
del self._data[key]
except KeyError:
@@ -812,7 +819,7 @@ def get(self, compiler: Compiler) -> CompilerCacheEntry:
self._data = {}
key = self._key(compiler)
value = self._get_entry(key)
value = self._get_entry(key, allow_empty=False)
if value is not None:
return value
@@ -826,7 +833,7 @@ def get(self, compiler: Compiler) -> CompilerCacheEntry:
self._data = {}
# Use cache entry that may have been created by another process in the meantime.
entry = self._get_entry(key)
entry = self._get_entry(key, allow_empty=True)
# Finally compute the cache entry
if entry is None:

View File

@@ -801,17 +801,17 @@ def _extract_compiler_paths(spec: "spack.spec.Spec") -> Optional[Dict[str, str]]
def _extract_os_and_target(spec: "spack.spec.Spec"):
if not spec.architecture:
host_platform = spack.platforms.host()
operating_system = host_platform.operating_system("default_os")
target = host_platform.target("default_target")
operating_system = host_platform.default_operating_system()
target = host_platform.default_target()
else:
target = spec.architecture.target
if not target:
target = spack.platforms.host().target("default_target")
target = spack.platforms.host().default_target()
operating_system = spec.os
if not operating_system:
host_platform = spack.platforms.host()
operating_system = host_platform.operating_system("default_os")
operating_system = host_platform.default_operating_system()
return operating_system, target

View File

@@ -5,7 +5,7 @@
import sys
import time
from contextlib import contextmanager
from typing import Iterable, Optional, Sequence, Tuple, Union
from typing import Iterable, List, Optional, Sequence, Tuple, Union
import llnl.util.tty as tty
@@ -35,14 +35,14 @@ def enable_compiler_existence_check():
CHECK_COMPILER_EXISTENCE = saved
SpecPairInput = Tuple[Spec, Optional[Spec]]
SpecPair = Tuple[Spec, Spec]
SpecLike = Union[Spec, str]
TestsType = Union[bool, Iterable[str]]
def concretize_specs_together(
abstract_specs: Sequence[SpecLike], tests: TestsType = False
) -> Sequence[Spec]:
def _concretize_specs_together(
abstract_specs: Sequence[Spec], tests: TestsType = False
) -> List[Spec]:
"""Given a number of specs as input, tries to concretize them together.
Args:
@@ -50,17 +50,16 @@ def concretize_specs_together(
tests: list of package names for which to consider tests dependencies. If True, all nodes
will have test dependencies. If False, test dependencies will be disregarded.
"""
import spack.solver.asp
from spack.solver.asp import Solver
allow_deprecated = spack.config.get("config:deprecated", False)
solver = spack.solver.asp.Solver()
result = solver.solve(abstract_specs, tests=tests, allow_deprecated=allow_deprecated)
result = Solver().solve(abstract_specs, tests=tests, allow_deprecated=allow_deprecated)
return [s.copy() for s in result.specs]
def concretize_together(
spec_list: Sequence[SpecPair], tests: TestsType = False
) -> Sequence[SpecPair]:
spec_list: Sequence[SpecPairInput], tests: TestsType = False
) -> List[SpecPair]:
"""Given a number of specs as input, tries to concretize them together.
Args:
@@ -71,13 +70,13 @@ def concretize_together(
"""
to_concretize = [concrete if concrete else abstract for abstract, concrete in spec_list]
abstract_specs = [abstract for abstract, _ in spec_list]
concrete_specs = concretize_specs_together(to_concretize, tests=tests)
concrete_specs = _concretize_specs_together(to_concretize, tests=tests)
return list(zip(abstract_specs, concrete_specs))
def concretize_together_when_possible(
spec_list: Sequence[SpecPair], tests: TestsType = False
) -> Sequence[SpecPair]:
spec_list: Sequence[SpecPairInput], tests: TestsType = False
) -> List[SpecPair]:
"""Given a number of specs as input, tries to concretize them together to the extent possible.
See documentation for ``unify: when_possible`` concretization for the precise definition of
@@ -89,7 +88,7 @@ def concretize_together_when_possible(
tests: list of package names for which to consider tests dependencies. If True, all nodes
will have test dependencies. If False, test dependencies will be disregarded.
"""
import spack.solver.asp
from spack.solver.asp import Solver
to_concretize = [concrete if concrete else abstract for abstract, concrete in spec_list]
old_concrete_to_abstract = {
@@ -97,9 +96,8 @@ def concretize_together_when_possible(
}
result_by_user_spec = {}
solver = spack.solver.asp.Solver()
allow_deprecated = spack.config.get("config:deprecated", False)
for result in solver.solve_in_rounds(
for result in Solver().solve_in_rounds(
to_concretize, tests=tests, allow_deprecated=allow_deprecated
):
result_by_user_spec.update(result.specs_by_input)
@@ -113,8 +111,8 @@ def concretize_together_when_possible(
def concretize_separately(
spec_list: Sequence[SpecPair], tests: TestsType = False
) -> Sequence[SpecPair]:
spec_list: Sequence[SpecPairInput], tests: TestsType = False
) -> List[SpecPair]:
"""Concretizes the input specs separately from each other.
Args:
@@ -123,7 +121,7 @@ def concretize_separately(
tests: list of package names for which to consider tests dependencies. If True, all nodes
will have test dependencies. If False, test dependencies will be disregarded.
"""
import spack.bootstrap
from spack.bootstrap import ensure_bootstrap_configuration, ensure_clingo_importable_or_raise
to_concretize = [abstract for abstract, concrete in spec_list if not concrete]
args = [
@@ -133,8 +131,8 @@ def concretize_separately(
]
ret = [(i, abstract) for i, abstract in enumerate(to_concretize) if abstract.concrete]
# Ensure we don't try to bootstrap clingo in parallel
with spack.bootstrap.ensure_bootstrap_configuration():
spack.bootstrap.ensure_clingo_importable_or_raise()
with ensure_bootstrap_configuration():
ensure_clingo_importable_or_raise()
# Ensure all the indexes have been built or updated, since
# otherwise the processes in the pool may timeout on waiting
@@ -189,10 +187,52 @@ def _concretize_task(packed_arguments: Tuple[int, str, TestsType]) -> Tuple[int,
index, spec_str, tests = packed_arguments
with tty.SuppressOutput(msg_enabled=False):
start = time.time()
spec = Spec(spec_str).concretized(tests=tests)
spec = concretize_one(Spec(spec_str), tests=tests)
return index, spec, time.time() - start
def concretize_one(spec: Union[str, Spec], tests: TestsType = False) -> Spec:
"""Return a concretized copy of the given spec.
Args:
tests: if False disregard 'test' dependencies, if a list of names activate them for
the packages in the list, if True activate 'test' dependencies for all packages.
"""
from spack.solver.asp import Solver, SpecBuilder
if isinstance(spec, str):
spec = Spec(spec)
spec = spec.lookup_hash()
if spec.concrete:
return spec.copy()
for node in spec.traverse():
if not node.name:
raise spack.error.SpecError(
f"Spec {node} has no name; cannot concretize an anonymous spec"
)
allow_deprecated = spack.config.get("config:deprecated", False)
result = Solver().solve([spec], tests=tests, allow_deprecated=allow_deprecated)
# take the best answer
opt, i, answer = min(result.answers)
name = spec.name
# TODO: Consolidate this code with similar code in solve.py
if spec.virtual:
providers = [s.name for s in answer.values() if s.package.provides(name)]
name = providers[0]
node = SpecBuilder.make_node(pkg=name)
assert (
node in answer
), f"cannot find {name} in the list of specs {','.join([n.pkg for n in answer.keys()])}"
concretized = answer[node]
return concretized
class UnavailableCompilerVersionError(spack.error.SpackError):
"""Raised when there is no available compiler that satisfies a
compiler spec."""

View File

@@ -36,6 +36,8 @@
import sys
from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Union
import jsonschema
from llnl.util import filesystem, lang, tty
import spack.error
@@ -51,6 +53,7 @@
import spack.schema.definitions
import spack.schema.develop
import spack.schema.env
import spack.schema.env_vars
import spack.schema.mirrors
import spack.schema.modules
import spack.schema.packages
@@ -68,6 +71,7 @@
"compilers": spack.schema.compilers.schema,
"concretizer": spack.schema.concretizer.schema,
"definitions": spack.schema.definitions.schema,
"env_vars": spack.schema.env_vars.schema,
"view": spack.schema.view.schema,
"develop": spack.schema.develop.schema,
"mirrors": spack.schema.mirrors.schema,
@@ -951,12 +955,6 @@ def set(path: str, value: Any, scope: Optional[str] = None) -> None:
return CONFIG.set(path, value, scope)
def add_default_platform_scope(platform: str) -> None:
plat_name = os.path.join("defaults", platform)
plat_path = os.path.join(CONFIGURATION_DEFAULTS_PATH[1], platform)
CONFIG.push_scope(DirectoryConfigScope(plat_name, plat_path))
def scopes() -> Dict[str, ConfigScope]:
"""Convenience function to get list of configuration scopes."""
return CONFIG.scopes
@@ -1054,8 +1052,6 @@ def validate(
This leverages the line information (start_mark, end_mark) stored
on Spack YAML structures.
"""
import jsonschema
try:
spack.schema.Validator(schema).validate(data)
except jsonschema.ValidationError as e:

View File

@@ -6,6 +6,8 @@
"""
import warnings
import jsonschema
import spack.environment as ev
import spack.schema.env as env
import spack.util.spack_yaml as syaml
@@ -30,8 +32,6 @@ def validate(configuration_file):
Returns:
A sanitized copy of the configuration stored in the input file
"""
import jsonschema
with open(configuration_file, encoding="utf-8") as f:
config = syaml.load(f)

View File

@@ -3,7 +3,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Manages the details on the images used in the various stages."""
import json
import os.path
import os
import shlex
import sys

View File

@@ -9,6 +9,8 @@
from collections import namedtuple
from typing import Optional
import jsonschema
import spack.environment as ev
import spack.error
import spack.schema.env
@@ -188,8 +190,6 @@ def paths(self):
@tengine.context_property
def manifest(self):
"""The spack.yaml file that should be used in the image"""
import jsonschema
# Copy in the part of spack.yaml prescribed in the configuration file
manifest = copy.deepcopy(self.config)
manifest.pop("container")

View File

@@ -123,6 +123,15 @@
"deprecated_for",
)
#: File where the database is written
INDEX_JSON_FILE = "index.json"
# Verifier file to check last modification of the DB
_INDEX_VERIFIER_FILE = "index_verifier"
# Lockfile for the database
_LOCK_FILE = "lock"
@llnl.util.lang.memoized
def _getfqdn():
@@ -260,7 +269,7 @@ class ForbiddenLockError(SpackError):
class ForbiddenLock:
def __getattr__(self, name):
raise ForbiddenLockError("Cannot access attribute '{0}' of lock".format(name))
raise ForbiddenLockError(f"Cannot access attribute '{name}' of lock")
def __reduce__(self):
return ForbiddenLock, tuple()
@@ -419,14 +428,25 @@ class FailureTracker:
the likelihood of collision very low with no cleanup required.
"""
#: root directory of the failure tracker
dir: pathlib.Path
#: File for locking particular concrete spec hashes
locker: SpecLocker
def __init__(self, root_dir: Union[str, pathlib.Path], default_timeout: Optional[float]):
#: Ensure a persistent location for dealing with parallel installation
#: failures (e.g., across near-concurrent processes).
self.dir = pathlib.Path(root_dir) / _DB_DIRNAME / "failures"
self.dir.mkdir(parents=True, exist_ok=True)
self.locker = SpecLocker(failures_lock_path(root_dir), default_timeout=default_timeout)
def _ensure_parent_directories(self) -> None:
"""Ensure that parent directories of the FailureTracker exist.
Accesses the filesystem only once, the first time it's called on a given FailureTracker.
"""
self.dir.mkdir(parents=True, exist_ok=True)
def clear(self, spec: "spack.spec.Spec", force: bool = False) -> None:
"""Removes any persistent and cached failure tracking for the spec.
@@ -469,13 +489,18 @@ def clear_all(self) -> None:
tty.debug("Removing prefix failure tracking files")
try:
for fail_mark in os.listdir(str(self.dir)):
try:
(self.dir / fail_mark).unlink()
except OSError as exc:
tty.warn(f"Unable to remove failure marking file {fail_mark}: {str(exc)}")
marks = os.listdir(str(self.dir))
except FileNotFoundError:
return # directory doesn't exist yet
except OSError as exc:
tty.warn(f"Unable to remove failure marking files: {str(exc)}")
return
for fail_mark in marks:
try:
(self.dir / fail_mark).unlink()
except OSError as exc:
tty.warn(f"Unable to remove failure marking file {fail_mark}: {str(exc)}")
def mark(self, spec: "spack.spec.Spec") -> lk.Lock:
"""Marks a spec as failing to install.
@@ -483,6 +508,8 @@ def mark(self, spec: "spack.spec.Spec") -> lk.Lock:
Args:
spec: spec that failed to install
"""
self._ensure_parent_directories()
# Dump the spec to the failure file for (manual) debugging purposes
path = self._path(spec)
path.write_text(spec.to_json())
@@ -567,17 +594,13 @@ def __init__(
Relevant only if the repository is not an upstream.
"""
self.root = root
self.database_directory = os.path.join(self.root, _DB_DIRNAME)
self.database_directory = pathlib.Path(self.root) / _DB_DIRNAME
self.layout = layout
# Set up layout of database files within the db dir
self._index_path = os.path.join(self.database_directory, "index.json")
self._verifier_path = os.path.join(self.database_directory, "index_verifier")
self._lock_path = os.path.join(self.database_directory, "lock")
# Create needed directories and files
if not is_upstream and not os.path.exists(self.database_directory):
fs.mkdirp(self.database_directory)
self._index_path = self.database_directory / INDEX_JSON_FILE
self._verifier_path = self.database_directory / _INDEX_VERIFIER_FILE
self._lock_path = self.database_directory / _LOCK_FILE
self.is_upstream = is_upstream
self.last_seen_verifier = ""
@@ -592,14 +615,14 @@ def __init__(
# initialize rest of state.
self.db_lock_timeout = lock_cfg.database_timeout
tty.debug("DATABASE LOCK TIMEOUT: {0}s".format(str(self.db_lock_timeout)))
tty.debug(f"DATABASE LOCK TIMEOUT: {str(self.db_lock_timeout)}s")
self.lock: Union[ForbiddenLock, lk.Lock]
if self.is_upstream:
self.lock = ForbiddenLock()
else:
self.lock = lk.Lock(
self._lock_path,
str(self._lock_path),
default_timeout=self.db_lock_timeout,
desc="database",
enable=lock_cfg.enable,
@@ -616,6 +639,11 @@ def __init__(
self._write_transaction_impl = lk.WriteTransaction
self._read_transaction_impl = lk.ReadTransaction
def _ensure_parent_directories(self):
"""Create the parent directory for the DB, if necessary."""
if not self.is_upstream:
self.database_directory.mkdir(parents=True, exist_ok=True)
def write_transaction(self):
"""Get a write lock context manager for use in a `with` block."""
return self._write_transaction_impl(self.lock, acquire=self._read, release=self._write)
@@ -630,6 +658,8 @@ def _write_to_file(self, stream):
This function does not do any locking or transactions.
"""
self._ensure_parent_directories()
# map from per-spec hash code to installation record.
installs = dict(
(k, v.to_dict(include_fields=self.record_fields)) for k, v in self._data.items()
@@ -759,7 +789,7 @@ def _read_from_file(self, filename):
Does not do any locking.
"""
try:
with open(filename, "r", encoding="utf-8") as f:
with open(str(filename), "r", encoding="utf-8") as f:
# In the future we may use a stream of JSON objects, hence `raw_decode` for compat.
fdata, _ = JSONDecoder().raw_decode(f.read())
except Exception as e:
@@ -860,11 +890,13 @@ def reindex(self):
if self.is_upstream:
raise UpstreamDatabaseLockingError("Cannot reindex an upstream database")
self._ensure_parent_directories()
# Special transaction to avoid recursive reindex calls and to
# ignore errors if we need to rebuild a corrupt database.
def _read_suppress_error():
try:
if os.path.isfile(self._index_path):
if self._index_path.is_file():
self._read_from_file(self._index_path)
except CorruptDatabaseError as e:
tty.warn(f"Reindexing corrupt database, error was: {e}")
@@ -1007,7 +1039,7 @@ def _check_ref_counts(self):
% (key, found, expected, self._index_path)
)
def _write(self, type, value, traceback):
def _write(self, type=None, value=None, traceback=None):
"""Write the in-memory database index to its file path.
This is a helper function called by the WriteTransaction context
@@ -1018,6 +1050,8 @@ def _write(self, type, value, traceback):
This routine does no locking.
"""
self._ensure_parent_directories()
# Do not write if exceptions were raised
if type is not None:
# A failure interrupted a transaction, so we should record that
@@ -1026,16 +1060,16 @@ def _write(self, type, value, traceback):
self._state_is_inconsistent = True
return
temp_file = self._index_path + (".%s.%s.temp" % (_getfqdn(), os.getpid()))
temp_file = str(self._index_path) + (".%s.%s.temp" % (_getfqdn(), os.getpid()))
# Write a temporary database file them move it into place
try:
with open(temp_file, "w", encoding="utf-8") as f:
self._write_to_file(f)
fs.rename(temp_file, self._index_path)
fs.rename(temp_file, str(self._index_path))
if _use_uuid:
with open(self._verifier_path, "w", encoding="utf-8") as f:
with self._verifier_path.open("w", encoding="utf-8") as f:
new_verifier = str(uuid.uuid4())
f.write(new_verifier)
self.last_seen_verifier = new_verifier
@@ -1048,11 +1082,11 @@ def _write(self, type, value, traceback):
def _read(self):
"""Re-read Database from the data in the set location. This does no locking."""
if os.path.isfile(self._index_path):
if self._index_path.is_file():
current_verifier = ""
if _use_uuid:
try:
with open(self._verifier_path, "r", encoding="utf-8") as f:
with self._verifier_path.open("r", encoding="utf-8") as f:
current_verifier = f.read()
except BaseException:
pass
@@ -1065,7 +1099,7 @@ def _read(self):
self._state_is_inconsistent = False
return
elif self.is_upstream:
tty.warn("upstream not found: {0}".format(self._index_path))
tty.warn(f"upstream not found: {self._index_path}")
def _add(
self,
@@ -1330,7 +1364,7 @@ def deprecate(self, spec: "spack.spec.Spec", deprecator: "spack.spec.Spec") -> N
def installed_relatives(
self,
spec: "spack.spec.Spec",
direction: str = "children",
direction: tr.DirectionType = "children",
transitive: bool = True,
deptype: Union[dt.DepFlag, dt.DepTypes] = dt.ALL,
) -> Set["spack.spec.Spec"]:
@@ -1681,7 +1715,7 @@ def query(
)
results = list(local_results) + list(x for x in upstream_results if x not in local_results)
results.sort()
results.sort() # type: ignore[call-overload]
return results
def query_one(

View File

@@ -15,7 +15,6 @@
import glob
import itertools
import os
import os.path
import pathlib
import re
import sys

View File

@@ -7,7 +7,6 @@
import collections
import concurrent.futures
import os
import os.path
import re
import sys
import traceback

View File

@@ -32,7 +32,7 @@ class OpenMpi(Package):
"""
import collections
import collections.abc
import os.path
import os
import re
from typing import Any, Callable, List, Optional, Tuple, Type, Union

View File

@@ -8,7 +8,7 @@
import shutil
import sys
from pathlib import Path
from typing import List, Optional, Tuple
from typing import Dict, List, Optional, Tuple
import llnl.util.filesystem as fs
from llnl.util.symlink import readlink
@@ -17,7 +17,6 @@
import spack.hash_types as ht
import spack.projections
import spack.spec
import spack.store
import spack.util.spack_json as sjson
from spack.error import SpackError
@@ -69,10 +68,9 @@ def specs_from_metadata_dirs(root: str) -> List["spack.spec.Spec"]:
class DirectoryLayout:
"""A directory layout is used to associate unique paths with specs.
Different installations are going to want different layouts for their
install, and they can use this to customize the nesting structure of
spack installs. The default layout is:
"""A directory layout is used to associate unique paths with specs. Different installations are
going to want different layouts for their install, and they can use this to customize the
nesting structure of spack installs. The default layout is:
* <install root>/
@@ -82,35 +80,30 @@ class DirectoryLayout:
* <name>-<version>-<hash>
The hash here is a SHA-1 hash for the full DAG plus the build
spec.
The installation directory projections can be modified with the projections argument."""
The installation directory projections can be modified with the
projections argument.
"""
def __init__(self, root, **kwargs):
def __init__(
self,
root,
*,
projections: Optional[Dict[str, str]] = None,
hash_length: Optional[int] = None,
) -> None:
self.root = root
self.check_upstream = True
projections = kwargs.get("projections") or default_projections
self.projections = dict(
(key, projection.lower()) for key, projection in projections.items()
)
projections = projections or default_projections
self.projections = {key: projection.lower() for key, projection in projections.items()}
# apply hash length as appropriate
self.hash_length = kwargs.get("hash_length", None)
self.hash_length = hash_length
if self.hash_length is not None:
for when_spec, projection in self.projections.items():
if "{hash}" not in projection:
if "{hash" in projection:
raise InvalidDirectoryLayoutParametersError(
"Conflicting options for installation layout hash" " length"
)
else:
raise InvalidDirectoryLayoutParametersError(
"Cannot specify hash length when the hash is not"
" part of all install_tree projections"
)
raise InvalidDirectoryLayoutParametersError(
"Conflicting options for installation layout hash length"
if "{hash" in projection
else "Cannot specify hash length when the hash is not part of all "
"install_tree projections"
)
self.projections[when_spec] = projection.replace(
"{hash}", "{hash:%d}" % self.hash_length
)
@@ -279,13 +272,6 @@ def path_for_spec(self, spec):
if spec.external:
return spec.external_path
if self.check_upstream:
upstream, record = spack.store.STORE.db.query_by_spec_hash(spec.dag_hash())
if upstream:
raise SpackError(
"Internal error: attempted to call path_for_spec on"
" upstream-installed package."
)
path = self.relative_path_for_spec(spec)
assert not path.startswith(self.root)

View File

@@ -10,6 +10,7 @@
import spack.environment as ev
import spack.repo
import spack.schema.environment
import spack.store
from spack.util.environment import EnvironmentModifications
@@ -156,6 +157,11 @@ def activate(
# MANPATH, PYTHONPATH, etc. All variables that end in PATH (case-sensitive)
# become PATH variables.
#
env_vars_yaml = env.manifest.configuration.get("env_vars", None)
if env_vars_yaml:
env_mods.extend(spack.schema.environment.parse(env_vars_yaml))
try:
if view and env.has_view(view):
with spack.store.STORE.db.read_transaction():
@@ -189,6 +195,10 @@ def deactivate() -> EnvironmentModifications:
if active is None:
return env_mods
env_vars_yaml = active.manifest.configuration.get("env_vars", None)
if env_vars_yaml:
env_mods.extend(spack.schema.environment.parse(env_vars_yaml).reversed())
active_view = os.getenv(ev.spack_env_view_var)
if active_view and active.has_view(active_view):

View File

@@ -15,6 +15,10 @@
SHOW_BACKTRACE = False
class SpackAPIWarning(UserWarning):
"""Warning that formats with file and line number."""
class SpackError(Exception):
"""This is the superclass for all Spack errors.
Subclasses can be found in the modules they have to do with.

View File

@@ -25,7 +25,6 @@
import functools
import http.client
import os
import os.path
import re
import shutil
import urllib.error
@@ -321,9 +320,15 @@ def _fetch_urllib(self, url):
request = urllib.request.Request(url, headers={"User-Agent": web_util.SPACK_USER_AGENT})
if os.path.lexists(save_file):
os.remove(save_file)
try:
response = web_util.urlopen(request)
except (TimeoutError, urllib.error.URLError) as e:
tty.msg(f"Fetching {url}")
with open(save_file, "wb") as f:
shutil.copyfileobj(response, f)
except OSError as e:
# clean up archive on failure.
if self.archive_file:
os.remove(self.archive_file)
@@ -331,14 +336,6 @@ def _fetch_urllib(self, url):
os.remove(save_file)
raise FailedDownloadError(e) from e
tty.msg(f"Fetching {url}")
if os.path.lexists(save_file):
os.remove(save_file)
with open(save_file, "wb") as f:
shutil.copyfileobj(response, f)
# Save the redirected URL for error messages. Sometimes we're redirected to an arbitrary
# mirror that is broken, leading to spurious download failures. In that case it's helpful
# for users to know which URL was actually fetched.
@@ -535,11 +532,16 @@ def __init__(self, *, url: str, checksum: Optional[str] = None, **kwargs):
@_needs_stage
def fetch(self):
file = self.stage.save_filename
tty.msg(f"Fetching {self.url}")
if os.path.lexists(file):
os.remove(file)
try:
response = self._urlopen(self.url)
except (TimeoutError, urllib.error.URLError) as e:
tty.msg(f"Fetching {self.url}")
with open(file, "wb") as f:
shutil.copyfileobj(response, f)
except OSError as e:
# clean up archive on failure.
if self.archive_file:
os.remove(self.archive_file)
@@ -547,12 +549,6 @@ def fetch(self):
os.remove(file)
raise FailedDownloadError(e) from e
if os.path.lexists(file):
os.remove(file)
with open(file, "wb") as f:
shutil.copyfileobj(response, f)
class VCSFetchStrategy(FetchStrategy):
"""Superclass for version control system fetch strategies.

View File

@@ -35,7 +35,6 @@
import spack.config
import spack.directory_layout
import spack.paths
import spack.projections
import spack.relocate
import spack.schema.projections
@@ -44,7 +43,6 @@
import spack.util.spack_json as s_json
import spack.util.spack_yaml as s_yaml
from spack.error import SpackError
from spack.hooks import sbang
__all__ = ["FilesystemView", "YamlFilesystemView"]
@@ -91,16 +89,10 @@ def view_copy(
if stat.S_ISLNK(src_stat.st_mode):
spack.relocate.relocate_links(links=[dst], prefix_to_prefix=prefix_to_projection)
elif spack.relocate.is_binary(dst):
spack.relocate.relocate_text_bin(binaries=[dst], prefixes=prefix_to_projection)
spack.relocate.relocate_text_bin(binaries=[dst], prefix_to_prefix=prefix_to_projection)
else:
prefix_to_projection[spack.store.STORE.layout.root] = view._root
# This is vestigial code for the *old* location of sbang.
prefix_to_projection[f"#!/bin/bash {spack.paths.spack_root}/bin/sbang"] = (
sbang.sbang_shebang_line()
)
spack.relocate.relocate_text(files=[dst], prefixes=prefix_to_projection)
spack.relocate.relocate_text(files=[dst], prefix_to_prefix=prefix_to_projection)
# The os module on Windows does not have a chown function.
if sys.platform != "win32":

View File

@@ -275,7 +275,7 @@ def _do_fake_install(pkg: "spack.package_base.PackageBase") -> None:
fs.mkdirp(pkg.prefix.bin)
fs.touch(os.path.join(pkg.prefix.bin, command))
if sys.platform != "win32":
chmod = which("chmod")
chmod = which("chmod", required=True)
chmod("+x", os.path.join(pkg.prefix.bin, command))
# Install fake header file
@@ -539,7 +539,7 @@ def dump_packages(spec: "spack.spec.Spec", path: str) -> None:
# Note that we copy them in as they are in the *install* directory
# NOT as they are in the repository, because we want a snapshot of
# how *this* particular build was done.
for node in spec.traverse(deptype=all):
for node in spec.traverse(deptype="all"):
if node is not spec:
# Locate the dependency package in the install tree and find
# its provenance information.

View File

@@ -14,7 +14,6 @@
import io
import operator
import os
import os.path
import pstats
import re
import shlex
@@ -503,16 +502,16 @@ def make_argument_parser(**kwargs):
return parser
def send_warning_to_tty(message, *args):
def showwarning(message, category, filename, lineno, file=None, line=None):
"""Redirects messages to tty.warn."""
tty.warn(message)
if category is spack.error.SpackAPIWarning:
tty.warn(f"{filename}:{lineno}: {message}")
else:
tty.warn(message)
def setup_main_options(args):
"""Configure spack globals based on the basic options."""
# Assign a custom function to show warnings
warnings.showwarning = send_warning_to_tty
# Set up environment based on args.
tty.set_verbose(args.verbose)
tty.set_debug(args.debug)
@@ -729,7 +728,7 @@ def _compatible_sys_types():
with the current host.
"""
host_platform = spack.platforms.host()
host_os = str(host_platform.operating_system("default_os"))
host_os = str(host_platform.default_operating_system())
host_target = archspec.cpu.host()
compatible_targets = [host_target] + host_target.ancestors
@@ -903,9 +902,10 @@ def _main(argv=None):
# main() is tricky to get right, so be careful where you put things.
#
# Things in this first part of `main()` should *not* require any
# configuration. This doesn't include much -- setting up th parser,
# configuration. This doesn't include much -- setting up the parser,
# restoring some key environment variables, very simple CLI options, etc.
# ------------------------------------------------------------------------
warnings.showwarning = showwarning
# Create a parser with a simple positional argument first. We'll
# lazily load the subcommand(s) we need later. This allows us to

View File

@@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import os.path
from typing import Optional
import llnl.url

View File

@@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import os.path
import traceback
import llnl.util.tty as tty

View File

@@ -31,7 +31,7 @@
import copy
import datetime
import inspect
import os.path
import os
import re
import string
from typing import List, Optional

View File

@@ -4,7 +4,7 @@
import collections
import itertools
import os.path
import os
from typing import Dict, List, Optional, Tuple
import llnl.util.filesystem as fs

View File

@@ -5,7 +5,7 @@
"""This module implements the classes necessary to generate Tcl
non-hierarchical modules.
"""
import os.path
import os
from typing import Dict, Optional, Tuple
import spack.config

View File

@@ -7,6 +7,7 @@
import base64
import json
import re
import socket
import time
import urllib.error
import urllib.parse
@@ -410,7 +411,7 @@ def wrapper(*args, **kwargs):
for i in range(retries):
try:
return f(*args, **kwargs)
except (urllib.error.URLError, TimeoutError) as e:
except OSError as e:
# Retry on internal server errors, and rate limit errors
# Potentially this could take into account the Retry-After header
# if registries support it
@@ -420,9 +421,10 @@ def wrapper(*args, **kwargs):
and (500 <= e.code < 600 or e.code == 429)
)
or (
isinstance(e, urllib.error.URLError) and isinstance(e.reason, TimeoutError)
isinstance(e, urllib.error.URLError)
and isinstance(e.reason, socket.timeout)
)
or isinstance(e, TimeoutError)
or isinstance(e, socket.timeout)
):
# Exponential backoff
sleep(2**i)

View File

@@ -3,8 +3,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.lang
import spack.util.spack_yaml as syaml
@llnl.util.lang.lazy_lexicographic_ordering
class OperatingSystem:
@@ -42,4 +40,4 @@ def _cmp_iter(self):
yield self.version
def to_dict(self):
return syaml.syaml_dict([("name", self.name), ("version", self.version)])
return {"name": self.name, "version": self.version}

View File

@@ -3,29 +3,52 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# flake8: noqa: F401
"""spack.util.package is a set of useful build tools and directives for packages.
"""spack.package defines the public API for Spack packages, by re-exporting useful symbols from
other modules. Packages should import this module, instead of importing from spack.* directly
to ensure forward compatibility with future versions of Spack."""
Everything in this module is automatically imported into Spack package files.
"""
from os import chdir, environ, getcwd, makedirs, mkdir, remove, removedirs
from shutil import move, rmtree
from spack.error import InstallError, NoHeadersError, NoLibrariesError
# Emulate some shell commands for convenience
env = environ
cd = chdir
pwd = getcwd
# import most common types used in packages
from typing import Dict, List, Optional
import llnl.util.filesystem
from llnl.util.filesystem import *
from llnl.util.filesystem import (
FileFilter,
FileList,
HeaderList,
LibraryList,
ancestor,
can_access,
change_sed_delimiter,
copy,
copy_tree,
filter_file,
find,
find_all_headers,
find_first,
find_headers,
find_libraries,
find_system_libraries,
force_remove,
force_symlink,
install,
install_tree,
is_exe,
join_path,
keep_modification_time,
library_extensions,
mkdirp,
remove_directory_contents,
remove_linked_tree,
rename,
set_executable,
set_install_permissions,
touch,
working_dir,
)
from llnl.util.symlink import symlink
import spack.util.executable
# These props will be overridden when the build env is set up.
from spack.build_environment import MakeExecutable
from spack.build_systems.aspell_dict import AspellDictPackage
@@ -76,7 +99,24 @@
from spack.builder import BaseBuilder
from spack.config import determine_number_of_jobs
from spack.deptypes import ALL_TYPES as all_deptypes
from spack.directives import *
from spack.directives import (
build_system,
can_splice,
conditional,
conflicts,
depends_on,
extends,
license,
maintainers,
patch,
provides,
redistribute,
requires,
resource,
variant,
version,
)
from spack.error import InstallError, NoHeadersError, NoLibrariesError
from spack.install_test import (
SkipTest,
cache_extra_test_sources,
@@ -86,28 +126,36 @@
install_test_root,
test_part,
)
from spack.installer import ExternalPackageError, InstallLockError, UpstreamPackageError
from spack.mixins import filter_compiler_wrappers
from spack.multimethod import default_args, when
from spack.package_base import (
DependencyConflictError,
build_system_flags,
env_flags,
flatten_dependencies,
inject_flags,
install_dependency_symlinks,
on_package_attributes,
from spack.package_base import build_system_flags, env_flags, inject_flags, on_package_attributes
from spack.package_completions import (
bash_completion_path,
fish_completion_path,
zsh_completion_path,
)
from spack.package_completions import *
from spack.phase_callbacks import run_after, run_before
from spack.spec import InvalidSpecDetected, Spec
from spack.util.executable import *
from spack.spec import Spec
from spack.util.executable import Executable, ProcessError, which, which_string
from spack.util.filesystem import fix_darwin_install_name
from spack.variant import any_combination_of, auto_or_any_combination_of, disjoint_sets
from spack.version import Version, ver
# These are just here for editor support; they will be replaced when the build env
# is set up.
make = MakeExecutable("make", jobs=1)
ninja = MakeExecutable("ninja", jobs=1)
configure = Executable(join_path(".", "configure"))
# Emulate some shell commands for convenience
env = environ
cd = chdir
pwd = getcwd
# These are just here for editor support; they may be set when the build env is set up.
configure: Executable
make_jobs: int
make: MakeExecutable
ninja: MakeExecutable
python_include: str
python_platlib: str
python_purelib: str
python: Executable
spack_cc: str
spack_cxx: str
spack_f77: str
spack_fc: str

View File

@@ -30,7 +30,6 @@
import llnl.util.filesystem as fsys
import llnl.util.tty as tty
from llnl.util.lang import classproperty, memoized
from llnl.util.link_tree import LinkTree
import spack.compilers
import spack.config
@@ -767,6 +766,9 @@ def __init__(self, spec):
self.win_rpath = fsys.WindowsSimulatedRPath(self)
super().__init__()
def __getitem__(self, key: str) -> "PackageBase":
return self.spec[key].package
@classmethod
def dependency_names(cls):
return _subkeys(cls.dependencies)
@@ -1096,14 +1098,14 @@ def update_external_dependencies(self, extendee_spec=None):
"""
pass
def detect_dev_src_change(self):
def detect_dev_src_change(self) -> bool:
"""
Method for checking for source code changes to trigger rebuild/reinstall
"""
dev_path_var = self.spec.variants.get("dev_path", None)
_, record = spack.store.STORE.db.query_by_spec_hash(self.spec.dag_hash())
mtime = fsys.last_modification_time_recursive(dev_path_var.value)
return mtime > record.installation_time
assert dev_path_var and record, "dev_path variant and record must be present"
return fsys.recursive_mtime_greater_than(dev_path_var.value, record.installation_time)
def all_urls_for_version(self, version: StandardVersion) -> List[str]:
"""Return all URLs derived from version_urls(), url, urls, and
@@ -1816,12 +1818,6 @@ def _has_make_target(self, target):
Returns:
bool: True if 'target' is found, else False
"""
# Prevent altering LC_ALL for 'make' outside this function
make = copy.deepcopy(self.module.make)
# Use English locale for missing target message comparison
make.add_default_env("LC_ALL", "C")
# Check if we have a Makefile
for makefile in ["GNUmakefile", "Makefile", "makefile"]:
if os.path.exists(makefile):
@@ -1830,6 +1826,12 @@ def _has_make_target(self, target):
tty.debug("No Makefile found in the build directory")
return False
# Prevent altering LC_ALL for 'make' outside this function
make = copy.deepcopy(self.module.make)
# Use English locale for missing target message comparison
make.add_default_env("LC_ALL", "C")
# Check if 'target' is a valid target.
#
# `make -n target` performs a "dry run". It prints the commands that
@@ -2289,19 +2291,6 @@ def rpath_args(self):
build_system_flags = PackageBase.build_system_flags
def install_dependency_symlinks(pkg, spec, prefix):
"""
Execute a dummy install and flatten dependencies.
This routine can be used in a ``package.py`` definition by setting
``install = install_dependency_symlinks``.
This feature comes in handy for creating a common location for the
the installation of third-party libraries.
"""
flatten_dependencies(spec, prefix)
def use_cray_compiler_names():
"""Compiler names for builds that rely on cray compiler names."""
os.environ["CC"] = "cc"
@@ -2310,23 +2299,6 @@ def use_cray_compiler_names():
os.environ["F77"] = "ftn"
def flatten_dependencies(spec, flat_dir):
"""Make each dependency of spec present in dir via symlink."""
for dep in spec.traverse(root=False):
name = dep.name
dep_path = spack.store.STORE.layout.path_for_spec(dep)
dep_files = LinkTree(dep_path)
os.mkdir(flat_dir + "/" + name)
conflict = dep_files.find_conflict(flat_dir + "/" + name)
if conflict:
raise DependencyConflictError(conflict)
dep_files.merge(flat_dir + "/" + name)
def possible_dependencies(
*pkg_or_spec: Union[str, spack.spec.Spec, typing.Type[PackageBase]],
transitive: bool = True,

View File

@@ -4,10 +4,9 @@
import hashlib
import os
import os.path
import pathlib
import sys
from typing import Any, Dict, Optional, Tuple, Type, Union
from typing import Any, Dict, Optional, Set, Tuple, Type, Union
import llnl.util.filesystem
from llnl.url import allowed_archive
@@ -504,36 +503,38 @@ def patch_for_package(self, sha256: str, pkg: "spack.package_base.PackageBase")
patch_dict["sha256"] = sha256
return from_dict(patch_dict, repository=self.repository)
def update_package(self, pkg_fullname: str) -> None:
def update_packages(self, pkgs_fullname: Set[str]) -> None:
"""Update the patch cache.
Args:
pkg_fullname: package to update.
"""
# remove this package from any patch entries that reference it.
empty = []
for sha256, package_to_patch in self.index.items():
remove = []
for fullname, patch_dict in package_to_patch.items():
if patch_dict["owner"] == pkg_fullname:
remove.append(fullname)
if self.index:
empty = []
for sha256, package_to_patch in self.index.items():
remove = []
for fullname, patch_dict in package_to_patch.items():
if patch_dict["owner"] in pkgs_fullname:
remove.append(fullname)
for fullname in remove:
package_to_patch.pop(fullname)
for fullname in remove:
package_to_patch.pop(fullname)
if not package_to_patch:
empty.append(sha256)
if not package_to_patch:
empty.append(sha256)
# remove any entries that are now empty
for sha256 in empty:
del self.index[sha256]
# remove any entries that are now empty
for sha256 in empty:
del self.index[sha256]
# update the index with per-package patch indexes
pkg_cls = self.repository.get_pkg_class(pkg_fullname)
partial_index = self._index_patches(pkg_cls, self.repository)
for sha256, package_to_patch in partial_index.items():
p2p = self.index.setdefault(sha256, {})
p2p.update(package_to_patch)
for pkg_fullname in pkgs_fullname:
pkg_cls = self.repository.get_pkg_class(pkg_fullname)
partial_index = self._index_patches(pkg_cls, self.repository)
for sha256, package_to_patch in partial_index.items():
p2p = self.index.setdefault(sha256, {})
p2p.update(package_to_patch)
def update(self, other: "PatchCache") -> None:
"""Update this cache with the contents of another.

View File

@@ -52,8 +52,7 @@ def use_platform(new_platform):
import spack.config
msg = '"{0}" must be an instance of Platform'
assert isinstance(new_platform, Platform), msg.format(new_platform)
assert isinstance(new_platform, Platform), f'"{new_platform}" must be an instance of Platform'
original_host_fn = host

View File

@@ -1,42 +1,22 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import warnings
from typing import Optional
import archspec.cpu
import llnl.util.lang
import spack.error
class NoPlatformError(spack.error.SpackError):
def __init__(self):
msg = "Could not determine a platform for this machine"
super().__init__(msg)
@llnl.util.lang.lazy_lexicographic_ordering
class Platform:
"""Platform is an abstract class extended by subclasses.
To add a new type of platform (such as cray_xe), create a subclass and set all the
class attributes such as priority, front_target, back_target, front_os, back_os.
Platform also contain a priority class attribute. A lower number signifies higher
priority. These numbers are arbitrarily set and can be changed though often there
isn't much need unless a new platform is added and the user wants that to be
detected first.
Targets are created inside the platform subclasses. Most architecture (like linux,
and darwin) will have only one target family (x86_64) but in the case of Cray
machines, there is both a frontend and backend processor. The user can specify
which targets are present on front-end and back-end architecture.
Depending on the platform, operating systems are either autodetected or are
set. The user can set the frontend and backend operating setting by the class
attributes front_os and back_os. The operating system will be responsible for
compiler detection.
"""
# Subclass sets number. Controls detection order
@@ -45,82 +25,72 @@ class attributes such as priority, front_target, back_target, front_os, back_os.
#: binary formats used on this platform; used by relocation logic
binary_formats = ["elf"]
front_end: Optional[str] = None
back_end: Optional[str] = None
default: Optional[str] = None # The default back end target.
front_os: Optional[str] = None
back_os: Optional[str] = None
default_os: Optional[str] = None
default: str
default_os: str
reserved_targets = ["default_target", "frontend", "fe", "backend", "be"]
reserved_oss = ["default_os", "frontend", "fe", "backend", "be"]
deprecated_names = ["frontend", "fe", "backend", "be"]
def __init__(self, name):
self.targets = {}
self.operating_sys = {}
self.name = name
self._init_targets()
def add_target(self, name: str, target: archspec.cpu.Microarchitecture) -> None:
"""Used by the platform specific subclass to list available targets.
Raises an error if the platform specifies a name
that is reserved by spack as an alias.
"""
if name in Platform.reserved_targets:
msg = "{0} is a spack reserved alias and cannot be the name of a target"
raise ValueError(msg.format(name))
msg = f"{name} is a spack reserved alias and cannot be the name of a target"
raise ValueError(msg)
self.targets[name] = target
def _add_archspec_targets(self):
def _init_targets(self):
self.default = archspec.cpu.host().name
for name, microarchitecture in archspec.cpu.TARGETS.items():
self.add_target(name, microarchitecture)
def target(self, name):
"""This is a getter method for the target dictionary
that handles defaulting based on the values provided by default,
front-end, and back-end. This can be overwritten
by a subclass for which we want to provide further aliasing options.
"""
# TODO: Check if we can avoid using strings here
name = str(name)
if name == "default_target":
if name in Platform.deprecated_names:
warnings.warn(f"target={name} is deprecated, use target={self.default} instead")
if name in Platform.reserved_targets:
name = self.default
elif name == "frontend" or name == "fe":
name = self.front_end
elif name == "backend" or name == "be":
name = self.back_end
return self.targets.get(name, None)
def add_operating_system(self, name, os_class):
"""Add the operating_system class object into the
platform.operating_sys dictionary.
"""
if name in Platform.reserved_oss:
msg = "{0} is a spack reserved alias and cannot be the name of an OS"
raise ValueError(msg.format(name))
if name in Platform.reserved_oss + Platform.deprecated_names:
msg = f"{name} is a spack reserved alias and cannot be the name of an OS"
raise ValueError(msg)
self.operating_sys[name] = os_class
def default_target(self):
return self.target(self.default)
def default_operating_system(self):
return self.operating_system(self.default_os)
def operating_system(self, name):
if name == "default_os":
if name in Platform.deprecated_names:
warnings.warn(f"os={name} is deprecated, use os={self.default_os} instead")
if name in Platform.reserved_oss:
name = self.default_os
if name == "frontend" or name == "fe":
name = self.front_os
if name == "backend" or name == "be":
name = self.back_os
return self.operating_sys.get(name, None)
def setup_platform_environment(self, pkg, env):
"""Subclass can override this method if it requires any
platform-specific build environment modifications.
"""Platform-specific build environment modifications.
This method is meant toi be overridden by subclasses, when needed.
"""
pass
@classmethod
def detect(cls):
"""Return True if the the host platform is detected to be the current
Platform class, False otherwise.
"""Returns True if the host platform is detected to be the current Platform class,
False otherwise.
Derived classes are responsible for implementing this method.
"""
@@ -135,11 +105,7 @@ def __str__(self):
def _cmp_iter(self):
yield self.name
yield self.default
yield self.front_end
yield self.back_end
yield self.default_os
yield self.front_os
yield self.back_os
def targets():
for t in sorted(self.targets.values()):

View File

@@ -1,7 +1,7 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
import os
def slingshot_network():

View File

@@ -4,8 +4,6 @@
import platform as py_platform
import archspec.cpu
from spack.operating_systems.mac_os import MacOs
from spack.version import Version
@@ -19,18 +17,8 @@ class Darwin(Platform):
def __init__(self):
super().__init__("darwin")
self._add_archspec_targets()
self.default = archspec.cpu.host().name
self.front_end = self.default
self.back_end = self.default
mac_os = MacOs()
self.default_os = str(mac_os)
self.front_os = str(mac_os)
self.back_os = str(mac_os)
self.add_operating_system(str(mac_os), mac_os)
@classmethod

View File

@@ -3,8 +3,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import platform
import archspec.cpu
from spack.operating_systems.freebsd import FreeBSDOs
from ._platform import Platform
@@ -15,18 +13,8 @@ class FreeBSD(Platform):
def __init__(self):
super().__init__("freebsd")
self._add_archspec_targets()
# Get specific default
self.default = archspec.cpu.host().name
self.front_end = self.default
self.back_end = self.default
os = FreeBSDOs()
self.default_os = str(os)
self.front_os = self.default_os
self.back_os = self.default_os
self.add_operating_system(str(os), os)
@classmethod

View File

@@ -3,8 +3,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import platform
import archspec.cpu
from spack.operating_systems.linux_distro import LinuxDistro
from ._platform import Platform
@@ -15,18 +13,8 @@ class Linux(Platform):
def __init__(self):
super().__init__("linux")
self._add_archspec_targets()
# Get specific default
self.default = archspec.cpu.host().name
self.front_end = self.default
self.back_end = self.default
linux_dist = LinuxDistro()
self.default_os = str(linux_dist)
self.front_os = self.default_os
self.back_os = self.default_os
self.add_operating_system(str(linux_dist), linux_dist)
@classmethod

View File

@@ -16,31 +16,19 @@ class Test(Platform):
if platform.system().lower() == "darwin":
binary_formats = ["macho"]
if platform.machine() == "arm64":
front_end = "aarch64"
back_end = "m1"
default = "m1"
else:
front_end = "x86_64"
back_end = "core2"
default = "core2"
front_os = "redhat6"
back_os = "debian6"
default_os = "debian6"
default = "m1" if platform.machine() == "arm64" else "core2"
def __init__(self, name=None):
name = name or "test"
super().__init__(name)
self.add_target(self.default, archspec.cpu.TARGETS[self.default])
self.add_target(self.front_end, archspec.cpu.TARGETS[self.front_end])
self.add_operating_system("debian6", spack.operating_systems.OperatingSystem("debian", 6))
self.add_operating_system("redhat6", spack.operating_systems.OperatingSystem("redhat", 6))
self.add_operating_system(
self.default_os, spack.operating_systems.OperatingSystem("debian", 6)
)
self.add_operating_system(
self.front_os, spack.operating_systems.OperatingSystem("redhat", 6)
)
def _init_targets(self):
targets = ("aarch64", "m1") if platform.machine() == "arm64" else ("x86_64", "core2")
for t in targets:
self.add_target(t, archspec.cpu.TARGETS[t])
@classmethod
def detect(cls):

View File

@@ -4,8 +4,6 @@
import platform
import archspec.cpu
from spack.operating_systems.windows_os import WindowsOs
from ._platform import Platform
@@ -16,18 +14,8 @@ class Windows(Platform):
def __init__(self):
super().__init__("windows")
self._add_archspec_targets()
self.default = archspec.cpu.host().name
self.front_end = self.default
self.back_end = self.default
windows_os = WindowsOs()
self.default_os = str(windows_os)
self.front_os = str(windows_os)
self.back_os = str(windows_os)
self.add_operating_system(str(windows_os), windows_os)
@classmethod

Some files were not shown because too many files have changed in this diff Show More