Commit graph

5726 commits

Author SHA1 Message Date
Brian Vanderwende
27cf8dddec
shell prompt: enclose control sequence in brackets (#33079)
When setting `PS1` in Bash, it's required to enclose non-printable characters in square brackets, so that the width of the terminal is handled correctly.

See https://www.gnu.org/software/bash/manual/bash.html#Controlling-the-Prompt
2022-10-10 07:29:58 -06:00
Adam J. Stewart
7cb745b03a
PythonPackage: fix libs/headers attributes (#32970) 2022-10-10 13:26:30 +00:00
Sergey Kosukhin
4bc8f66388
autotools: extend patching of the libtool script (#30768)
* filter_file: introduce argument 'start_at'

* autotools: extend patching of the libtool script

* autotools: refactor _patch_usr_bin_file

* autotools: improve readability of the filtering

* autotools: keep the modification time of the configure scripts

* autotools: do not try to patch directories

* autotools: explain libtool patching for posterity

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2022-10-07 22:04:44 +00:00
MatthewLieber
23f6c92f33
add compatibility for rocky8 and rhel8 (#33068) 2022-10-07 04:25:58 +00:00
Massimiliano Culpo
1a12ddbd2d
Add a warning on Python 2.7 deprecation (#33052)
Co-authored-by: alalazo <alalazo@users.noreply.github.com>
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2022-10-06 23:42:34 +02:00
Sergey Kosukhin
a520a7ef28
tcl module template: automatically unload automatically loaded modules (#32853)
Remove `module-info mode load` condition that prevents auto-unloading when autoloading is enabled. It looks like this condition was added to work around an issue in environment-modules that is no longer necessary.

Add quotes to make is-loaded happy
2022-10-06 20:15:28 +02:00
Harmen Stoppels
fc5da74998
docs: fix deprecated use of install_tree (#33004) 2022-10-06 09:45:46 +00:00
Andrew W Elble
28de7da0cc
cuda: add v11.8.0 (#33027)
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2022-10-06 09:46:01 +02:00
Jordan Galby
6c12630e95
Optimize concurrent misc_cache provider index rebuild (#32874)
When concurrent misc_cache provider index rebuilds happen, try to
rebuild it only once, so we don't exceed misc_cache lock timeout.

For example, when using `spack env depfile`, with no previous
misc_cache, running `make -f depfile -j8` could run at most 8 concurrent
`spack install` locking on misc_cache to rebuild the provider index. If
one rebuild takes 30s, before this fix, the "worst" lock could wait up
to 30s * 7, easily exceeding misc_cache lock timeout. Now, the "worst"
lock would take 30s * 1 + ~1s * 6.
2022-10-05 06:01:59 -06:00
Chris MacMackin
53cea629b7
autotools: Filter libtools when building with dpcpp (#32876)
Due to a [known
issue](https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/dpcpp-and-GNU-Autotools/m-p/1296985)
with dpcpp, autotool-based builds that try to use it will fail because
they try to link against temporary files that no longer exist. This
commit filters those files out of the libtools script so that linking
can work properly.
2022-10-05 11:57:37 +00:00
Greg Becker
5f59821433
BuildEnvironment: accumulate module changes to poke to all relevant modules (#32340)
Currently, module changes from `setup_dependent_package` are applied only to the module of the package class, but not to any parent classes' modules between the package class module and `spack.package_base`.

In this PR, we create a custom class to accumulate module changes, and apply those changes to each class that requires it. This design allows us to code for a single module, while applying the changes to multiple modules as needed under the hood, without requiring the user to reason about package inheritance.
2022-10-04 13:06:50 -07:00
Todd Gamblin
8c50b44bfe
find/list: display package counts last (#32946)
* find/list: display package counts last

We have over 6,600 packages now, and `spack list` still displays the number of packages
before it lists them all. This is useless for large sets of results (e.g., with no args)
as the number has scrolled way off the screen before you can see it. The same is true
for `spack find` with large installations.

This PR changes `spack find` and `spack list` so that they display the package count
last.

* add some quick testing

Co-authored-by: Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com>
2022-10-04 10:56:46 -07:00
Adam J. Stewart
450a3074e2
Fix typo in documentation (#32984) 2022-10-04 19:54:40 +02:00
John W. Parent
5a0f4970df
Fixup errors introduced by Clingo Pr: (#32905)
* re2c depends on cmake on Windows
* Winbison properly added to bootstrap package search list
2022-10-02 17:44:05 -07:00
Greg Becker
deae0c48e4
develop: canonicalize dev paths and base relative paths on env.path (#30075)
Allow environment variables and spack-specific path substitution variables (e.g. `$spack`) to be
used in the paths associated with develop specs, while maintaining the ability to keep those
paths relative to the environment rather than the working directory.
2022-09-30 20:56:53 +00:00
kwryankrattiger
a01c36da45
Install: Add use-buildcache option to install (#32537)
Install: Add use-buildcache option to install

* Allow differentiating between top level packages and dependencies when
determining whether to install from the cache or not.

* Add unit test for --use-buildcache

* Use metavar to display use-buildcache options.

* Update spack-completion
2022-09-29 13:48:06 -05:00
John W. Parent
650a668a9d
Windows: Support for Clingo and dependencies (#30690)
Make it possible to install the Clingo package on Windows; this
also provides a means to use Clingo with Spack on Windows.

This includes

* A new "winbison" package: Windows has a port of bison and flex where
  the two packages are grouped together. Clingo dependencies have been
  updated to use winbison on Windows and bison elsewhere (this avoids
  complicating the existin bison/flex packages until we can add support
  for implied virtuals).
* The CMake build system was incorrectly converting CMAKE_INSTALL_PREFIX
  to POSIX format.
* The re2c package has been modified to use CMake on Windows; for now
  this is done by overloading the configure/build/install methods to
  perform CMake-appropriate operations; the package should be refactored
  once support for multiple build systems in one Package is available.
2022-09-28 09:54:00 -06:00
Massimiliano Culpo
63dca0c6cc
Remove mentions of "best-effort" matrix expansion in the docs (#32755)
closes #20340
2022-09-28 09:15:36 +02:00
Alex Hornburg
67717c569e
shell.py: fix undefined variable in csh deactivate (#32816)
This commit fixes #27027.

The root cause of the issue is that the `SPACK_OLD_PROMPT` variable
was evaluated in string interpolation regardless of whether the
guard condition above evaluates to true or false. This commit uses
the `eval` keyword to defer evaluation until the command is executed.

Co-authored-by: Alexander Hornburg <alexande@xilinx.com>
2022-09-27 12:32:42 -07:00
Chris White
777271da18
improve lexing error (#32832) 2022-09-26 22:47:45 +00:00
John W. Parent
30f6fd8dc0
Fetching/decompressing: use magic numbers (#31589)
Spack currently depends on parsing filenames of downloaded files to
determine what type of archive they are and how to decompress them.
This commit adds a preliminary check based on magic numbers to
determine archive type (but falls back on name parsing if the
extension type cannot be determined).

As part of this work, this commit also enables decompression of
.tar.xz-compressed archives on Windows.
2022-09-26 00:01:42 -07:00
Tamara Dahlgren
4751881fd1
Fix two docstring typos (#32751) 2022-09-23 11:17:01 -07:00
Peter Scheibel
0a050785e9
Skip all tests using problematic fixture on python 2.7 (#32768) 2022-09-23 09:29:48 +02:00
Peter Scheibel
4094e59ab8
Fetching: log more exceptions (#32736)
Include exception info related to url retrieval in debug messages
which otherwise would be swallowed. This is intended to be useful
for detecting if CA configuration interferes with downloads from
HTTPS links.
2022-09-22 10:54:52 -07:00
Tamara Dahlgren
54d06fca79
Add hash hint to multi-spec message (#32652) 2022-09-22 09:18:43 +02:00
Massimiliano Culpo
7e01a1252a
Allow conditional variants as first values in a variant directive (#32740) 2022-09-21 19:22:58 +02:00
Tamara Dahlgren
f12ececee5
Docs: Update pipeline ci rebuild to add --tests (plus fixed typos) (#32048) 2022-09-21 14:23:58 +02:00
Manuela Kuhn
d4c13b0f8f
Add skip_import to PythonPackage and use it in py-nilearn (#32664)
* Add skip_import to PythonPackage and use it in py-nilearn

* Fix dependencies
2022-09-17 23:02:30 +00:00
Todd Gamblin
a0c7209dc1
bugfix: package hash should affect process, dag, and dunder hashes (#32516)
This fixes a bug where two installations that differ only by package hash will not show
up in `spack find`.

The bug arose because `_cmp_node` on `Spec` didn't include the package hash in its
yielded fields. So, any two `Spec` objects that were only different by package hash
would appear to be equal and would overwrite each other when inserted into the same
`dict`. Note that we could still *install* specs with different package hashes, and they
would appear in the database, but we code that needed to put them into data structures
that use `__hash__` would have issues.

This PR makes `Spec.__hash__` and `Spec.__eq__` include the `process_hash()`, and it
makes `Spec._cmp_node` include the package hash. All of these *should* include all
information in a spec so that we don't end up in a situation where we are blind to
particular field differences.

Eventually, we should unify the `_cmp_*` methods with `to_node_dict` so there aren't two
sources of truth, but this needs some thought, since the `_cmp_*` methods exist for
speed. We should benchmark whether it's really worth having two types of hashing now
that we use `json` instead of `yaml` for spec hashing.

- [x] Add `package_hash` to `Spec._cmp_node`
- [x] Add `package_hash` to `spack.solve.asp.spec_clauses` so that the `package_hash`
      will show up in `spack diff`.
- [x] Add `package_hash` to the `process_hash` (which doesn't affect abstract specs
      but will make concrete specs correct)
- [x] Make `_cmp_iter` report the dag_hash so that no two specs with different
      process hashes will be considered equal.
2022-09-16 00:57:10 +00:00
John W. Parent
deca34676f
Bugfix: find_libraries (#32653)
53a7b49 created a reference error which broke `.libs` (and
`find_libraries`) for many packages. This fixes the reference
error and improves the testing for `find_libraries` by actually
checking the extension types of libraries that are retrieved by
the function.
2022-09-14 14:45:42 -06:00
Peter Scheibel
7971985a06
Manifest parsing: skip invalid manifest files (#32467)
* catch json schema errors and reraise as property of SpackError
* no need to catch subclass of given error
* Builtin json library for Python 2 uses more generic type
* Correct instantiation of SpackError (requires a string rather than an exception)
* Use exception chaining (where possible)
2022-09-14 13:02:51 -07:00
psakievich
045a5e80cb
Allow version to accept the '=' token without activating lexer switch (#32257) 2022-09-14 10:16:28 -07:00
Sam Broderick
d6a3ffc301
Update module_file_support.rst (#32629)
Missing lead in "This may to inconsistent modulfiles if..."
2022-09-14 01:41:50 +00:00
John W. Parent
53a7b49619
Windows rpath support (#31930)
Add a post-install step which runs (only) on Windows to modify an
install prefix, adding symlinks to all dependency libraries.

Windows does not have the same concept of RPATHs as Linux, but when
resolving symbols will check the local directory for dependency
libraries; by placing a symlink to each dependency library in the
directory with the library that needs it, the package can then
use all Spack-built dependencies.

Note:

* This collects dependency libraries based on Package.rpath, which
  includes only direct link dependencies
* There is no examination of libraries to check what dependencies
  they require, so all libraries of dependencies are symlinked
  into any directory of the package which contains libraries
2022-09-13 10:28:29 -07:00
Tamara Dahlgren
62e788fb89
Added install phase test methods for CachedCMakePackage (inherited) and WafPackage (#32627) 2022-09-13 12:12:15 +02:00
Massimiliano Culpo
1427ddaa59
ci: restore coverage computation (#32585)
* ci: restore coverage computation

* Mark "test_foreground_background" as xfail

* Mark "test_foreground_background_output" as xfail

* Make number of processes explicit, remove verbosity on linux

* Run coverage on just 3 Python jobs for linux

* Run coverage on just 3 Python jobs for linux

* Run coverage on just 2 Python jobs for linux

* Add back verbose, since before we didn't encounter the xdist internal error

* Reduce the workers to 2

* Try to use command line
2022-09-10 07:25:44 -06:00
psakievich
b4a2b8d46c
GitRef Versions: Bug Fixes (#32437)
* Fix a version cmp bug in asp.py

* Fix submodule bug for git refs

* Add branch in logic for submodules

* Fix git version comparisons

main does not satisfy git.foo=main
git.foo=main does satisfy main
2022-09-09 11:02:40 -07:00
Peter Scheibel
02151ac649
CMakePackage: allow custom CMAKE_PREFIX_PATH entries (#32547)
* define `cmake_prefix_paths` property for packages

add to CMake arguments via CMakePackage

Co-authored-by: Robert Underwood <runderwood@anl.gov>
2022-09-08 16:23:04 -07:00
Peter Scheibel
021ff1c7da
Skip test which fails randomly on Python 2.7 (#32569) 2022-09-08 08:11:20 +02:00
Tom Scogland
762ba27036
Make GHA tests parallel by using xdist (#32361)
* Add two no-op jobs named "all-prechecks" and "all"

These are a suggestion from @tgamblin, they are stable named markers we
can use from gitlab and possibly for required checks to make CI more
resilient to refactors changing the names of specific checks.

* Enable parallel testing using xdist for unit testing in CI

* Normalize tmp paths to deal with macos

* add -u flag compatibility to spack python

As of now, it is accepted and ignored.  The usage with xdist, where it
is invoked specifically by `python -u spack python` which is then passed
`-u` by xdist is the entire reason for doing this.  It should never be
used without explicitly passing -u to the executing python interpreter.

* use spack python in xdist to support python 2

When running on python2, spack has many import cycles unless started
through main.  To allow that, this uses `spack python` as the
interpreter, leveraging the `-u` support so xdist doesn't error out when
it unconditionally requests unbuffered binary IO.

* Use shutil.move to account for tmpdir being in a separate filesystem sometimes
2022-09-07 20:12:57 +02:00
Seth R. Johnson
c7292aa4b6
Fix spack locking on some NFS systems (#32426)
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2022-09-06 09:50:59 -07:00
Massimiliano Culpo
d7d59a24d1
Mark a test xfail on Python 2.7 (#32526)
refers #32470
2022-09-06 11:56:44 +02:00
Tom Scogland
69f7a8f4d1
Reorder workflow execution in GHA (#32183)
This patchset refactors our GitHub actions into a single top-level ci workflow that
invokes a series of reusable actions.  The main goal of this is to be able to easily
control which tests run and in what order based on the success or failure of top-level
prechecks.  Our previous workflows ran in three sets:

* nix tests: style and verification first, then linux and macos tests if successful
* windows tests: style and verification first, then linux and macos tests if successful
* bootstrap tests

As a result, the bootstrap tests ran even if the style failed, and style and verification
had to run on two different platforms despite running identical checks.  I'm relatively
sure that's because of the limitation on dependencies between steps in the jobs.
Reusable workflows allow us to run the style, verification and now audit checks once,
then depending on the results, and the files changed, run the appropriate nix, windows
and bootstrap tests.  While it saves only a few minutes by itself, this makes it easier to
refactor checks to subset tests without having to replicate tests or other workflow
components in the future.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2022-09-02 14:09:23 -07:00
Harmen Stoppels
80389911cc
Update bootstrap buildcache to v0.3 (#32262)
This release allow to bootstrap patchelf from binaries.
2022-09-02 12:48:46 +02:00
Scott Wittenburg
6239198d65
Fix cause of checksum failures in public binary mirror (#32407)
Move the copying of the buildcache to a root job that runs after all the child
pipelines have finished, so that the operation can be coordinated across all
child pipelines to remove the possibility of race conditions during potentially
simlutandous copies. This lets us ensure the .spec.json.sig and .spack files
for any spec in the root mirror always come from the same child pipeline
mirror (though which pipeline is arbitrary).  It also allows us to avoid copying
of duplicates, which we now do.
2022-09-01 15:29:44 -06:00
Peter Scheibel
2968ae667f
New command, spack change, to change existing env specs (#31995)
If you have an environment like

```
$ cat spack.yaml
spack:
  specs: [openmpi@4.1.0+cuda]
```

this PR provides a new command `spack change` that you can use to adjust environment specs from the command line:

```
$ spack change openmpi~cuda
$ cat spack.yaml
spack:
  specs: [openmpi@4.1.0~cuda]
```

in other words, this allows you to tweak the details of environment specs from the command line.

Notes:

* This is only allowed for environments that do not define matrices
  * This is possible but not anticipated to be needed immediately
  * If this were done, it should probably only be done for "named"/not-anonymous specs (i.e. we can change `openmpi+cuda` but not spec like `+cuda` or `@4.0.1~cuda`)
2022-09-01 11:04:01 -07:00
Massimiliano Culpo
0df0b9a505
Port package sanity unit tests to audits (#32405) 2022-09-01 08:21:12 +02:00
Massimiliano Culpo
0c6e3188ac
ASP-based solver: allow to reuse installed externals (#31558)
fixes #31484

Before this change if anything was matching an external
condition, it was considered "external" and thus something
to be "built".

This was happening in particular to external packages
that were re-read from the DB, which then couldn't be
reused, causing the problems shown in #31484.

This PR fixes the issue by excluding specs with a
"hash" from being considered "external"

* Test that users have a way to select a virtual

This ought to be solved by extending the "require"
attribute to virtual packages, so that one can:
```yaml
mpi:
  require: 'multi-provider-mpi'
```

* Prevent conflicts to be enforced on specs that can be reused.

* Rename the "external_only" fact to "buildable_false", to better reflect its origin
2022-08-31 20:05:55 +00:00
Tamara Dahlgren
3894ceebc9
Environments: Add support for include URLs (#29026)
* Preliminary support for include URLs in spack.yaml (environment) files

This commit adds support in environments for external configuration files obtained from a URL with a preference for grabbing raw text from GitHub and gitlab for efficient downloads of the relevant files. The URL can also be a link to a directory that contains multiple configuration files.

Remote configuration files are retrieved and cached for the environment. Configuration files with the same name will not be overwritten once cached.
2022-08-30 11:13:23 -07:00
Betsy McPhail
ad95719a1d
Use threading.TIMEOUT_MAX when available (#32399)
This value was introduced in Python 3.2. Specifying a timeout greater than
this value will raise an OverflowError.
2022-08-26 17:37:56 -06:00
Massimiliano Culpo
51244abee9
Configuration: Allow requirements for virtual packages (#32369)
Extend the semantics of package requirements to
allow using them also under a virtual package
attribute in packages.yaml

These requirements are enforced whenever that
virtual spec is present in the DAG.
2022-08-26 13:17:40 -07:00
Massimiliano Culpo
b6ea2a46d1
Update archspec to latest commit (#32368)
Modifications:

- [x] Add graviton3
- [x] Optimize __eq__ for microarchitectures
2022-08-26 12:58:20 +02:00
Chris White
b31cd189a7
Improve error message for yaml config file (#32382)
* improve error message

* Update lib/spack/spack/config.py

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

Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
2022-08-26 02:43:03 +00:00
Adam J. Stewart
507e06b5d2
Python: add new maintainer (#31755) 2022-08-25 09:46:09 -07:00
Massimiliano Culpo
8654197c56
ASP-based solver: prevent the use of hashes that are not available (#32354)
fixes #32348
2022-08-25 17:55:58 +02:00
Massimiliano Culpo
e2468c8928
Allow default requirements in packages.yaml (#32260)
Allow users to express default requirements in packages.yaml. 

These requirements are overridden if more specific requirements
are present for a given package.
2022-08-24 09:33:55 +02:00
Ryan Marcellino
af4788fdef
New package: py-griffe and new build backend: py-pdm-pep517 (#32335)
* New package: py-griffe and new build backend: py-pdm-pep517

* add pdm to build backend docs
2022-08-23 23:23:23 -05:00
Harmen Stoppels
707a099b69
spack -e x config --scope=y add z add to scope (#31746)
* `spack -e x config --scope=y add z` add to scope

instead of to the environment file.
2022-08-23 12:52:34 -07:00
Simon Pintarelli
44258a7cce
meson: create unique names for build directory (#32062)
Taken from CMakePackage
2022-08-23 13:24:32 +02:00
Tamara Dahlgren
3c3b18d858
spack ci: add support for running stand-alone tests (#27877)
This support requires adding the '--tests' option to 'spack ci rebuild'.
Packages whose stand-alone tests are broken (in the CI environment) can
be configured in gitlab-ci to be skipped by adding them to
broken-tests-packages.

Highlights include:
- Restructured 'spack ci' help to provide better subcommand summaries;
- Ensured only one InstallError (i.e., installer's) rather than allowing
  build_environment to have its own; and
- Refactored CI and CDash reporting to keep CDash-related properties and
  behavior in a separate class.

This allows stand-alone tests from `spack ci` to run when the `--tests`
option is used.  With `--tests`, stand-alone tests are run **after** a
**successful** (re)build of the package.  Test results are collected
and report(able) using CDash.

This PR adds the following features:
- Adds `-t` and `--tests` to `spack ci rebuild` to run stand-alone tests;
- Adds `--fail-fast` to stop stand-alone tests after the first failure;
- Ensures a *single* `InstallError` across packages
    (i.e., removes second class from build environment);
- Captures skipping tests for externals and uninstalled packages
    (for CDash reporting);
- Copies test logs and outputs to the CI artifacts directory to facilitate
    debugging;
- Parses stand-alone test results to report outputs from each `run_test` as
    separate test parts (CDash reporting);
- Logs a test completion message to allow capture of timing of the last
    `run_test` part;
- Adds the runner description to the CDash site to better distinguish entries
    in CDash tables;
- Adds `gitlab-ci` `broken-tests-packages` to CI configuration to skip
    stand-alone testing for packages with known issues;
- Changes `spack ci --help` so description of each subcommand is a single line;
- Changes `spack ci <subcommand> --help` to provide the full description of
    each command (versus no description); and
- Ensures `junit` test log file ends in an `.xml` extension (versus default where
    it does not).

Tasks:

- [x] Include the equivalent of the architecture information, or at least the host target, in the CDash output
- [x] Upload stand-alone test results files as  `test` artifacts
- [x] Confirm tests are run in GitLab
- [x] Ensure CDash results are uploaded as artifacts
- [x] Resolve issues with CDash build-and test results appearing on same row of the table 
- [x] Add unit tests  as needed
- [x] Investigate why some (dependency) packages don't have test results (e.g., related from other pipelines)
- [x] Ensure proper parsing and reporting of skipped tests (as `not run`) .. post- #28701 merge
- [x] Restore the proper CDash URLand or mirror ONCE out-of-band testing completed
2022-08-23 00:52:48 -07:00
sparkyniner
21e6679056
spack list: add --tag flag (#32016)
* modified list.py and added functionality for --tag

* Removed long and very long, shifted rest of code above return statement

* removed results variable

* added import statement at top

* added the line accidentally deleted

* added line accidentally deleted

* changed p.name to p, added line inside if statement

* line order switched

* [@spackbot] updating style on behalf of sparkyniner

* ran update completion command

* add tests

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

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

* [@spackbot] updating style on behalf of sparkyniner

* changed argument to mock_packages and moved code under filter by tag

* removed bad rebase code and added additional test

* [@spackbot] updating style on behalf of sparkyniner

* added line removed earlier

* added line removed earlier

* replaced function

* added more recommended changes

Co-authored-by: sairaj <sairaj@sairajs-MacBook-Pro.local>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2022-08-20 16:09:44 -06:00
Harmen Stoppels
2daea9e4b4
docs: add a note about an issue being solved on develop (#32261) 2022-08-19 12:40:41 +00:00
psakievich
abf847ce82
Add messages to assertions in asp.py (#32237)
Assertions without messages if/when hit create a blank error message for users.  

This PR adds error messages to all assertions in asp.py even
if it seems unlikely they will ever be needed.
2022-08-19 14:15:25 +02:00
Massimiliano Culpo
605d72133b
spack.util.package_hash: parametrize unit-tests (#32240)
* spack.util.package_hash: parametrize unit-tests

* Fix comment
2022-08-18 18:17:43 -07:00
Massimiliano Culpo
3c6b5b8afc
Remove unused argument in test fixture (#32236)
The argument is very likely a typo, and was meant to
be given to the fixture decorator. Since the value
being passed is the default, let's just remove it.
2022-08-18 10:22:50 -07:00
Massimiliano Culpo
9d55a0436b
spec: fix typo in Spec._finalize_concretization (#32210) 2022-08-18 15:04:08 +02:00
Tom Scogland
b9e57006c9
bugfix: use cmake version from dependency (#31739)
Ensure that build tools with module-level commands in spack use
the version built as part of their build graph if one exists.
This is now also required for mesa, scons, cmake and ctest, out
of graph versions of these tools in path will not be found unless
added as an external.

This bug appeared because a new version of rocprim needs cmake
3.16, while I have 3.14 in my path I had added an external for
cmake 3.20 to the dag, but 3.14 was still used to configure
rocprim causing it to fail. As far as I can tell, all the build
tools added in build_environment.py had this problem, despite the
fact that they should have been resolving these tools by name
with a path search and find the one in the dag that way. I'm
still investigating why the path searching and Executable logic
didn't do it, but this makes three of the build systems much more
explicit, and leaves only gmake and ninja as dependencies from
out in the system while ensuring the version in the dag is used
if there is one.

The additional sqlite version is to perturb the hash of python to
work around a relocation bug which will be fixed in a subsequent
PR.
2022-08-17 17:54:17 -07:00
Peter Scheibel
546c8a3092 Add c++14 support flag for xl compiler (#31826) 2022-08-17 13:57:13 +02:00
Wouter Deconinck
8f34a3ac5c
filesystem: in recursive mtime, check only files that exist (#32175)
* filesystem: use lstat in recursive mtime

When a `develop` path contains a dead symlink, the `os.stat` in the recursive `mtime` determination trips up over it.

Closes #32165.
2022-08-16 21:06:31 +00:00
Todd Gamblin
7e1890772c bugfix: silence clingo warning about requirement_policy/3
`requirement_policy/3` is generated and may not be in Spack's inputs to Clingo.
Currently this is causing warnings like:

```
$ spack spec zlib
/global/u2/t/tgamblin/src/spack/lib/spack/spack/solver/concretize.lp:510:3-43: info: atom does not occur in any rule head:
  requirement_policy(Package,X,"one_of")

/global/u2/t/tgamblin/src/spack/lib/spack/spack/solver/concretize.lp:517:3-43: info: atom does not occur in any rule head:
  requirement_policy(Package,X,"one_of")

/global/u2/t/tgamblin/src/spack/lib/spack/spack/solver/concretize.lp:523:3-43: info: atom does not occur in any rule head:
  requirement_policy(Package,X,"any_of")

/global/u2/t/tgamblin/src/spack/lib/spack/spack/solver/concretize.lp:534:3-43: info: atom does not occur in any rule head:
  requirement_policy(Package,X,"any_of")

Input spec
--------------------------------
zlib

Concretized
--------------------------------
zlib@1.2.11%gcc@7.5.0+optimize+pic+shared arch=cray-sles15-haswell
```

- [x] Silence warning with `#defined requirement_policy/3`
2022-08-16 12:56:37 -07:00
Peter Scheibel
8281a0c5fe
Configuration: allow users to enforce hard spec constraints (#27987)
Spack doesn't have an easy way to say something like "If I build
package X, then I *need* version Y":

* If you specify something on the command line, then you ensure
  that the constraints are applied, but the package is always built
* Likewise if you `spack add X...`` to your environment, the
  constraints are guaranteed to hold, but the environment always
  builds the package
* You can add preferences to packages.yaml, but these are not
  guaranteed to hold (Spack can choose other settings)

This commit adds a 'require' subsection to packages.yaml: the
specs added there are guaranteed to hold. The commit includes
documentation for the feature.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2022-08-16 11:44:30 -07:00
Peter Scheibel
4c2f357f0e
CI/documentation: constrain pygments to avoid latest version (2.13.0) (#32163)
All PRs are failing the docs build on account of an error with
pygments. These errors coincide with a new release of pygments
(2.13.0) and restricting to < 2.13 allows the doc tests to pass,
so this commit enforces that constraint for the docs build.

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2022-08-15 18:00:33 -07:00
Massimiliano Culpo
2131bd7e8c
Check that no reserved names are overridden by package recipes (#32092)
A few attribute in packages are meant to be reserved for
Spack internal use. This audit checks packages to ensure none
of these attributes are overridden.

- [x] add additional audit check
2022-08-15 16:31:10 -07:00
renjithravindrankannath
08e75f7a3e
rocm: add v5.2 for the entire stack (#31591) 2022-08-12 09:20:47 +02:00
Massimiliano Culpo
1913dc2da3
Fix performance regression with spack mirror create --all (#32005)
This PR fixes the performance regression reported in #31985 and a few
other issues found while refactoring the spack mirror create command.

Modifications:

* (Primary) Do not require concretization for
  `spack mirror create --all`
* Forbid using --versions-per-spec together with --all
* Fixed a few issues when reading specs from input file (specs were
  not concretized, command would fail when trying to mirror
  dependencies)
* Fix issue with default directory for spack mirror create not being
  canonicalized
* Add more unit tests to poke spack mirror create
* Skip externals also when mirroring environments
* Changed slightly the wording for reporting (it was mentioning
  "Successfully created" even in presence of errors)
* Fix issue with colify (was not called properly during error
  reporting)
2022-08-11 16:51:01 -07:00
Chris White
8c23545a3a
CachedCMakePackage: Port over logic from CMake build system for ldlibs and ldflags (#31750)
* port over logic from cmake build system for ldlibs and ldflags

* follow new style standards

* escape quotes

* escape quotes

* nevermind going back
2022-08-11 14:55:43 -07:00
Harmen Stoppels
ceda5fb46c
Don't set LD_LIBRARY_PATH by default on Linux (#28354)
`LD_LIBRARY_PATH` can break system executables (e.g., when an enviornment is loaded) and isn't necessary thanks to `RPATH`s.  Packages that require `LD_LIBRARY_PATH` can set this in `setup_run_environment`.

- [x] Prefix inspections no longer set `LD_LIBRARY_PATH` by default
- [x] Document changes and workarounds for people who want `LD_LIBRARY_PATH`
2022-08-11 09:33:08 -05:00
Chris Green
46c8962e91
Add missing info to diagnostic for circular provides (#32027) 2022-08-11 14:20:17 +02:00
Tamara Dahlgren
f96b54b0a6
info: properly report default when for overridden variants (#32040) 2022-08-11 14:09:53 +02:00
Richarda Butler
ef818339db
Update tests so /tmp/store can be accessed (#32003) 2022-08-10 20:53:48 +00:00
Mikael Simberg
f237e669f2
Patch /usr/bin/file to file when on nixos (#30718)
These changes make many packages build on nixos where nearly nothing
comes from /bin or /usr/bin (the only things in "system locations" are
/bin/sh and /usr/bin/env, all the rest is found through PATH).

Many configuration scripts hardcode /usr/bin/file instead of using the
one from PATH. This patches them to use file from PATH.
2022-08-10 17:54:09 +02:00
Seth R. Johnson
5d6ab9a76c
core: add a helpful long message for UnknownPackageError (#31996)
```
Error: Package 'armpl' not found.
```
is pretty useless after an upgrade unless you're a spack pro. I've
recently hit this on multiple machines. See
https://github.com/spack/spack/issues/31453 ,
https://github.com/spack/spack/issues/31489  .
2022-08-10 11:01:07 +02:00
Harmen Stoppels
857a798aed
modules: add missing Python imports (#32012) 2022-08-10 10:00:33 +02:00
Tamara Dahlgren
3320c983a7
Reduce installation noise: filter path padding and make some details debug level 2 (#31998) 2022-08-09 19:22:09 +02:00
Adam J. Stewart
d29d5462c6
PythonPackage: add --config-settings support (#31823) 2022-08-09 10:09:51 -07:00
Harmen Stoppels
f53b522572
Add base class for directory visitor (#32008) 2022-08-09 15:43:30 +02:00
Massimiliano Culpo
b61187455a
Update release procedure, keep CHANGELOG up-to-date (#31969)
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2022-08-09 12:10:49 +00:00
Massimiliano Culpo
65a4125dd0
spack mirror: skip non-concretizable specs (#31897)
fixes #31736

Catch errors when concretizing specs and report them as
debug messages. The corresponding spec is skipped.

Co-authored-by: Greg Becker <becker33@llnl.gov>
2022-08-05 19:19:51 +02:00
Massimiliano Culpo
5bf6b7e6a5
Refactor cmd/install.py for better readability (#31936)
* Extracted two functions in cmd/install.py

* Extracted a function to perform installation from the active environment

* Rename a few functions, remove args from their arguments

* Rework conditional in install_from_active_environment to reduce nesting in the function

* Extract functions to parsespecs from cli and files

* Extract functions to getuser confirmation for overwrite

* Extract functions to install specs inside and outside environments

* Rename a couple of functions

* Fix outdated comment

* Add missing imports

* Split conditional to dedent one level

* Invert check and exit early to dedent one level when requiring user confirmation
2022-08-05 12:36:33 +02:00
psakievich
ddc373b4e1
Fix doc format for code blocks: GitRef versions (#31937)
Rendering was not pretty using `console` from #31914
2022-08-05 02:01:03 +00:00
Chris Green
20de47a1e2
Move type hint to satisfy Python 3.6, 3.7 interpreters (#31932) 2022-08-04 20:48:05 +00:00
psakievich
d67ead5978
Add documentation for git refs as versions (#31914)
* document git commit versions

Include documentation for manually specifying associated known version

* document spack develop command

Co-authorerd-by: psakievich <psakiev@sandia.gov>
Co-authored-by: Gregory Becker <becker33@llnl.gov>
Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2022-08-04 13:20:33 -07:00
psakievich
3b1401f292
Git Ref versions can be paired to defined versions in the spec (#30998)
The current use of git ref's as a version requires a search algorithm to pick the right matching version based on the tags in the git history of the package.

This is less than ideal for the use case where users already know the specific version they want the git ref to be associated with. This PR makes a new version syntax [package]@[ref]=[version] to allow the users to specify the exact hash they wish to use.
2022-08-04 13:17:34 -07:00
Massimiliano Culpo
0e40804cd0
Deprecate support for Python 3.5 (by removing it from CI) (#31908)
* Deprecate support for Python 3.5 (by removing it from CI)

* Restore Python 3.9
2022-08-04 15:26:56 +02:00
Massimiliano Culpo
9a48035e49 asp: refactor low level API to permit the injection of configuration
This allows writing extension commands that can benchmark
different configurations in clingo, or try different
configurations for a single test.
2022-08-03 18:01:08 -07:00
dunatotatos
ab87cac63f
Match documentation of spack create with actual behavior. (#31892) 2022-08-03 10:38:56 +00:00
Jonathon Anderson
8c50ea9dc0
spack ci rebuild: Don't install in a login shell (#31771)
On some systems the shell in login mode wipes important parts of the
environment, such as PATH. This causes the build to fail since it can't
find `spack`.

For better robustness, don't use a login shell.

In a full CI job the final spack install is run in an environment formed by scripts running in this order:

export AWS_SECRET=...                  # 1. Load environment from GitLab project variables
source spack/share/spack/setup-env.sh  # 2. Load Spack into the environment (PATH)
spack env activate -V concrete_env     # 3. Activate the concrete environment
source /etc/profile                    # 4. Bash login shell (from -l)
spack install ...
Whereas when a user launches their own container with (docker|podman) run -it, they end up running spack install in an environment formed in this order:

source /etc/bash.bashrc                # (not 4). Bash interactive shell (default with TTY)
export AWS_SECRET=...                  #~1. Manually load environment from GitLab project variables
source spack/share/spack/setup-env.sh  # 2. Load Spack into the environment (PATH)
spack env activate -V concrete_env     # 3. Activate the concrete environment
spack install ...
The big problem being that (4) has a completely different position and content (on Leap 15 and possibly other containers).

So in context, this PR removes (4) from the CI job case, leaving us with the simpler:

export AWS_SECRET=...                  # 1. Load environment from GitLab project variables
source spack/share/spack/setup-env.sh  # 2. Load Spack into the environment (PATH)
spack env activate -V concrete_env     # 3. Activate the concrete environment
spack install ...
2022-08-02 11:45:50 -07:00
Massimiliano Culpo
6e0b7959a4
Optimize reuse from buildcaches (#30806)
* database: don't sort on return from query_local

* ASP-based solver: don't build the hash-lookup dictionary twice

Building this dictionary twice and traversing all the specs
might be time-consuming for large buildcaches.
2022-08-02 11:43:14 -07:00
Massimiliano Culpo
aeac72e1e3 Style fixes 2022-08-02 10:52:52 -07:00
Massimiliano Culpo
0b832b2929 Remove line that sets non-existing attribute? 2022-08-02 10:52:52 -07:00