Commit graph

5974 commits

Author SHA1 Message Date
Tamara Dahlgren
383a343412
GenericBuilder: facilitate post-install phase test callbacks (#35314) 2023-02-06 12:51:01 -08:00
Massimiliano Culpo
017a15988c
Don't use CDash upload URL as report filename (#35338)
fixes #35337
2023-02-05 12:58:45 +01:00
John W. Parent
1826a41cdd
MSVC compiler: add platform toolset version (#35098) 2023-02-03 17:53:24 -08:00
John W. Parent
c49e2e5620
NMake builder: fix incorrect variable reference (#34937) 2023-02-02 16:34:35 -08:00
Massimiliano Culpo
ddecf07045
Use the maintainers directive in all packages (#35201) 2023-02-01 21:07:25 -08:00
Massimiliano Culpo
46466302a9
Pin black to 22.12.0 to avoid spurious style changes (#35282)
We need to sync changes on major versions with
spackbot, to avoid the bot saying everything is
allright and have CI failing nonetheless.
2023-02-01 15:45:12 +01:00
Massimiliano Culpo
cc2ae9f270
Add a maintainers directive (#35083)
fixes #34879

This commit adds a new maintainer directive,
which by default extend the list of maintainers
for a given package.

The directive is backward compatible with the current
practice of having a "maintainers" list declared at
the class level.
2023-01-27 07:51:24 +01:00
Harmen Stoppels
6847d73504
Cleanup of binary text relocation (#34188)
Move the relocation of binary text in its own class

Drop threaded text replacement, since the current bottleneck 
is decompression. It would be better to parallellize over packages,
instead of over files per package.

A small improvement with separate classes for text replacement is that we
now compile the regex in the constructor; previously it was compiled per
binary to be relocated.
2023-01-26 12:18:53 +01:00
Massimiliano Culpo
84917cfa79
Extract functions to read spec files from different format (#35094)
This commit makes explicit the format version of the spec file
we are reading from.

Before there were different functions capable of reading some
part of the spec file at multiple format versions. The decision
was implicit, since checks were based on the structure of the
JSON without ever checking a format version number.

The refactor makes also explicit which spec file format is used
by which database and lockfile format, since the information is
stored in global mappings.

To ensure we don't change the hash of old specs, JSON representations
of specs have been added as data. A unit tests checks that we read
the correct hash in, and that the hash stays the same when we
re-serialize the spec using the most recent format version.

Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
2023-01-26 10:40:46 +01:00
Harmen Stoppels
918bb63c3a
test/config.py: fix import issues (#35076) 2023-01-26 09:53:44 +01:00
Harmen Stoppels
5f8c09fd33
Print file summary on checksum validation failure (#35161)
Currently we print "sha256 checksum failed for [file]. Expected X but
got Y".

This PR extends that message with file size and contents info:

"... but got Y. File size = 123456 bytes. Contents = b'abc...def'"

That way we can immediately see if the file was downloaded only
partially, or if we downloaded a text page instead of a binary, etc.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2023-01-25 15:02:41 +00:00
Cory Bloor
d17aaf8729
hip: add cuda variant (#33872) 2023-01-24 22:30:58 +01:00
Massimiliano Culpo
115b6b2a51
Avoid creating help.sh and test.sh in cwd (#35123)
When running unit-test the test/ci.py module is leaving
garbage (help.sh, test.sh files) in the current working
directory.

This commit changes the current working directory to a
temporary path before those files are created.
2023-01-24 03:42:15 -08:00
kwryankrattiger
cd2d6a6397
ParaView/VTK: Patch xdmf2 for HDF5 1.13 (#33930)
* ParaView/VTK: Patch xdmf2 for HDF5 1.13

* Meson: update meson build system for 0.64

* ParaView: Change HDF5 1.13 patch to 1.13.1/2 patchs

* Mesa: Remove legacy mesa option from meson_args

* Use append to assemble meson args
2023-01-23 19:22:21 -08:00
Richarda Butler
a4b8753456
Update: spack help --spec (#35115)
* Update variant & compiler propagation
* Add the info for non boolean variants
* Add example for multi variants
2023-01-24 00:42:08 +00:00
Harmen Stoppels
13739e0783
environments: don't replace relative view path with absolute path on concretize/install (#34958)
* environments: don't rewrite relative view path, expand path on cli ahead of time

Currently if you have a spack.yaml that specifies a view by relative
path, Spack expands it to an absolute path on `spack -e . install` and
persists that to disk.

This is rather annoying when you have a `spack.yaml` file inside a git
repo, cause you want to use relative paths to make it relocatable, but
you constantly have to undo the changes made to spack.yaml by Spack.

So, as an alternative:

1. Always stick to paths as they are provided in spack.yaml, never
   replace them with a canonicalized version
2. Turn relative paths on the command line into absolute paths before
   storing to spack.yaml. This way you can do `spack env create --dir
   ./env --with-view ./view` and both `./env` and `./view` are resolved
   to the current working dir, as expected (not `./env/view`). This
   corresponds to the old behavior of `spack env create`.

* create --with-view always takes a value
2023-01-23 10:03:54 -08:00
Alex Richert
ce8727cece
Add --exclude option to 'spack external find' (#35013)
* Add --exclude option to 'spack external find' to ignore user-specified external packages
* Update bash completion arg order for external find

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2023-01-21 15:43:20 -08:00
markus-ferrell
c3e3c392a6
Windows/testing: enable tests for "spack find" (#33588) 2023-01-20 17:54:06 -08:00
John W. Parent
a424f7f173
Identify Windows support with tags (#35027)
All packages with explicit Windows support can be found with
`spack list --tags=windows`.

This also removes the documentation which explicitly lists
supported packages on Windows (which is currently out of date and
is now unnecessary with the added tags).

Note that if a package does not appear in this list, it *may*
still build on Windows, but it likely means that no explicit
attempt has been made to support it.
2023-01-20 13:32:28 -08:00
Massimiliano Culpo
8f8394a829
Add type hints to DependencySpec (#35021)
* DependencySpec: add type hints

* DependencySpec: make deptypes a keyword only argument
2023-01-20 09:53:57 +01:00
Harmen Stoppels
80db7a8a52
buildcache create: make "file exists" less verbose (#35019)
Currently we print 3 lines of "file exist" warning per tarball, this is
a bit excessive. Instead, it can be a simple single-line tty.warn
message.
2023-01-19 15:35:24 +00:00
Stephen Sachs
45ea7c19e5
[py-numpy, py-scipy] Enable MKL & ARMpl (#34979) 2023-01-19 08:01:31 -07:00
Harmen Stoppels
a357a39963
depfile: --make-target-prefix -> --make-prefix (#35009)
Since SPACK_PACKAGE_IDS is now also "namespaced" with <prefix>, it makes
more sense to call the flag `--make-prefix` and alias the old flag
`--make-target-prefix` to it.
2023-01-19 14:58:34 +01:00
Greg Becker
08101639cd
Bugfix: External Python Extensions (#34202)
Normally when using external packages in concretization, Spack ignores
all dependencies of the external. #33777 updated this logic to attach
a Python Spec to external Python extensions (most py-* packages), but
as implemented there were a couple issues:

* this did not account for concretization groups and could generate
  multiple different python specs for a single DAG
* in some cases this created a fake Python spec with insufficient
  details to be usable (concretization/installation of the
  extension would fail)

This PR addresses both of these issues: 

* For environment specs that are concretized together, external python
  extensions in those specs will all be assigned the same Python spec
* If Spack needs to "invent" a Python spec, then it will have all the
  needed details (e.g. compiler/architecture)
2023-01-18 15:17:28 -08:00
Harmen Stoppels
fce95e2efb
license year bump (#34921)
* license bump year
* fix black issues of modified files
* mypy
* fix 2021 -> 2023
2023-01-18 14:30:17 -08:00
Harmen Stoppels
f050b1cf78
depfile: variable with all identifiers (#34678)
With the new variable [prefix/]SPACK_PACKAGE_IDS you can conveniently execute
things after each successful install.

For example push just-built packages to a buildcache

```
SPACK ?= spack
export SPACK_COLOR = always
MAKEFLAGS += -Orecurse
MY_BUILDCACHE := $(CURDIR)/cache

.PHONY: all clean

all: push

ifeq (,$(filter clean,$(MAKECMDGOALS)))
include env.mk
endif

# the relevant part: push has *all* example/push/<pkg identifier> as prereqs
push: $(addprefix example/push/,$(example/SPACK_PACKAGE_IDS))
	$(SPACK) -e . buildcache update-index --directory $(MY_BUILDCACHE)
	$(info Pushed everything, yay!)

# and each example/push/<pkg identifier> has the install target as prereq,
# and the body can use target local $(HASH) and $(SPEC) variables to do
# things, such as pushing to a build cache
example/push/%: example/install/%
	@mkdir -p $(dir $@)
	$(SPACK) -e . buildcache create --allow-root --only=package --unsigned --directory $(MY_BUILDCACHE) /$(HASH) # push $(SPEC)
	@touch $@

spack.lock: spack.yaml
	$(SPACK) -e . concretize -f

env.mk: spack.lock
	$(SPACK) -e . env depfile -o $@ --make-target-prefix example

clean:
	rm -rf spack.lock env.mk example/
``
2023-01-18 19:19:46 +01:00
Harmen Stoppels
3bc943ae51
Remove verbose warning message from _try_install_from_binary_cache (#34994)
In the past we checked remote binary mirrors for existence of a spec
before attempting to download it. That changed to only checking local
copies of index.jsons (if available) to prioritize certain mirrors where
we expect to find a tarball. That was faster for CI since fetching
index.json and loading it just to order mirrors takes more time than
just attempting to fetch tarballs -- and also if we have a direct hit
there's no point to look at other mirrors.

Long story short: the info message only makes sense in the old version
of Spack, so it's better to remove it.
2023-01-18 08:25:48 -06:00
Dom Heinzeller
548aa21b18
Bug fix for duplicate rpath errors on macOS when creating build caches (#34375) 2023-01-18 13:32:16 +01:00
Harmen Stoppels
fef0f47d65
spack mirror create takes local paths only (#34992)
spack mirror create cannot work with urls, so it shouldn't promote local
paths to file urls.
2023-01-18 11:45:58 +01:00
Massimiliano Culpo
b148a43f08
CDashReporter: remove unused argument (#34869)
* CDashReporter: remove unused argument
* Removed extract_ctest_test_data
2023-01-17 11:09:38 -08:00
Massimiliano Culpo
74901a3d0d
Forward lookup of "test_log_file" and "test_failures" (#34882)
* Forward lookup of "test_log_file" and "test_failures"
  refers #34531
  closes #34487
  fixes #34440
* Add unit test
* py-libensemble: fix tests
* Support stand-alone tests with cached files as install-time tests

Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
2023-01-17 10:59:48 -08:00
roottreej
7659912dc4
Reduce verbosity in mirrors.yaml (#34210)
Ensure `spack mirror add <name> <url/path>` without further arguments translates to `<name>: <url>` key value pairs in mirrors.yaml. If --s3-* flags are provided, only store the provided ones. 

Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
2023-01-17 13:19:13 +00:00
Harmen Stoppels
3489cc0a9b
Refer to mirrors by name, path, or url (#34891)
With this change we get the invariant that `mirror.fetch_url` and
`mirror.push_url` return valid URLs, even when the backing config
file is actually using (relative) paths with potentially `$spack` and
`$env` like variables.

Secondly it avoids expanding mirror path / URLs too early,
so if I say `spack mirror add name ./path`, it stays `./path` in my
config. When it's retrieved through MirrorCollection() we
exand it to say `file://<env dir>/path` if `./path` was set in an
environment scope.

Thirdly, the interface is simplified for the relevant buildcache
commands, so it's more like `git push`:

```
spack buildcache create [mirror] [specs...]
```

`mirror` is either a mirror name, a path, or a URL.

Resolving the relevant mirror goes as follows:
    
- If it contains either / or \ it is used as an anonymous mirror with
   path or url.
- Otherwise, it's interpreted as a named mirror, which must exist.

This helps to guard against typos, e.g. typing `my-mirror` when there
is no such named mirror now errors with:

```
$ spack -e . buildcache create my-mirror
==> Error: no mirror named "my-mirror". Did you mean ./my-mirror?
```

instead of creating a directory in the current working directory. I
think this is reasonable, as the alternative (requiring that a local dir
exists) feels a bit pendantic in the general case -- spack is happy to
create the build cache dir when needed, saving a `mkdir`.

The old (now deprecated) format will still be available in Spack 0.20,
but is scheduled to be removed in 0.21:

```
spack buildcache create (--directory | --mirror-url | --mirror-name) [specs...]
```

This PR also touches `tmp_scope` in tests, because it didn't really
work for me, since spack fixes the possible --scope values once and
for all across tests, so tests failed when run out of order.
2023-01-16 10:14:41 -08:00
Gilles Gouaillardet
17a67b9a56
fix libtool filter for Fujitsu compilers (#34916)
Since legit regular expressions are matched, do not pass string=True
to the filter

Refs #34897
2023-01-16 15:56:13 +01:00
Jack Morrison
add8022490
Fix incorrect configuration file name in docs (#34925) 2023-01-16 14:52:08 +01:00
Adam J. Stewart
5f4b736006
Drop Python 3.6 again (#34442) 2023-01-16 10:09:40 +01:00
Todd Gamblin
d4e714bb2e
spack list: add --count option (#34950)
Sometimes I just want to know how many packages of a certain type there are.

- [x] add `--count` option to `spack list` that output the number of packages that
      *would* be listed.

```console
> spack list --count
6864
> spack list --count py-
2040
> spack list --count r-
1162
```
2023-01-14 16:08:40 -08:00
John W. Parent
ff38ff25cb
Support windows paths in a spec (#34405)
Refactor Spack's spec syntax parsing to handle Windows style paths
Amend unit tests to reflect this updated behavior.
2023-01-14 07:52:37 +01:00
Todd Gamblin
88a604e7f4
config: make path replacements lazy (#34758)
Currently, all of the replacements in `spack.util.path.replacements()` get evaluated for
each replacement. This makes it easy to get bootstrap issues, because config is used
very early on in Spack.

Right now, if I run `test_autotools_gnuconfig_replacement_no_gnuconfig` on my M1 mac, I
get the circular reference error below. This fixes the issue by making all of the path
replacements lazy lambdas.

As a bonus, this cleans up the way we do substitution for `$env` -- it's consistent with
other substitutions now.

- [x] make all path `replacements()` lazy
- [x] clean up handling of `$env`

```console
> spack unit-test -k test_autotools_gnuconfig_replacement_no_gnuconfig

...

==> [2022-12-31-15:44:21.771459] Error: AttributeError:

The 'autotools-config-replacement' package cannot find an attribute while trying to build from sources. This might be due to a change in Spack's package format to support multiple build-systems for a single package. You can fix this by updating the build recipe, and you can also report the issue as a bug. More information at https://spack.readthedocs.io/en/latest/packaging_guide.html#installation-procedure

/Users/gamblin2/src/spack/lib/spack/spack/package_base.py:1332, in prefix:
       1330    @property
       1331    def prefix(self):
  >>   1332        """Get the prefix into which this package should be installed."""
       1333        return self.spec.prefix

Traceback (most recent call last):
  File "/Users/gamblin2/src/spack/lib/spack/spack/build_environment.py", line 1030, in _setup_pkg_and_run
    kwargs["env_modifications"] = setup_package(
                                  ^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/build_environment.py", line 757, in setup_package
    set_module_variables_for_package(pkg)
  File "/Users/gamblin2/src/spack/lib/spack/spack/build_environment.py", line 596, in set_module_variables_for_package
    m.std_cmake_args = spack.build_systems.cmake.CMakeBuilder.std_args(pkg)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/build_systems/cmake.py", line 241, in std_args
    define("CMAKE_INSTALL_PREFIX", pkg.prefix),
                                   ^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/package_base.py", line 1333, in prefix
    return self.spec.prefix
           ^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/spec.py", line 1710, in prefix
    self.prefix = spack.store.layout.path_for_spec(self)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/directory_layout.py", line 336, in path_for_spec
    path = self.relative_path_for_spec(spec)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/directory_layout.py", line 106, in relative_path_for_spec
    projection = spack.projections.get_projection(self.projections, spec)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/projections.py", line 13, in get_projection
    if spec.satisfies(spec_like, strict=True):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/spec.py", line 3642, in satisfies
    if not self.virtual and other.virtual:
           ^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/spec.py", line 1622, in virtual
    return spack.repo.path.is_virtual(self.name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/repo.py", line 890, in is_virtual
    return have_name and pkg_name in self.provider_index
                                     ^^^^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/repo.py", line 770, in provider_index
    self._provider_index.merge(repo.provider_index)
                               ^^^^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/repo.py", line 1096, in provider_index
    return self.index["providers"]
           ~~~~~~~~~~^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/repo.py", line 592, in __getitem__
    self._build_all_indexes()
  File "/Users/gamblin2/src/spack/lib/spack/spack/repo.py", line 607, in _build_all_indexes
    self.indexes[name] = self._build_index(name, indexer)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/spack/repo.py", line 616, in _build_index
    index_mtime = self.cache.mtime(cache_filename)
                  ^^^^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/llnl/util/lang.py", line 826, in __getattr__
    return getattr(self.instance, name)
                   ^^^^^^^^^^^^^
  File "/Users/gamblin2/src/spack/lib/spack/llnl/util/lang.py", line 825, in __getattr__
    raise AttributeError()
AttributeError
```
2023-01-13 10:27:07 -08:00
Tamara Dahlgren
c0b458e38a
Documentation: Add installation policy to packaging guide (#34878) 2023-01-12 11:01:35 -08:00
Massimiliano Culpo
ccb9969b64
Fix issue when generating compiler hierarchy (#34873)
- [x] Fix bug affecting generation of Lmod modules
2023-01-11 10:09:02 -08:00
John W. Parent
7365d138fb
Build systems: add MSBuild and update NMake (#34659)
Add/update build systems used to build packages on Windows.
2023-01-10 17:03:15 -08:00
Massimiliano Culpo
9d00e7d15d
Remove **kwargs from function signatures in llnl.util.filesystem (#34804)
Since we dropped support for Python 2.7, we can embrace using keyword only arguments 
for many functions in Spack that use **kwargs in the function signature. Here this is done 
for the llnl.util.filesystem module.

There were a couple of bugs lurking in the code related to typo-like errors when retrieving
from kwargs. Those have been fixed as well.
2023-01-10 14:23:42 +01:00
Jonathon Anderson
807b87068a
style: Run mypy last (#34687) 2023-01-10 04:37:41 -08:00
Jonathon Anderson
6879c35d1c
FileCache: Delete the new cache file on exception (#34623)
The code in FileCache for write_transaction attempts to delete the temporary file when an exception occurs under the context by calling shutil.rmtree. However, rmtree only operates on directories while the rest of FileCache uses normal files. This causes an empty file to be written to the cache key when unneeded.

Use os.remove instead which operates on normal files.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2023-01-10 13:36:12 +01:00
Wileam Y. Phan
0f7f600d1f
Add CUDA 12.0 (#34664) 2023-01-10 11:51:23 +01:00
John Parent
9f0bb4301f Support ASCI control
Windows CMD prompt does not automatically support ASCI color control
characters on the console from Python. Enable this behavior by
accessing the current console and allowing the interpreation of ASCI
control characters from Python via the win32 API.
2023-01-09 09:14:17 -08:00
Harmen Stoppels
47011f594f
Revert "Allow spec.json files to be clearsigned, use transparent compression for *.json (#34490)" (#34856)
This reverts commit 8a1b817978.
2023-01-09 10:52:07 +01:00
Harmen Stoppels
8a1b817978
Allow spec.json files to be clearsigned, use transparent compression for *.json (#34490)
This commit allows (remote) spec.json files to be clearsigned and gzipped.

The idea is to reduce the number of requests and number of bytes transferred
2023-01-07 12:22:40 +01:00
QuellynSnead
ea970c8ab8
Fix PrgEnv detection (#34845)
* Fix PrgEnv detection for Cray compiler link paths
2023-01-06 18:11:43 +00:00