summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2023-05-17spack test: fix stand-alone test suite status reporting (#37602)Tamara Dahlgren4-40/+187
* Fix reporting of packageless specs as having no tests * Add test_test_output_multiple_specs with update to simple-standalone-test (and tests) * Refactored test status summary; added more tests or checks
2023-05-17Add recently added Spack Docker Images to documentation (#37732)Yoshiaki Senda1-0/+20
Signed-off-by: Yoshiaki Senda <yoshiaki@live.it>
2023-05-17Fix `spack find` not able to display version ranges in compilers (#37715)Massimiliano Culpo2-1/+16
2023-05-16Windows: fix MSVC version handling (#37711)John W. Parent1-2/+2
MSVC compiler logic was using string parsing to extract version from compiler spec, which was fragile. This broke in #37572, so has been fixed and made more robust by using attribute access.
2023-05-16Requirements and preferences should not define (non-git) versions (#37687)Peter Scheibel4-9/+174
Ensure that requirements `packages:*:require:@x` and preferences `packages:*:version:[x]` fail concretization when no version defined in the package satisfies `x`. This always holds except for git versions -- they are defined on the fly.
2023-05-16check_modules_set_name: do not check for "enable" key (#37701)Harmen Stoppels2-14/+46
2023-05-16unify: when_possible and unify: true -- Bugfix for error in 37438 (#37681)Greg Becker1-6/+15
Two bugs came in from #37438 1. `unify: when_possible` was broken, because of an incorrect assertion. abstract/concrete spec pairs were compared against the results that were in the process of being computed, rather than against the previous results. 2. `unify: true` had an ordering bug that could mix the association between abstract and concrete specs - [x] 1 is resolved by creating a lookup from old concrete specs to old abstract specs, and we use that to associate the "new" concrete specs that happen to be the old ones with their abstract specs (since those are stripped out for concretization - [x] 2 is resolved by combining the new and old abstract as lists instead of combining them as sets. This is important because `set() | set()` does not make any ordering promises, even though set ordering is otherwise guaranteed in `python@3.7:`
2023-05-15Improve package source code context display on error (#37655)Carson Woods2-12/+22
Spack displays package code context when it shouldn't (e.g., on `FetchError`s) and doesn't display it when it should (e.g., when errors occur in builder classes. The line attribution can sometimes be off by one, as well. - [x] Display package context when errors occur in a subclass of `PackageBase` - [x] Display package context when errors occur in a subclass of `BaseBuilder` - [x] Do not display package context when errors occur in `PackageBase`, `BaseBuilder` or other core code that is not in a `package.py` file. - [x] Fix off-by-one error for core code (don't subtract one from the line number *unless* it's in an actual `package.py` file. --------- Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2023-05-15bugfix: allow reuse of packages from foreign namespacesTodd Gamblin1-5/+19
We currently throw a nasty error if you try to reuse packages from some other namespace (e.g., OLCF), but we should be able to reuse patched local versions of builtin packages. Right now the only obstacle to that is that we try to look up virtual info for unknown namespaces, and we can't get the package from the repo to do that. We *can* assume that a package with a known namespace is similar, and that its virtual provider information is reasonably accurate, so we now do that. This isn't 100% accurate, but neither is relying on the package itself, as it may have gone out of date. The real solution here is virtual edge information, but this is a stopgap until we have that.
2023-05-15bugfix: don't look up virtual information for unknown packagesTodd Gamblin1-3/+14
`spec_clauses()` attempts to look up package information for concrete specs in order to determine which virtuals they may provide. This fails for renamed/deleted dependencies of buildcaches and installed packages. This will eventually be fixed by #35258, which adds virtual information on edges, but we need a workaround to make older buildcaches usable. - [x] make an exception for renamed packages and omit their virtual constraints - [x] add a note that this will be solved by adding virtuals to edges
2023-05-15bugfix: don't look up patches from packages for concrete specsTodd Gamblin1-3/+3
The concretizer can fail with `reuse:true` if a buildcache or installation contains a package with a dependency that has been renamed or deleted in the main repo (e.g., `netcdf` was refactored to `netcdf-c`, `netcdf-fortran`, etc., but there are still binary packages with dependencies called `netcdf`). We should still be able to install things for which we are missing `package.py` files. `Spec.inject_patches_variant()` was failing this requirement by attempting to look up the package class for concrete specs. This isn't needed -- we can skip it. - [x] swap two conditions in `Spec.inject_patches_variant()`
2023-05-15Bump tutorial command (#37674)Harmen Stoppels1-1/+1
2023-05-15`spack find`: get rid of @= in arch/compiler headers (#37672)Todd Gamblin1-1/+1
The @= in `spack find` output adds a bit of noise. Remove it as we did for `spack spec` and `spack concretize`. This modifies display_specs so it actually covers other places we use that routine, as well, e.g., `spack buildcache list`. before: ``` -- linux-ubuntu20.04-aarch64 / gcc@=11.1.0 ----------------------- ofdlcpi libpressio@0.88.0 ``` after: ``` -- linux-ubuntu20.04-aarch64 / gcc@11.1.0 ----------------------- ofdlcpi libpressio@0.88.0 ```
2023-05-14concretizer: don't change concrete environments without `--force` (#37438)Greg Becker3-32/+71
If a user does not explicitly `--force` the concretization of an entire environment, Spack will try to reuse the concrete specs that are already in the lockfile. --------- Co-authored-by: becker33 <becker33@users.noreply.github.com> Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2023-05-13`spack spec`: remove noisy `@=` from output (#37663)Todd Gamblin5-21/+39
@= is accurate, but noisy. Other UI commands tend not to print the redundant `@=` for known concrete versions; make `spack spec` consistent with them.
2023-05-12gitlab ci: release fixes and improvements (#37601)Scott Wittenburg2-4/+21
* gitlab ci: release fixes and improvements - use rules to reduce boilerplate in .gitlab-ci.yml - support copy-only pipeline jobs - make pipelines for release branches rebuild everything - make pipelines for protected tags copy-only * gitlab ci: remove url changes used in testing * gitlab ci: tag mirrors need public key Make sure that mirrors associated with release branches and tags contain the public key needed to verify the signed binaries. This also ensures that when stack-specific mirror contents are copied to the root, the root mirror has the public key as well. * review: be more specific about tags, curl flags * Make the check in ci.yaml consistent with the .gitlab-ci.yml --------- Co-authored-by: Ryan Krattiger <ryan.krattiger@kitware.com>
2023-05-12Allow buildcache specs to be referenced by hash (#35042)Nathan Hanford8-93/+256
Currently, specs on buildcache mirrors must be referenced by their full description. This PR allows buildcache specs to be referenced by their hashes, rather than their full description. ### How it works Hash resolution has been moved from `SpecParser` into `Spec`, and now includes the ability to execute a `BinaryCacheQuery` after checking the local store, but before concluding that the hash doesn't exist. ### Side-effects of Proposed Changes Failures will take longer when nonexistent hashes are parsed, as mirrors will now be scanned. ### Other Changes - `BinaryCacheIndex.update` has been modified to fail appropriately only when mirrors have been configured. - Tests of hash failures have been updated to use `mutable_empty_config` so they don't needlessly search mirrors. - Documentation has been clarified for `BinaryCacheQuery`, and more documentation has been added to the hash resolution functions added to `Spec`.
2023-05-12Update archspec to v0.2.1 (#37633)Massimiliano Culpo2-4/+14
2023-05-12Fix logic in setting oneapi microarchitecture flags (#37634)Robert Cohn1-2/+4
2023-05-12Improve error message for buildcaches (#37626)Massimiliano Culpo2-6/+23
2023-05-12Improve error messages when Spack finds a too new DB / lockfile (#37614)Massimiliano Culpo4-10/+56
This PR ensures that we'll get a comprehensible error message whenever an old version of Spack tries to use a DB or a lockfile that is "too new". * Fix error message when using a too new DB * Add a unit-test to ensure we have a comprehensible error message
2023-05-11Environments: store spack version/commit in spack.lock (#32801)Tamara Dahlgren4-25/+61
Add a section to the lock file to track the Spack version/commit that produced an environment. This should (eventually) enhance reproducibility, though we do not currently do anything with the information. It just adds to provenance at the moment. Changes include: - [x] adding the version/commit to `spack.lock` - [x] refactor `spack.main.get_version() - [x] fix a couple of environment lock file-related typos
2023-05-11Allow using -j to control the parallelism of concretization (#37608)Massimiliano Culpo2-1/+5
fixes #29464 This PR allows to use ``` $ spack concretize -j X ``` to set a cap on the parallelism of concretization from the command line
2023-05-11lmod: fix CompilerSpec concrete version / range (#37604)Harmen Stoppels2-3/+3
2023-05-11Improve the message for errors in package recipes (#37589)Massimiliano Culpo1-0/+3
fixes #30355
2023-05-11Improve error message for missing "command" entry in containerize (#37590)Massimiliano Culpo1-4/+25
fixes #21242
2023-05-11Allow clingo to enforce flags when they appear in requirements (#37584)Peter Scheibel3-3/+37
Flags are encoded differently from other variants, and they need a choice rule to ensure clingo has a choice to impose (or not) a constraint.
2023-05-10ci: remove --mirror-url flag (#37457)Harmen Stoppels2-8/+4
The flags --mirror-name / --mirror-url / --directory were deprecated in favor of just passing a positional name, url or directory, and letting spack figure it out. --------- Co-authored-by: Scott Wittenburg <scott.wittenburg@kitware.com>
2023-05-10Windows: Fix external detection for service accounts (#37293)John W. Parent1-2/+4
Prior to this PR, the HOMEDRIVE environment variable was used to detect what drive we are operating in. This variable is not available for service account logins (like what is used for CI), so switch to extracting the drive from PROGRAMFILES (which is more-widely defined).
2023-05-10Windows: prefer Python decompression support (#36507)John W. Parent2-113/+257
On Windows, several commonly available system tools for decompression are unreliable (gz/bz2/xz). This commit refactors `decompressor_for` to call out to a Windows or Unix-specific method: * The decompressor_for_nix method behaves the same as before and generally treats the Python/system support options for decompression as interchangeable (although avoids using Python's built-in tar support since that has had issues with permissions). * The decompressor_for_win method can only use Python support for gz/bz2/xz, although for a tar.gz it does use system support for untar (after the decompression step). .zip uses the system tar utility, and .Z depends on external support (i.e. that the user has installed 7zip). A naming scheme has been introduced for the various _decompression methods: * _system_gunzip means to use a system tool (and fail if it's not available) * _py_gunzip means to use Python's built-in support for decompressing .gzip files (and fail if it's not available) * _gunzip is a method that can do either
2023-05-10Fix compiler version issues (concrete vs range) (#37572)Harmen Stoppels3-13/+15
2023-05-10cuda: add versions 12.0.1, 12.1.0 and 12.1.1 (#37083)matteo-chesi1-1/+2
2023-05-10New option "--first" for "spack location" (#36283)G-Ragghianti2-1/+18
2023-05-10Create include/lib in prefix for oneapi packages (#37552)Robert Cohn1-0/+28
2023-05-10Stand-alone testing: make recipe support and processing spack-/pytest-like ↵Tamara Dahlgren38-1011/+2288
(#34236) This is a refactor of Spack's stand-alone test process to be more spack- and pytest-like. It is more spack-like in that test parts are no longer "hidden" in a package's run_test() method and pytest-like in that any package method whose name starts test_ (i.e., a "test" method) is a test part. We also support the ability to embed test parts in a test method when that makes sense. Test methods are now implicit test parts. The docstring is the purpose for the test part. The name of the method is the name of the test part. The working directory is the active spec's test stage directory. You can embed test parts using the test_part context manager. Functionality added by this commit: * Adds support for multiple test_* stand-alone package test methods, each of which is an implicit test_part for execution and reporting purposes; * Deprecates package use of run_test(); * Exposes some functionality from run_test() as optional helper methods; * Adds a SkipTest exception that can be used to flag stand-alone tests as being skipped; * Updates the packaging guide section on stand-alone tests to provide more examples; * Restores the ability to run tests "inherited" from provided virtual packages; * Prints the test log path (like we currently do for build log paths); * Times and reports the post-install process (since it can include post-install tests); * Corrects context-related error message to distinguish test recipes from build recipes.
2023-05-09CI: Backwards compatibility requires script override behavior (#37015)kwryankrattiger1-4/+23
2023-05-09Use single quotes to inline manifest in Dockerfiles (#37571)Massimiliano Culpo2-3/+19
fixes #22341 Using double quotes creates issues with shell variable substitutions, in particular when the manifest has "definitions:" in it. Use single quotes instead.
2023-05-09spack view copy: relocate symlinks (#32306)Harmen Stoppels1-33/+33
2023-05-08Add a "requires" directive, extend functionality of package requirements ↵Massimiliano Culpo8-110/+587
(#36286) Add a "require" directive to packages, which functions exactly like requirements specified in packages.yaml (uses the same fact-generation logic); update both to allow making the requirement conditional. * Packages may now use "require" to add constraints. This can be useful for something like "require(%gcc)" (where before we had to add a conflict for every compiler except gcc). * Requirements (in packages.yaml or in a "require" directive) can be conditional on a spec, e.g. "require(%gcc, when=@1.0.0)" (version 1.0.0 can only build with gcc). * Requirements may include a message which clarifies why they are needed. The concretizer assigns a high priority to errors which generate these messages (in particular over errors for unsatisfied requirements that do not produce messages, but also over a number of more-generic errors).
2023-05-05Packaging Guide: build-time test updates: option and test logs (#37093)Tamara Dahlgren1-5/+59
* Packaging Guide: build-time test updates: option and test logs * Fix a couple of typos
2023-05-05Improve version, version range, and version list syntax and behavior (#36273)Harmen Stoppels69-1812/+2001
## Version types, parsing and printing - The version classes have changed: `VersionBase` is removed, there is now a `ConcreteVersion` base class. `StandardVersion` and `GitVersion` both inherit from this. - The public api (`Version`, `VersionRange`, `ver`) has changed a bit: 1. `Version` produces either `StandardVersion` or `GitVersion` instances. 2. `VersionRange` produces a `ClosedOpenRange`, but this shouldn't affect the user. 3. `ver` produces any of `VersionList`, `ClosedOpenRange`, `StandardVersion` or `GitVersion`. - No unexpected type promotion, so that the following is no longer an identity: `Version(x) != VersionRange(x, x)`. - `VersionList.concrete` now returns a version if it contains only a single element subtyping `ConcreteVersion` (i.e. `StandardVersion(...)` or `GitVersion(...)`) - In version lists, the parser turns `@x` into `VersionRange(x, x)` instead of `Version(x)`. - The above also means that `ver("x")` produces a range, whereas `ver("=x")` produces a `StandardVersion`. The `=` is part of _VersionList_ syntax. - `VersionList.__str__` now outputs `=x.y.z` for specific version entries, and `x.y.z` as a short-hand for ranges `x.y.z:x.y.z`. - `Spec.format` no longer aliases `{version}` to `{versions}`, but pulls the concrete version out of the list and prints that -- except when the list is is not concrete, then is falls back to `{versions}` to avoid a pedantic error. For projections of concrete specs, `{version}` should be used to render `1.2.3` instead of `=1.2.3` (which you would get with `{versions}`). The default `Spec` format string used in `Spec.__str__` now uses `{versions}` so that `str(Spec(string)) == string` holds. ## Changes to `GitVersion` - `GitVersion` is a small wrapper around `StandardVersion` which enriches it with a git ref. It no longer inherits from it. - `GitVersion` _always_ needs to be able to look up an associated Spack version if it was not assigned (yet). It throws a `VersionLookupError` whenever `ref_version` is accessed but it has no means to look up the ref; in the past Spack would not error and use the commit sha as a literal version, which was incorrect. - `GitVersion` is never equal to `StandardVersion`, nor is satisfied by it. This is such that we don't lose transitivity. This fixes the following bug on `develop` where `git_version_a == standard_version == git_version_b` does not imply `git_version_a == git_version_b`. It also ensures equality always implies equal hash, which is also currently broken on develop; inclusion tests of a set of versions + git versions would behave differently from inclusion tests of a list of the same objects. - The above means `ver("ref=1.2.3) != ver("=1.2.3")` could break packages that branch on specific versions, but that was brittle already, since the same happens with externals: `pkg@1.2.3-external` suffixes wouldn't be exactly equal either. Instead, those checks should be `x.satisfies("@1.2.3")` which works both for git versions and custom version suffixes. - `GitVersion` from commit will now print as `<hash>=<version>` once the git ref is resolved to a spack version. This is for reliability -- version is frozen when added to the database and queried later. It also improves performance since there is no need to clone all repos of all git versions after `spack clean -m` is run and something queries the database, triggering version comparison, such as potentially reuse concretization. - The "empty VerstionStrComponent trick" for `GitVerison` is dropped since it wasn't representable as a version string (by design). Instead, it's replaced by `git`, so you get `1.2.3.git.4` (which reads 4 commits after a tag 1.2.3). This means that there's an edge case for version schemes `1.1.1`, `1.1.1a`, since the generated git version `1.1.1.git.1` (1 commit after `1.1.1`) compares larger than `1.1.1a`, since `a < git` are compared as strings. This is currently a wont-fix edge case, but if really required, could be fixed by special casing the `git` string. - Saved, concrete specs (database, lock file, ...) that only had a git sha as their version, but have no means to look the effective Spack version anymore, will now see their version mapped to `hash=develop`. Previously these specs would always have their sha literally interpreted as a version string (even when it _could_ be looked up). This only applies to databases, lock files and spec.json files created before Spack 0.20; after this PR, we always have a Spack version associated to the relevant GitVersion). - Fixes a bug where previously `to_dict` / `from_dict` (de)serialization would not reattach the repo to the GitVersion, causing the git hash to be used as a literal (bogus) version instead of the resolved version. This was in particularly breaking version comparison in the build process on macOS/Windows. ## Installing or matching specific versions - In the past, `spack install pkg@3.2` would install `pkg@=3.2` if it was a known specific version defined in the package, even when newer patch releases `3.2.1`, `3.2.2`, `...` were available. This behavior was only there because there was no syntax to distinguish between `3.2` and `3.2.1`. Since there is syntax for this now through `pkg@=3.2`, the old exact matching behavior is removed. This means that `spack install pkg@3.2` constrains the `pkg` version to the range `3.2`, and `spack install pkg@=3.2` constrains it to the specific version `3.2`. - Also in directives such as `depends_on("pkg@2.3")` and their when conditions `conflicts("...", when="@2.3")` ranges are ranges, and specific version matches require `@=2.3.`. - No matching version: in the case `pkg@3.2` matches nothing, concretization errors. However, if you run `spack install pkg@=3.2` and this version doesn't exist, Spack will define it; this allows you to install non-registered versions. - For consistency, you can now do `%gcc@10` and let it match a configured `10.x.y` compiler. It errors when there is no matching compiler. In the past it was interpreted like a specific `gcc@=10` version, which would get bootstrapped. - When compiler _bootstrapping_ is enabled, `%gcc@=10.2.0` can be used to bootstrap a specific compiler version. ## Other changes - Externals, compilers, and develop spec definitions are backwards compatible. They are typically defined as `pkg@3.2.1` even though they should be saying `pkg@=3.2.1`. Spack now transforms `pkg@3` into `pkg@=3` in those cases. - Finally, fix strictness of `version(...)` directive/declaration. It just does a simple type check, and now requires strings/integers. Floats are not allowed because they are ambiguous `str(3.10) == "3.1"`.
2023-05-05Fix typos in packaging guide (#37460)Eric Berquist1-3/+3
2023-05-05Add spack buildcache push (alias to buildcache create) (#34861)Harmen Stoppels7-48/+46
`spack buildcache create` is a misnomer cause it's the only way to push to an existing buildcache (and it in fact calls binary_distribution.push). Also we have `spack buildcache update-index` but for create the flag is `--rebuild-index`, which is confusing (and also... why "rebuild" something if the command is "create" in the first place, that implies it wasn't there to begin with). So, after this PR, you can use either ``` spack buildcache create --rebuild-index ``` or ``` spack buildcache push --update-index ``` Also, alias `spack buildcache rebuild-index` to `spack buildcache update-index`.
2023-05-05Relax environment manifest filename requirements and lockfile identification ↵Chris Green6-33/+92
criteria (#37413) * Relax filename requirements and lockfile identification criteria * Tests * Update function docs and help text * Update function documentation * Update Sphinx documentation * Adjustments per https://github.com/spack/spack/pull/37413#pullrequestreview-1413540132 * Further tweaks per https://github.com/spack/spack/pull/37413#pullrequestreview-1413971254 * Doc fixes per https://github.com/spack/spack/pull/37413#issuecomment-1535976068
2023-05-05cc: deal with -Wl,-rpath= without value, deal with NAG (#37215)Harmen Stoppels2-5/+32
Spack never parsed `nagfor` linker arguments put on the compiler line: ``` nagfor -Wl,-Wl,,-rpath,,/path ```` so, let's continue not attempting to parse that.
2023-05-05meson: change default build type to "release" (#37436)Michael Kuhn1-1/+1
The same was done for CMake in #36679.
2023-05-05spack uninstall: reduce verbosity with named environments (#34001)Harmen Stoppels5-192/+96
2023-05-05deprecate buildcache create --rel, buildcache install --allow-root (#37285)Harmen Stoppels4-19/+21
`buildcache create --rel`: deprecate this because there is no point in making things relative before tarballing; on install you need to expand `$ORIGIN` / `@loader_path` / relative symlinks anyways because some dependencies may actually be in an upstream, or have different projections. `buildcache install --allow-root`: this flag was propagated through a lot of functions but was ultimately unused.
2023-05-05Remove "blacklist" and "whitelist" from module configuration (#37432)Massimiliano Culpo6-154/+21
The sections were deprecated in v0.19
2023-05-04Allow choosing the name of the packages subdirectory in repositories (#36643)Greg Becker4-22/+61
Co-authored-by: becker33 <becker33@users.noreply.github.com>