Commit graph

5782 commits

Author SHA1 Message Date
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
Massimiliano Culpo
2b3f350071 Use __slots__ for fast attribute access 2022-08-02 10:52:52 -07:00
Massimiliano Culpo
b6c8779772 Use __slots__ for fast attribute access during parsing 2022-08-02 10:52:52 -07:00
Harmen Stoppels
57e6452831
Document that reuse is higher priority than preferences in packages.yaml (#31864)
Resurrect Known issues, since users ask frequently about that.
2022-08-02 18:54:41 +02:00
Todd Gamblin
415ac29665
docs: Fix outdated pre-0.18 text on build dependencies (#31860) 2022-08-02 11:34:58 +00:00
Adam J. Stewart
22d4612d94
Add meson Python build backend (#31809) 2022-08-02 07:55:41 +02:00
Adam J. Stewart
1a61252c64
spack checksum: black compliance (#31851) 2022-08-02 07:29:30 +02:00
Peter Scheibel
c0ede0e0fa
Add c++14 support flag for xl compiler (#31826) 2022-08-01 22:51:02 +00:00
Adam J. Stewart
f018b869e6
Add support for macOS Ventura (#31812) 2022-08-01 16:45:56 +00:00
Adam J. Stewart
c98d367a91
CUDA: add new GCC conflict (#31820) 2022-08-01 14:31:07 +00:00
Todd Gamblin
ab04d697c7 tests: remove old changed_files() test
This test relied on an old version of the `flake8_package` fixture that modified
the spack repository, but it doesn't do that anymore. There are other tests for
`changed_files()` that do a better job of mocking up a git repository with
changes, so we can just delete this one.
2022-07-31 21:01:02 -07:00
Todd Gamblin
143f3f830c style: simplify arguments with --tool TOOL and --skip TOOL
`spack style` tests were annoyingly brittle because we could not easily be
specific about which tools to run (we had to use `--no-black`, `--no-isort`,
`--no-flake8`, and `--no-mypy`). We should be able to specify what to run OR
what to skip.

Now you can run, e.g.:

    spack style --tool black,flake8

or:

    spack style --skip black,isort

- [x] Remove  `--no-black`, `--no-isort`, `--no-flake8`, and `--no-mypy` args.
- [x] Add `--tool TOOL` argument.
- [x] Add `--skip TOOL` argument.
- [x] Allow either `--tool black --tool flake8` or `--tool black,flake8` syntax.
2022-07-31 13:29:20 -07:00
Todd Gamblin
76b190a624 black: ensure that spack create templates are black-compliant
- [x] remove alignment spaces from tempaltes
- [x] replace single with double quotes
- [x] Makefile template now generates parsable code
      (function body is `pass` instead of just a comment)
- [x] template checks now run black to check output
2022-07-31 13:29:20 -07:00
Todd Gamblin
b87ca6da27 black: do not align sha56's with spaces in spack checksum output 2022-07-31 13:29:20 -07:00
Todd Gamblin
357968469e black: bootstrap if black in PATH is too new
Previously we'd accept any version for bootstrapping black, but we need <= 21.

- [x] modify bootstrapping code to check black version before accepting an
      executable from `PATH`.
2022-07-31 13:29:20 -07:00
Todd Gamblin
f27eeaa2e8 black: add .git-blame-ignore-revs toignore black reformatting in blame
- [x] add `.git-blame-ignore-revs` to ignore black reformatting
- [x] make `spack blame` respect `.git-blame-ignore-revs`
      (even if the user hasn't configured git to do so)
2022-07-31 13:29:20 -07:00
Todd Gamblin
c661ca248b black: fix format-sensitive tests
Some of our tests rely on single vs. double quotes, and others rely on specific
line numbers in the source. These needed fixing after the switch to Black.
2022-07-31 13:29:20 -07:00
Todd Gamblin
f52f6e99db black: reformat entire repository with black 2022-07-31 13:29:20 -07:00
Todd Gamblin
549ba1ed32 black: fix style check package and flake8 formatting for black
Black will automatically fix a lot of the exceptions we previously allowed for
directives, so we don't need them in our custom `flake8_formatter` anymore.

- [x] remove `E501` (long line) exceptions for directives from `flake8_formatter`,
      as they won't help us now.
- [x] Refine exceptions for long URLs in the `flake8_formatter`.
- [x] Adjust the mock `flake8-package` to exhibit the exceptions we still allow.
- [x] Update style tests for new `flake8-package`.
- [x] Blacken style test.
2022-07-31 13:29:20 -07:00
Todd Gamblin
156af2a60a black: clean up noqa comments from most of the code
Many noqa's in the code are no longer necessary now that the column limit is 99
characters. Others can easily be eliminated, and still more can just be made more
specific if they do not have to do with line length.

The only E501's still in the code are in the tests for `spack.util.path` and the tests
for `spack style`.
2022-07-31 13:29:20 -07:00
Todd Gamblin
3fa090f490 black: break up long strings that black cannot fix 2022-07-31 13:29:20 -07:00
Todd Gamblin
67d27841ae black: configuration
This adds necessary configuration for flake8 and black to work together.

This also sets the line length to 99, per the data here:

* https://github.com/spack/spack/pull/24718#issuecomment-876933636

Given the data and the spirit of black's 88-character limit, we set the limit to 99
characters for all of Spack, because:

* 99 is one less than 100, a nice round number, and all lines will fit in a
  100-character wide terminal (even when the text editor puts a \ at EOL).
* 99 is just past the knee the file size curve for packages, and it means that packages
  remain readable and not significantly longer than they are now.
* It doesn't seem to hurt core -- files in core might change length by a few percent but
  seem like they'll be mostly the same as before -- just a bit more roomy.

- [x] set line length to 99
- [x] remove most exceptions from `.flake8` and add the ones black cares about
- [x] add `[tool.black]` to `pyproject.toml`
- [x] make `black` run if available in `spack style --fix`

Co-Authored-By: Tom Scogland <tscogland@llnl.gov>
2022-07-31 13:29:20 -07:00
Adam J. Stewart
ec87924039
MACOSX_DEPLOYMENT_TARGET: MAJOR.MINOR (#31811) 2022-07-30 02:12:02 +00:00
Harmen Stoppels
e4f0f3582e
environment.py: only install root specs explicitly (#31645) 2022-07-28 12:16:35 -07:00
Stephen Sachs
584cc47fb3
Fix parsing of clean_url (#31783)
In #31618 the idea was to determine the file extension heuristically by dropping query params etc from a url and then consider it as a file path. That broke for URLs that only have query params like http://example.com/?patch=x as it would result in empty string as basename. This PR reverts to the old behavior of saving files as ?patch=x in that case.

Co-authored-by: Stephen Sachs <stesachs@amazon.com>
2022-07-28 09:24:19 +00:00
Harmen Stoppels
ce039e4fa5
environment.py: reduce # of locks further (#31643)
* environment.py: reduce # of locks further
2022-07-26 09:00:27 -07:00
Harmen Stoppels
e2056377d0
containerize: fix concretization -> concretizer (#31594)
* containerize: fix concretization -> concretizer

* fix test
2022-07-26 08:56:24 -07:00
Chuck Atkins
f38a2ebb25
llvm: Variant and dependency cleanup (#31331)
* llvm: Use variant when clauses for many of the expressed conflicts

* llvm: Remove the shared variant as it wasn't really used

* llvm: Remove unnecessary deps and make explicit the ones that are

* llvm: Cleanup patch conditions

* pocl: Update for llvm cleanup

* unit-test: update unparse package hash with the updated llvm package

* llvm: Fix ppc long double patching and add clarifying comments
2022-07-26 10:45:20 -05:00
Stephen Sachs
6a240c9b39
Fix self.extension for symlinks (#31743)
`self.archive_file` is (among others) a symlink to a tarball. `extension()` on a
symlink will result in no extension. This patch fixes the behavior introduced in
https://github.com/spack/spack/pull/31618.

Co-authored-by: Stephen Sachs <stesachs@amazon.com>
2022-07-26 13:05:41 +00:00
Harmen Stoppels
b56871dd9c
Fix stage with uri params (#31618)
* don't determine extension of a url

* parse url to drop query params from filename
2022-07-25 10:31:13 +02:00
Adam J. Stewart
5850afc9dc
Sphinx 5.1.0 breaks doc builds (#31709) 2022-07-24 21:45:01 +00:00
Harmen Stoppels
fce861d2ac
Mark external as explicit only when installing explicitly (#31665) 2022-07-22 15:20:17 +02:00
Harmen Stoppels
799553d302
autotools: add -I flag when non-standard libtool (#31677)
When
1. Spack installs libtool,
2. system libtool is installed too, and
3. system automake is used

Spack passes system automake's `-I <prefix>` flag to itself, even though
it's a default search path. This takes precedence over spack's libtool
prefix dir. This causes the wrong `libtool.m4` file to be used (since
system libtool is in the same prefix as system automake).

And that leads to error messages about incompatible libtool, something
something LT_INIT.
2022-07-22 15:11:38 +02:00
Massimiliano Culpo
5cf7bf3770
Use pkg_cls in spack.mirror.get_all_versions (#31636)
fixes #31627

spack.mirror.get_all_versions now uses the package class
instead of the package object in its implementation.

Ensure spec is concrete before staging for mirrors
2022-07-22 10:04:17 +02:00
psakievich
22798d7540
Don't restage develop specs when a patch fails (#31593)
* make develop specs not restage when a patch fails
* add a unit test
2022-07-20 13:55:16 -07:00
Harmen Stoppels
e7be8dbbcf
spack stage: add missing --fresh and --reuse (#31626) 2022-07-20 13:50:56 +02:00
Harmen Stoppels
e3aca44601
installer.py: require "explicit: True" in the install arguments to mark a package "explicit" (#31646) 2022-07-20 12:09:45 +02:00
Jonathon Anderson
117c7cc3db
Only hack botocore when needed (#31610)
Newer versions of botocore (>=1.23.47) support the full IOBase
interface, so the hacks added to supplement the missing attributes are
no longer needed. Conditionally disable the hacks if they appear to be
unnecessary based on the class hierarchy found at runtime.
2022-07-18 08:40:13 +02:00
Harmen Stoppels
6f8d7390f1
Use lexists instead of exists during fetch (#31509) 2022-07-15 18:43:14 +02:00
Joseph Snyder
64b41b012c
Bug/fix credentials s3 buildcache update (#31391)
* Add connection information to buildcache update command

Ensure that the s3 connection made when attempting to update the content
of a buildcache attempts to use the extra connection information
from the mirror creation.

* Add unique help for endpoint URL argument

Fix copy/paste error for endpoint URL help which was the same as
the access token

* Re-work URL checking for S3 mirrors

Due to the fact that nested bucket URLs would never match the string used
for checking that the mirror is the same, switch the check used.

Sort all mirror URLs by length to have the most specific cases first
and see if the desired URL "starts with" the mirror URL.

* Long line style fixes

Add execptions for long lines and fix other style errors

* Use format() function to rebuild URL

Use the format command to rebuild the url instead of crafing a
formatted string out of known values

* Add early exit for URL checking

When a valid mirror is found, break from the loop
2022-07-14 20:49:46 +00:00
Todd Gamblin
3d0347ddd3
Deprecate blacklist/whitelist in favor of include/exclude (#31569)
For a long time the module configuration has had a few settings that use
`blacklist`/`whitelist` terminology. We've been asked by some of our users to replace
this with more inclusive language. In addition to being non-inclusive, `blacklist` and
`whitelist` are inconsistent with the rest of Spack, which uses `include` and `exclude`
for the same concepts.

- [x] Deprecate `blacklist`, `whitelist`, `blacklist_implicits` and `environment_blacklist`
      in favor of `exclude`, `include`, `exclude_implicits` and `exclude_env_vars` in module
      configuration, to be removed in Spack v0.20.
- [x] Print deprecation warnings if any of the deprecated names are in module config.
- [x] Update tests to test old and new names.
- [x] Update docs.
- [x] Update `spack config update` to fix this automatically, and include a note in the error
      that you can use this command.
2022-07-14 20:42:33 +00:00
Peter Scheibel
7741bfb7d1
Decompression: use tar exe vs. built-in Python tarfile support (#31563)
Python's built-in tarfile support doesn't address some general
cases of malformed tarfiles that are already handled by the system
'tar' utility; until these can be addressed, use that exclusively.
2022-07-13 14:12:21 -07:00
Massimiliano Culpo
7f2b5e8e57
spack.repo.get() can only be called on concrete specs (#31411)
The goal of this PR is to make clearer where we need a package object in Spack as opposed to a package class.

We currently instantiate a lot of package objects when we could make do with a class.  We should use the class
when we only need metadata, and we should only instantiate and us an instance of `PackageBase` at build time.

Modifications:
- [x] Remove the `spack.repo.get` convenience function (which was used in many places, and not really needed)
- [x] Use `spack.repo.path.get_pkg_class` wherever possible
- [x] Try to route most of the need for `spack.repo.path.get` through `Spec.package`
- [x] Introduce a non-data descriptor, that can be used as a decorator, to have "class level properties"
- [x] Refactor unit tests that had to be modified to reduce code duplication
- [x] `Spec.package` and `Repo.get` now require a concrete spec as input
- [x] Remove `RepoPath.all_packages` and `Repo.all_packages`
2022-07-12 19:45:24 -04:00
Harmen Stoppels
ea91e8f4ca
file_cache.py: idempotent remove without races (#31477)
There's a race condition in `remove()` as the lockfile is removed after
releasing the lock, which is a problem when another process acquires a
write lock during deletion.

Also simplify life a bit in multiprocessing when a file is possibly
removed multiple times, which currently is an error on the second
deletion, so the proposed fix is to make remove(...) idempotent and not
error when deleting non-existing cache entries.

Don't tests for existence of lockfile, cause windows/linux behavior is different
2022-07-12 15:03:48 +00:00
Harmen Stoppels
74e2625dcf
compression.py: buffered copy (#31533) 2022-07-12 16:49:59 +02:00
Harmen Stoppels
b2c519470b
environment.py: only acquire write lock when necessary (#31493) 2022-07-12 16:12:43 +02:00
Harmen Stoppels
d904a789d5
env depfile: add missing touch (#31494)
Oversight in #31433, the non-phony `env` target was missing a file being
created for it, which can cause make to infinitely loop when including
multiple generated makefiles.
2022-07-12 14:16:31 +02:00
Massimiliano Culpo
89b8d33d05
Remove os.getcwd from function signature (#31480)
fixes #29730

This is also wrong since it binds the directory at the time
of module import, rather than the one at the time of function
call.
2022-07-12 10:08:37 +02:00
Jonathon Anderson
25f198aa91
Sanitize ownership when extracting tarfiles (#31524) 2022-07-12 09:28:24 +02:00
Adam J. Stewart
5bd1074afb
py-hatchling: add new packages, document new build backend (#31512)
* py-hatchling: add new package, document new build backend

* Minor doc changes

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

Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
2022-07-11 16:23:28 -07:00
Cory Bloor
bb92ea59a2
Fix spack edit message when no editor installed (#31412)
When no default editor is installed and no environment variable is set,
which_string would return None and this would be passed to os.execv
resulting in a TypeError. The message presented to the user would be:

    Error: execv: path should be string, bytes or os.PathLike,
    not NoneType

This change checks that which_string has returned successfully before
attempting to execute the result, resulting in a new error message:

    Error: No text editor found! Please set the VISUAL and/or EDITOR
    environment variable(s) to your preferred text editor.

It's not strictly necessary, but I've also changed try_exec to catch
all errors rather than just OSErrors. This would have provided slightly
more context for the original error message.
2022-07-07 17:08:15 +02:00
Tamara Dahlgren
1b919d306f
Documentation: Add SourceforgePackage to the build systems docs (#31473) 2022-07-07 14:30:22 +02:00
Vanessasaurus
6b1e86aecc
removing feature bloat: monitor and analyzers (#31130)
Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2022-07-07 00:49:40 -06:00
Tamara Dahlgren
e68ed3268b
Testing Bugfix: refactor clean --python-cache to support all (#31449)
There were two choices: 1) remove '-p' from '-a' or 2) allow monkeypatching
the cleaning of the python cache since clean's test_function_calls isn't
supposed to be actually cleaning anything.

This commit supports the latter and adds a test case for `-p`.
2022-07-06 11:44:41 -07:00
Harmen Stoppels
dac31ef3c4
Remove fetch from depfile (#31433) 2022-07-05 14:48:32 +02:00
Alberto Invernizzi
bb3a663392
ROCmPackage: unify amdgpu_targets (#30582)
* unify amdgpu_targets for rocsolver and rocblas

* add more archs

* adapt all roc packages to unified amdgpu_targets
2022-07-05 14:33:30 +02:00
Scott Wittenburg
87b8321fa9
gitlab: Fix pipeline generation for non-develop protected pipelines (#31378)
Release branches and tags run protected pipelines, and we noticed
that those pipelines were generating all jobs in the stack, even
when the mirror contained all the built specs and an up to date
index.  The problem was caused because the override mirror was
not present in spacks mirror configuration at the time when the
binary_distribution.update() method was called.  This fixes that
by always adding the mirror override, if present, to the list of
configured mirrors.
2022-07-01 11:56:36 -07:00
Peter Scheibel
abeee9e1fd
Cray manifest: compiler duplicates (#31173)
* remove unhelpful comment
* Filter compiler duplicates while reading manifest
* more-specific version matching edited to use module-specific version (to avoid an issue where a user might add a compiler with the same version to the initial test configuration
2022-06-29 17:05:29 -07:00
Adam J. Stewart
93c16f1ee3
PythonPackage: add default libs/headers attributes (#28527)
* PythonPackage: add default libs/headers attributes

* Style fix

* libs and headers should be properties

* Check both platlib and include

* Fix variable reference
2022-06-29 11:55:24 -07:00
Massimiliano Culpo
557abe04ec
Update containerize templates to account for view indirection (#31321)
fixes #30965
2022-06-29 15:39:18 +02:00
Wouter Deconinck
8f7f96ae2b
oneAPI supports cxx17_flag and cxx20_flag (#31274) 2022-06-28 10:33:19 +02:00
Greg Becker
df44045fdb
Feature: use git branches/tags as versions (#31200)
Building on #24639, this allows versions to be prefixed by `git.`. If a version begins `git.`, it is treated as a git ref, and handled as git commits are starting in the referenced PR.

An exception is made for versions that are `git.develop`, `git.main`, `git.master`, `git.head`, or `git.trunk`. Those are assumed to be greater than all other versions, as those prefixed strings are in other contexts.
2022-06-28 01:54:41 +00:00
Sergey Kosukhin
7fc68240fe
oneapi-* packages: improve use with modules (#30981)
This commit adds some changes which improve use of Spack-installed
oneAPI packages with Spack-generated modules, but not within Spack
(e.g. if you install some of these packages with Spack, then load
their associated modules to build other packages outside of Spack).

The majority of the PR diff is refactoring. The functional changes
are:

* intel-oneapi-mkl:
  * setup_run_environment: update Intel compiler flags to RPATH the
    mkl libs
* intel-oneapi-compilers: update the compiler configuration to RPATH
  libraries installed by this package (note that Spack already handled
  this when installing dependent packages with Spack, but this is
  specifically to use the intel-oneapi-compilers package outside
  of Spack). Specifically:
  * inject_rpaths: this modifies the binaries installed as part of
    the intel-oneapi-compilers package to RPATH libraries provided
    by this package
  * extend_config_flags: this instructs the compiler executables
    provided by this package to RPATH those same libraries

Refactoring includes:

* intel-oneapi-compilers: in addition to the functional changes,
  a large portion of this diff is reorganizing the creation of
  resources/archives downloaded for the install
* The base oneAPI package renamed component_path, so several packages
  changed as a result:
  * intel-oneapi-dpl
  * intel-oneapi-dnn
  * extrae
* intel-oneapi-mpi:
  * Perform file filtering in one pass rather than two
2022-06-27 16:34:15 -07:00
Peter Scheibel
f7ef064bdc
spack external find: handle manifest with bad permissions (#31201)
Allow `spack external find` (with no extra args) to proceed if the manifest file exists but
without sufficient permissions; in that case, print a warning. Also add a test for that behavior.

TODOs:

- [x] continue past any exception raised during manifest parsing as part of `spack external find`, 
      except for CTRL-C (and other errors that indicate immediate program termination)
- [x] Semi-unrelated but came up when discussing this with the user who reported this issue to
      me: the manifest parser now accepts older schemas 

See: https://github.com/spack/spack/issues/31191
2022-06-27 19:26:12 +00:00
Massimiliano Culpo
11d71ca85e
Rename os_facts.lp to os_compatibility.lp (#31206)
Follow-up from #31170
2022-06-27 09:15:25 -07:00
Cody Balos
147f39d7aa
Fix typo in documentation note about concretizer:unify (#31246) 2022-06-24 11:31:43 +02:00
Massimiliano Culpo
70650cacbd
ASP-based solver: rescale target weights so that 0 is always the best score (#31226)
fixes #30997

Instead of giving a penalty of 30 to all nodes when preferences
are not package specific, give a penalty of 100 to all targets
of a node where we have package specific preferences, if the target
is not explicitly preferred.
2022-06-23 23:33:36 -07:00
eugeneswalker
7ef52acfce
relocation: x-pie-executable needs relocation (#31248) 2022-06-22 23:55:28 +00:00
Adam J. Stewart
ef278c601c
spack create: fix for no URL (#31239) 2022-06-22 18:45:03 +00:00
Massimiliano Culpo
55cac3b098
Remove update functions used to ease the transition in v0.16 (#31216) 2022-06-22 11:15:57 +02:00
Massimiliano Culpo
649760dc1a
Canonicalize positional argument to spack bootstrap mirror (#31180)
fixes #31139
2022-06-21 19:25:01 +02:00
Massimiliano Culpo
aebb601b70
Stricter compatibility rules for OS and compiler when reusing specs (#31170)
* Stricter compatibility rules for OS and compiler when reusing specs
* Add unit test
2022-06-20 17:32:13 -07:00
Christian Goll
0fe57962b3
OpenSUSE Tumbleweed: use GLIBC version as distro version (#19895)
Tumbleweed is a rolling release that would have used a date 
as a version instead.
2022-06-20 22:20:31 +02:00
Sam Broderick
760a12c440
Fix request for bzip2, since bzip was pulled due to patent issues (#31198) 2022-06-20 08:13:20 +00:00
Brian Van Essen
15c35a3cff
Bugfix external find --all for libraries (#31186)
* Fixed a bug in the 'external find --all' command where the call failed
to find packages by both executable and library. The bug was that the
call `path.all_packages()` incorrectly turned the variable
`packages_to_check` into a generator rather than keeping it a list.
Thus the second call to `detection.by_library` had no work to do.

* Fixed the help message for the find external and compiler commands as
well as others that used the `scopes_metavar` field to define where
the results should be stored in configuration space.  Specifically,
the fact that configuration could be added to the environment was not
mentioned in the help message.
2022-06-17 21:52:06 +00:00
Massimiliano Culpo
13b609b4b6
docs: quote string to show valid YAML (#31178)
fixes #31167
2022-06-17 18:25:52 +02:00
Chuck Atkins
85dc20cb55
Spec: Add a new virtual-customizable home attribute (#30917)
* Spec: Add a new virtual-customizable home attribute

* java: Use the new builtin home attribute

* python: Use the new builtin home attribute
2022-06-17 10:29:08 -04:00
Robert Cohn
466572dc14
Update Intel package descriptions (#31150) 2022-06-17 09:23:40 +02:00
Massimiliano Culpo
267358a799
ASP-based solver: fix rules on version weights selection (#31153)
* ASP: sort and deduplicate version weights from installed specs

* Pick version weights according to provenance

* Add unit test
2022-06-16 14:17:40 -07:00
Peter Scheibel
392b548312
Manifest parsing: avoid irrelevant files (#31144)
* Manifest directory may not contain manifest files: exclude non-manifest files
* Manifest files use different name for rocmcc: add translation for it
2022-06-16 15:16:48 -05:00
Massimiliano Culpo
895ceeda38
concretize.lp: impose a lower bound on the number of version facts if a solution exists (#31142)
* concretize.lp: impose a lower bound on the number of version facts if a valid version exists

fixes #30864

* Add a unit test
2022-06-16 09:25:56 -07:00
Tom Scogland
b261b2a5ff
Allow bootstrapping to work when partial or incompatible modules exist in the module path (#31035) 2022-06-15 19:09:07 +02:00
G-Ragghianti
bf6220821b
Make the IntelPackage fail successfully (#30773)
Co-authored-by: Robert Cohn <rscohn2@gmail.com>
2022-06-14 15:06:06 +02:00
Jordan Galby
e50d08ce48
Fix spack style arbitrary git rev as base (#31019)
Allow `spack style -b @` or `spack style -b origin/develop` to work as
expected.

Regression since spack 0.17 #25085
2022-06-13 15:22:35 +00:00
Danny McClanahan
0c7fd9bd8c
fix doubly shell quoting args to spack spec (#29282)
* add test to verify fix works
* fix spec cflags/variants parsing test (breaking change)
* fix `spack spec` arg quoting issue
* add error report for deprecated cflags coalescing
* use .group(n) vs subscript regex group extraction for 3.5 compat
* add random test for untested functionality to pass codecov
* fix new test failure since rebase
2022-06-11 12:35:46 -07:00
Todd Gamblin
bf2b30a5f5
bugfix: preserve dict order for Spec.dag_hash() in Python 2 (#31092)
Fix a bug introduced in #21720. `spack_json.dump()` calls `_strify()` on dictionaries to
convert `unicode` to `str`, but it constructs `dict` objects instead of
`collections.OrderedDict` objects, so in Python 2 (or earlier versions of 3) it can
scramble dictionary order.

This can cause hashes to differ between Python 2 and Python 3, or between Python 3.7
and earlier Python 3's.

- [x] use `OrderedDict` in `_strify`
- [x] add a regression test
2022-06-10 20:32:35 -07:00
Sergey Kosukhin
a2afd5b82f
clingo: fix string formatting in error messages (#31084) 2022-06-10 16:24:27 +00:00
Tim Fuller
01f8236bf5
Allow more fine-grained control over what submodules are updated (#27293)
The "submodules" argument of the "version" directive can now accept
a callable that returns a list of submodules, in addition to the usual
Boolean values
2022-06-09 07:45:49 +02:00
Massimiliano Culpo
d245c46487
bootstrap: account for disabled sources (#31042)
* bootstrap: account for disabled sources

Fix a bug introduced in #30192, which effectively skips
any prescription on disabled bootstrapping sources.

* Add unit test to avoid regression
2022-06-08 07:17:37 -06:00
Peter Scheibel
c724e26ba9
Staging: determine extensions from nonstandard URLs (#31027)
Fixes #31021

With #25185, we no longer default to using tar when we can't
determine the extension type, opting to fail instead.

This broke fetching for the pcre package, where we couldn't determine
the extension. To determine the extension, we were attempting to
extract it from the destination filename; however, this file name
may omit details of the origin URL that are required to determine the
extension, so instead we examine the URL directly.

This also updates the decompressor_for method not to set ext=None
by default: it must now always be set by the caller.
2022-06-07 14:12:08 -07:00
Massimiliano Culpo
6b4b1dacd9
docs: update the list of Docker images with Spack preinstalled (#31003)
Also, update the image in the docs and use ghcr.io
2022-06-07 16:43:04 +02:00
Jordan Galby
e74d85a524
Fix empty install prefix post-install sanity check (#30983) 2022-06-07 16:17:33 +02:00
Massimiliano Culpo
4a0ac87d07
archspec: bump to v0.1.4 (#30856)
Fixes compiler flags for oneapi and dpcpp
2022-06-07 08:51:34 +00:00
John W. Parent
5b45df5269
Update decompression support on Windows (#25185)
Most package installations include compressed source files. This
adds support for common archive types on Windows:

* Add support for using system 7zip functionality to decompress .Z
  files when available (and on Windows, use 7zip for .xz archives)
* Default to using built-in Python support for tar/bz2 decompression
  (note that Python tar documentation mentions preservation of file
  permissions)
* Add tests for decompression support
* Extract logic for handling exploding archives (i.e. compressed
  archives that expand to more than one base file) into an
  exploding_archive_catch context manager in the filesystem module
2022-06-06 18:14:43 -07:00
Chuck Atkins
9d7cc43673
Package: Don't warn for missing source on bundle packages without code (#30913) 2022-06-06 15:33:03 -07:00
John W. Parent
13b0e73a4e
Sanitize filepath from URL (#30625)
Spack's staging logic constructs a file path based on a URL. The URL
may contain characters which are not allowed in valid file paths on
the system (e.g. Windows prohibits ':' and '?' among others). This
commit adds a function to remove such offending characters (but
otherwise preserves the URL string when constructing a file path).
2022-06-04 15:06:43 -07:00
Adam J. Stewart
5728ba0122
Use stable URLs for patch-diff GitHub patches (#30953) 2022-06-02 12:52:05 -04:00
Robert Cohn
f3af38ba9b
Fix module support for oneapi compilers (#28901)
Updates to improve Spack-generated modules for Intel oneAPI compilers:

* intel-oneapi-compilers set CC etc.
* Add a new package intel-oneapi-compilers-classic which can be used to
  generate a module which sets CC etc. to older compilers (e.g. icc)
* lmod module logic now updated to treat the intel-oneapi-compilers*
  packages as compilers
2022-05-31 15:02:25 -07:00
Adam J. Stewart
055c9d125d
CUDA: make cuda_arch sticky (#30910) 2022-05-30 12:53:15 -07:00
Todd Gamblin
e6929b9ff9
0.18.0.dev0 -> 0.19.0.dev0 (#30907) 2022-05-28 17:23:01 +00:00
Tom Scogland
18c2f1a57a
refactor: packages import spack.package explicitly (#30404)
Explicitly import package utilities in all packages, and corresponding fallout.

This includes:

* rename `spack.package` to `spack.package_base`
* rename `spack.pkgkit` to `spack.package`
* update all packages in builtin, builtin_mock and tutorials to include `from spack.package import *`
* update spack style
  * ensure packages include the import
  * automatically add the new import and remove any/all imports of `spack` and `spack.pkgkit`
    from packages when using `--fix`
  * add support for type-checking packages with mypy when SPACK_MYPY_CHECK_PACKAGES
    is set in the environment
* fix all type checking errors in packages in spack upstream
* update spack create to include the new imports
* update spack repo to inject the new import, injection persists to allow for a deprecation period

Original message below:
 
As requested @adamjstewart, update all packages to use pkgkit.  I ended up using isort to do this,
so repro is easy:

```console
$ isort -a 'from spack.pkgkit import *' --rm 'spack' ./var/spack/repos/builtin/packages/*/package.py
$ spack style --fix
```

There were several line spacing fixups caused either by space manipulation in isort or by packages
that haven't been touched since we added requirements, but there are no functional changes in here.

* [x] add config to isort to make sure this is maintained going forward
2022-05-28 12:55:44 -04:00
Greg Becker
19087c9d35
target optimization: re-norm optimization scale so that 0 is best. (#29926)
referred targets are currently the only minimization criteria for Spack for which we allow
negative values. That means Spack may be incentivized to add nodes to the DAG if they
match the preferred target.

This PR re-norms the minimization criteria so that preferred targets are weighted from 0,
and default target weights are offset by the number of preferred targets per-package to
calculate node_target_weight.

Also fixes a bug in the test for preferred targets that was making the test easier to pass
than it should be.
2022-05-27 22:49:41 -07:00
Greg Becker
4116b04368
update tutorial command for v0.18.0 and new gpg key (#30904) 2022-05-28 02:36:20 +00:00
Scott Wittenburg
3d43ebec72
Revert "strip -Werror: all specific or none (#30284)" (#30878)
This reverts commit 330832c22c.
2022-05-26 14:17:01 -07:00
Massimiliano Culpo
0636fdbfef
Remove the warning that Spack prints at each spec (#30872)
Add instead a warning box in the documentation
2022-05-26 14:35:20 +00:00
Scott Wittenburg
85e13260cf
ci: Support secure binary signing on protected pipelines (#30753)
This PR supports the creation of securely signed binaries built from spack
develop as well as release branches and tags. Specifically:

- remove internal pr mirror url generation logic in favor of buildcache destination
on command line
    - with a single mirror url specified in the spack.yaml, this makes it clearer where 
    binaries from various pipelines are pushed
- designate some tags as reserved: ['public', 'protected', 'notary']
    - these tags are stripped from all jobs by default and provisioned internally
    based on pipeline type
- update gitlab ci yaml to include pipelines on more protected branches than just
develop (so include releases and tags)
    - binaries from all protected pipelines are pushed into mirrors including the
    branch name so releases, tags, and develop binaries are kept separate
- update rebuild jobs running on protected pipelines to run on special runners
provisioned with an intermediate signing key
    - protected rebuild jobs no longer use "SPACK_SIGNING_KEY" env var to
    obtain signing key (in fact, final signing key is nowhere available to rebuild jobs)
    - these intermediate signatures are verified at the end of each pipeline by a new
    signing job to ensure binaries were produced by a protected pipeline
- optionallly schedule a signing/notary job at the end of the pipeline to sign all
packges in the mirror
    - add signing-job-attributes to gitlab-ci section of spack environment to allow
    configuration
    - signing job runs on special runner (separate from protected rebuild runners)
    provisioned with public intermediate key and secret signing key
2022-05-26 08:31:22 -06:00
Todd Gamblin
d51f949768
bugfix: do not compute package_hash for old concrete specs (#30861)
Old concrete specs were slipping through in `_assign_hash`, and `package_hash` was
attempting to recompute a package hash when we could not know the package a time
of concretization.

Part of this was that the logic for `_assign_hash` was hard to understand -- it was
called twice from `_finalize_concretization` and had special cases for both args it
was called with. It's much easier to understand the logic here if we just inline it.

- [x] Get rid of `_assign_hash` and just integrate it with `_finalize_concretization`
- [x] Don't call `_package_hash` at all for already-concrete specs.
- [x] Add regression test.
2022-05-26 03:12:24 +00:00
Scott Wittenburg
70824e4a5e
buildcache: Update layout and signing (#30750)
This PR introduces a new build cache layout and package format, with improvements for
both efficiency and security.

## Old Format
Currently a binary package consists of a `spec.json` file at the root and a `.spack` file,
which is a `tar` archive containing a copy of the `spec.json` format, possibly a detached
signature (`.asc`) file, and a tar-gzip compressed archive containing the install tree.

```
build_cache/
  # metadata (for indexing)
  <arch>-<compiler>-<name>-<ver>-24zvipcqgg2wyjpvdq2ajy5jnm564hen.spec.json
  <arch>/
    <compiler>/
      <name>-<ver>/
        # tar archive
        <arch>-<compiler>-<name>-<ver>-24zvipcqgg2wyjpvdq2ajy5jnm564hen.spack
          # tar archive contents:
          # metadata (contains sha256 of internal .tar.gz)
          <arch>-<compiler>-<name>-<ver>-24zvipcqgg2wyjpvdq2ajy5jnm564hen.spec.json
          # signature
          <arch>-<compiler>-<name>-<ver>-24zvipcqgg2wyjpvdq2ajy5jnm564hen.spec.json.asc
          # tar.gz-compressed prefix
          <arch>-<compiler>-<name>-<ver>-24zvipcqgg2wyjpvdq2ajy5jnm564hen.tar.gz
```

After this change, the nesting has been removed so that the `.spack` file is the
compressed archive of the install tree.  Now signed binary packages, will take the
form of a clearsigned `spec.json` file (a `spec.json.sig`) at the root, while unsigned
binary packages will contain a `spec.json` at the root.

## New Format

```
build_cache/
  # metadata (for indexing, contains sha256 of .spack file)
  <arch>-<compiler>-<name>-<ver>-24zvipcqgg2wyjpvdq2ajy5jnm564hen.spec.json
  # clearsigned spec.json metadata
  <arch>-<compiler>-<name>-<ver>-24zvipcqgg2wyjpvdq2ajy5jnm564hen.spec.json.sig
  <arch>/
    <compiler>/
      <name>-<ver>/
        # tar.gz-compressed prefix (may support more compression formats later)
        <arch>-<compiler>-<name>-<ver>-24zvipcqgg2wyjpvdq2ajy5jnm564hen.spack
```

## Benefits
The major benefit of this change is that the signatures on binary packages can be
verified without:

1. Having to download the tarball, or
2. having to extract an unknown tarball.

(1) is an improvement in efficiency; (2) is a security fix: we now ensure that we trust the
binary before we try to run it through `tar`, which avoids potential attacks.

## Backward compatibility
Also after this change, spack should still be able to handle the previous buildcache
structure and binary mirrors with mixed layouts.
2022-05-24 17:39:20 -04:00
Massimiliano Culpo
ba907defca
Add a command to generate a local mirror for bootstrapping (#28556)
This PR builds on #28392 by adding a convenience command to create a local mirror that can be used to bootstrap Spack. This is to overcome the inconvenience in setting up this mirror manually, which has been reported when trying to setup Spack on air-gapped systems.

Using this PR the user can create a bootstrapping mirror, on a machine with internet access, by:

% spack bootstrap mirror --binary-packages /opt/bootstrap
==> Adding "clingo-bootstrap@spack+python %apple-clang target=x86_64" and dependencies to the mirror at /opt/bootstrap/local-mirror
==> Adding "gnupg@2.3: %apple-clang target=x86_64" and dependencies to the mirror at /opt/bootstrap/local-mirror
==> Adding "patchelf@0.13.1:0.13.99 %apple-clang target=x86_64" and dependencies to the mirror at /opt/bootstrap/local-mirror
==> Adding binary packages from "https://github.com/alalazo/spack-bootstrap-mirrors/releases/download/v0.1-rc.2/bootstrap-buildcache.tar.gz" to the mirror at /opt/bootstrap/local-mirror

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
The mirror has to be moved over to the air-gapped system, and registered using the commands shown at prompt. The command has options to:

1. Add pre-built binaries downloaded from Github (default is not to add them)
2. Add development dependencies for Spack (currently the Python packages needed to use spack style)

* bootstrap: refactor bootstrap.yaml to move sources metadata out

* bootstrap: allow adding/removing custom bootstrapping sources

This operation can be performed from the command line since
new subcommands have been added to `spack bootstrap`

* Add --trust argument to spack bootstrap add

* Add a command to generate a local mirror for bootstrapping

* Add a unit test for mirror creation
2022-05-24 21:33:52 +00:00
Massimiliano Culpo
f2a81af70e
Best effort co-concretization (iterative algorithm) (#28941)
Currently, environments can either be concretized fully together or fully separately. This works well for users who create environments for interoperable software and can use `concretizer:unify:true`. It does not allow environments with conflicting software to be concretized for maximal interoperability.

The primary use-case for this is facilities providing system software. Facilities provide multiple MPI implementations, but all software built against a given MPI ought to be interoperable.

This PR adds a concretization option `concretizer:unify:when_possible`. When this option is used, Spack will concretize specs in the environment separately, but will optimize for minimal differences in overlapping packages.

* Add a level of indirection to root specs

This commit introduce the "literal" atom, which comes with
a few different "arities". The unary "literal" contains an
integer that id the ID of a spec literal. Other "literals"
contain information on the requests made by literal ID. For
instance zlib@1.2.11 generates the following facts:

literal(0,"root","zlib").
literal(0,"node","zlib").
literal(0,"node_version_satisfies","zlib","1.2.11").

This should help with solving large environments "together
where possible" since later literals can be now solved
together in batches.

* Add a mechanism to relax the number of literals being solved

* Modify spack solve to display the new criteria

Since the new criteria is above all the build criteria,
we need to modify the way we display the output.

Originally done by Greg in #27964 and cherry-picked
to this branch by the co-author of the commit.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>

* Inject reusable specs into the solve

Instead of coupling the PyclingoDriver() object with
spack.config, inject the concrete specs that can be
reused.

A method level function takes care of reading from
the store and the buildcache.

* spack solve: show output of multi-rounds

* add tests for best-effort coconcretization

* Enforce having at least a literal being solved

Co-authored-by: Greg Becker <becker33@llnl.gov>
2022-05-24 12:13:28 -07:00
Seth R. Johnson
6a57aede57
environments: fail gracefully on missing keys (#26378) 2022-05-24 08:52:40 -07:00
edwardsp
ba701a7cf8
Update regex to correctly identify quoted args (#23494)
Previously the regex was only checking for presence of quotes as a beginning
or end character and not a matching set.  This erroneously identified the
following *single* argument as being quoted:

    source bashenvfile &> /dev/null && python3 -c "import os, json; print(json.dumps(dict(os.environ)))"
2022-05-24 08:26:07 -07:00
Greg Becker
817ee81eaa
compiler flags: imposed hashes impose the lack of additional compiler flags (#30797) 2022-05-24 01:22:29 -04:00
Tom Scogland
330832c22c
strip -Werror: all specific or none (#30284)
Add a config option to strip `-Werror*` or `-Werror=*` from compile lines everywhere.

```yaml
config:
    keep_werror: false
```

By default, we strip all `-Werror` arguments out of compile lines, to avoid unwanted
failures when upgrading compilers.  You can re-enable `-Werror` in your builds if
you really want to, with either:

```yaml
config:
    keep_werror: all
```

or to keep *just* specific `-Werror=XXX` args:

```yaml
config:
    keep_werror: specific
```

This should make swapping in newer versions of compilers much smoother when
maintainers have decided to enable `-Werror` by default.
2022-05-24 00:57:09 -04:00
Todd Gamblin
306bed48d7
specs: emit better parsing errors for specs. (#24860)
Parse error information is kept for specs, but it doesn't seem like we propagate it
to the user when we encounter an error.  This fixes that.

e.g., for this error in a package:

```python
    depends_on("python@:3.8", when="0.900:")
```

Before, with no context and no clue that it's even from a particular spec:

```
==> Error: Unexpected token: ':'
```

With this PR:

```
==> Error: Unexpected token: ':'
  Encountered when parsing spec:
    0.900:
         ^
```
2022-05-24 03:33:43 +00:00
Greg Becker
8616ba04db
Documentation and new method for CachedCMakePackage build system (#22706)
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2022-05-23 22:48:12 +00:00
Massimiliano Culpo
7c4cc1c71c
archspec: add oneapi and dpcpp flag support (#30783) 2022-05-23 13:28:54 -07:00
Harmen Stoppels
f7258e246f
Deprecate spack:concretization over concretizer:unify (#30038)
* Introduce concretizer:unify option to replace spack:concretization

* Deprecate concretization

* Make spack:concretization overrule concretize:unify for now

* Add environment update logic to move from spack:concretization to spack:concretizer:reuse

* Migrate spack:concretization to spack:concretize:unify in all locations

* For new environments make concretizer:unify explicit, so that defaults can be changed in 0.19
2022-05-23 13:20:34 -07:00
Glenn Johnson
d688a699fa
Fix toolchain detection for oneapi/dpcpp compilers (#30775)
The oneapi and dpcpp compilers are essentially the same except for which
binary is used foc CXX. Spack will detect them as "mixed toolchain" and
not inject compiler optimization flags. This will be needed once
archspec has entries for the oneapi and dpcpp compilers. This PR detects
when dpcpp and oneapi are in the toolchains list and explicitly sets
`is_mixed_toolchain` to `False`.
2022-05-21 08:38:01 +02:00
Greg Becker
ee04a1ab0b
errors: model error messages as an optimization problem (#30669)
Error messages for the clingo concretizer have proven challenging. The current messages are incredibly vague and often don't help users at all. Unsat cores in clingo are not guaranteed to be minimal, and lead to cores that are either not useful or need to be post-processed for hours to reach a minimal core.

Following up on an idea from a slack conversation with kwryankrattiger on slack, this PR takes a new approach. We eliminate most integrity constraints and minima/maxima on choice rules in clingo, and instead force invalid states to imply an error predicate. The error predicate can include context on the cause of the error (Package, Version, etc). These error predicates are then heavily optimized against, to ensure that we do not include error facts in the solution when a solution with no error facts could be generated. When post-processing the clingo solution to construct specs, any error facts cause the program to raise an exception. This leads to much more legible error messages. Each error predicate includes a priority and an error message. The error message is formatted by the remaining arguments to produce the error message. The priority is used to ensure that when clingo has a choice of which rules to violate, it chooses the one which will be most informative to the user.

Performance:

"fresh" concretizations appear to suffer a ~20% performance penalty under this branch, while "reuse" concretizations see a speedup of around 33%. 

Possible optimizations if users still see unhelpful messages:

There are currently 3 levels of priority of the error messages. Additional priorities are possible, and can allow us finer granularity to ensure more informative error messages are provided in lieu of less informative ones.

Future work:

Improve tests to ensure that every possible rule implying an error message is exercised
2022-05-20 08:27:07 -07:00
Jordan Galby
262c3f07bf
Non-existent upstream is not fatal (#30746)
A non-existent upstream should not be fatal: it could only mean it is
not deployed yet. In the meantime, it should not block the user to
rebuild anything it needs.

A warning is still emitted, to let the user decide if this is ok or not.
2022-05-19 18:27:43 +00:00
Jordan Galby
c2fd98ccd2
Fix spack install chgrp on symlinks (#30743)
Fixes missing chgrp on symlinks in package installations, and errors on
symlinks referencing non-existent or non-writable locations.

Note: `os.chown(.., follow_symlinks=False)` is python3 only, but
`os.lchown` exists in both versions.
2022-05-19 08:50:24 -07:00
Jordan Galby
8fe39be3df
Don't try to mkdir upstream directory when nonexistent (#30744)
When an upstream is specified but the directory does not exist, don't
create the directory for it, it might not be yours.
2022-05-19 14:45:18 +00:00
robgics
1f6b880fff
Add license dir to config (#30135)
* Change license dir from hard-coded to a configurable item

* Change config item to be a string not an array

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2022-05-18 18:26:42 -07:00
Todd Gamblin
8ff2b4b747
bugfix: handle new dag_hash() on old concrete specs gracefully. (#30678)
Trying to compute `dag_hash()` or `package_hash()` on a concrete spec that doesn't have
a `_package_hash` attribute would attempt to recompute the package hash.

This most commonly manifests as a failed lookup of a namespace if you attempt to uninstall
or compute the hashes of packages in exsternal repositories that aren't registered, e.g.:

```console
> spack spec --json c/htno
==> Error: Unknown namespace: myrepo
```

While it wouldn't change the already-assigned `dag_hash` value, this behavior is
incorrect, since the package file for a previously concrete spec:
  1. might have changed since concretization,
  2. might not exist anymore, or
  3. might just not be findable by Spack.

This PR ensures that the package hash can't be computed on older concrete specs. Instead
of calling `package_hash()` from within `to_node_dict()`, we now check for the `_package_hash`
attribute and only add the package_hash to the spec record if it's there.

This PR also handles the tricky semantics of computing `package_hash()` at concretization
time. We have to compute it *before* marking the spec concrete so that `to_node_dict` can
use it. But this means that the logic for `package_hash()` can't rely on `spec.concrete`,
as it is called *during* concretization. Instead of checking for concreteness, `package_hash()`
now checks `_patches_assigned()` to determine whether it should add them to the package
hash.

- [x] Add an assert to `package_hash()` so it can't be called on specs for which it
      would be wrong.
- [x] Add an `_assign_hash()` method to handle tricky semantics of `package_hash`
      and `dag_hash`.
- [x] Rework concretization to call `_assign_hash()` before and after marking specs
      concrete.
- [x] Rework content hash part of package hash to check for `_patches_assigned()`
      instead of `spec.concrete`.
- [x] regression test
2022-05-18 22:21:22 +00:00
Massimiliano Culpo
c775c322ec
vendored externals: update archspec (#30683)
- Better support for 164fx
- Better support for Apple M1(pro)
2022-05-18 11:31:20 +02:00
Harmen Stoppels
1185eb9199
Compiler wrapper: fix globbing and debug out.log bell chars (#30699)
* Disable globbing

* Split on bell char when dumping cmd to out.log
2022-05-18 09:06:54 +02:00
Massimiliano Culpo
f454a683b5
Mark test_repo_last_mtime xfail on Python < 3.5 (#30696) 2022-05-17 12:45:52 +02:00
andymwood
97ec8f1d19
Avoid calling a method on a NoneType object (#30637) 2022-05-16 21:59:08 +00:00
Todd Gamblin
0fdc3bf420
bugfix: use deterministic edge order for spack graph (#30681)
Previously we sorted by hash values for `spack graph`, but changing hashes can make the
test brittle and the node order seem nondeterministic to users.

- [x] Sort nodes in `spack graph` by the default edge order, which takes into account
      parent and child names as well as dependency types.
- [x] Update ASCII test output for new order.
2022-05-16 11:36:41 +02:00
Danny McClanahan
a681fd7b42
Introduce GroupedExceptionHandler and use it to simplify bootstrap error handling (#30192) 2022-05-15 10:59:11 +00:00
Alberto Invernizzi
f40f1b5c7c
Fix for spack stage command not extracting packages in custom paths (#30448) 2022-05-15 12:13:42 +02:00
Michael Kuhn
ff03e2ef4c
uninstall: fix dependency check (#30674)
The dependency check currently checks whether there are only build
dependencies left for a particular package. However, the database also
contains uninstalled packages, which can cause the check to fail.

For instance, with `bison` and `flex` having already been uninstalled,
`m4` will have the following dependents:
```
bison ('build', 'run')--> m4
flex ('build',)--> m4
libnl ('build',)--> m4
```
`bison` and `flex` should be ignored in this case because they are not
installed anymore.

Fixes #30673
2022-05-14 18:01:29 -07:00
John W. Parent
e24e71be6a
Preserve Permissions on .zip extraction (#30407)
#24556 merged in support for Python's .zip file support via ZipFile.
However as per #30200 ZipFile does not preserve file permissions of
the extracted contents. This PR returns to using the `unzip`
executable on non-Windows systems (as was the case before #24556)
and now uses `tar` on Windows to extract .zip files.
2022-05-13 13:38:05 -07:00
Todd Gamblin
5cb40cbcd2 directory_layout: remove outdated checks for old DAG hash
We previously had checks in `directory_layout` to check for build-dependency
conflicts when we weren't storing build dependencies.  We don't need
those anymore; we can just rely on the DAG hash now that it includes everything
we know about each spec.

- [x] Remove vestigial code for checking installed spec against concrete spec
      in `ensure_installed()`
- [x] Remove `SpecHashCollisionError` -- if specs have the same hash now, they're
      the same as far as `DirectoryLayout` should be concerned.
- [x] Convert spec comparison to `dag_hash()` comparison when adding extensions.
2022-05-13 10:45:12 -07:00
Todd Gamblin
c93e465134 full hash: fix uninstall and gc with full hash DB
The database now stores full hashes, so we need to adjust the criteria we use to
determine if something can be uninstalled. Specifically, it's ok to uninstall thing that
have remaining build-only dependents.
2022-05-13 10:45:12 -07:00
Todd Gamblin
521c206030 concretizer: enable hash reuse with full hash
With the original DAG hash, we did not store build dependencies in the database, but
with the full DAG hash, we do. Previously, we'd never tell the concretizer about build
dependencies of things used by hash, because we never had them. Now, we have to avoid
telling the concretizer about them, or they'll unnecessarily constrain build
dependencies for new concretizations.

- [x] Make database track all dependencies included in the `dag_hash`
- [x] Modify spec_clauses so that build dependency information is optional
      and off by default.
- [x] `spack diff` asks `spec_clauses` for build dependencies for completeness
- [x] Modify `concretize.lp` so that reuse optimization doesn't affect fresh
      installations.
- [x] Modify concretizer setup so that it does *not* prioritize installed versions
      over package versions. We don't need this with reuse, so they're low priority.
- [x] Fix `test_installed_deps` for full hash and new concretizer (does not work
      for old concretizer with full hash -- leave this for later if we need it)
- [x] Move `test_installed_deps` mock packages to `builtin.mock` for easier debugging
      with `spack -m`.
- [x] Fix `test_reuse_installed_packages_when_package_def_changes` for full hash
2022-05-13 10:45:12 -07:00
Todd Gamblin
15eb98368d bugfix: tests trying to ignore package changes should use build_hash
- [x] update test to use `build_hash` instead of `dag_hash`, as we're testing for
      graph structure, and specifically NOT testing for package changes.
- [x] make hash descriptors callable on specs to simplify syntax for invoking them
- [x] make `Spec.spec_hash()` public
2022-05-13 10:45:12 -07:00
Todd Gamblin
7c1d566959 Remove all uses of runtime_hash; document lockfile formats and fix tests
This removes all but one usage of runtime hash. The runtime hash was being used to write
historical lockfiles for tests, but we don't need it for that; we can just save those
lockfiles.

- [x] add legacy lockfiles for v1, v2, v3
- [x] fix bugs with v1 lockfile tests (the dummy lockfile we were writing was not actually
      a v1 lockfile because it used the new spec file format).
- [x] remove all but one runtime_hash usage -- that one needs a small rework of the
      concretizer to really fix, as it's about separate concretization of build
      dependencies.
- [x] Document the history of the lockfile format in `environment/__init__.py`
2022-05-13 10:45:12 -07:00
Todd Gamblin
7ab46e26b5 content_hash(): make it work on abstract specs
Some test cases had to be modified in a kludgy way so that abstract specs made
concrete would have versions on them. We shouldn't *need* to do this, as the
only reason we care is because the content hash has to be able to get an archive
for a version.

This modifies the content hash so that it can be called on abstract specs,
including only relevant content.

This does NOT add a partial content hash to the DAG hash, as we do not really
want that -- we don't need in-memory spec hashes to need to load package files.
It just makes `Package.content_hash()` less prickly and tests easier to
understand.
2022-05-13 10:45:12 -07:00
Todd Gamblin
6db215dd89 spec: fix serialization, avoid double call to node_dict_with_hashes 2022-05-13 10:45:12 -07:00
Todd Gamblin
72b38851eb hashes: revert spack monitor hash changes to preserve original protocol
`spack monitor` expects a field called `spec_full_hash`, so we shouldn't change that.
Instead, we can pass a `dag_hash` (which is now the full hash) but not change the field
name.
2022-05-13 10:45:12 -07:00
Todd Gamblin
9d9e970367 fix full hash calls in spack graph 2022-05-13 10:45:12 -07:00
Todd Gamblin
283a4e6068 remove no longer needed full hash check 2022-05-13 10:45:12 -07:00
Todd Gamblin
d20cc7b124 spec: remove hashes_final as it's no longer needed.
`hashes_final` was used to indicate when a spec was concrete but possibly lacked
`full_hash` or `build_hash` fields. This was only necessary because older Spacks
didn't generate them, and we want to avoid recomputing them, as we likely do not
have the same package files as existed at concretization time.

Now, we don't need to do that -- there is only the DAG hash and specs are either
concrete and have a `dag_hash`, or not concrete and have no `dag_hash`. There's
no middle ground.
2022-05-13 10:45:12 -07:00