summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2022-05-24compiler flags: imposed hashes impose the lack of additional compiler flags ↵Greg Becker1-0/+5
(#30797)
2022-05-24strip -Werror: all specific or none (#30284)Tom Scogland5-3/+127
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-24specs: emit better parsing errors for specs. (#24860)Todd Gamblin5-27/+33
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-23Documentation and new method for `CachedCMakePackage` build system (#22706)Greg Becker3-0/+128
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2022-05-23archspec: add oneapi and dpcpp flag support (#30783)Massimiliano Culpo2-1/+323
2022-05-23Deprecate `spack:concretization` over `concretizer:unify` (#30038)Harmen Stoppels11-41/+138
* 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-21Fix toolchain detection for oneapi/dpcpp compilers (#30775)Glenn Johnson1-1/+2
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-20errors: model error messages as an optimization problem (#30669)Greg Becker8-244/+387
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-19Non-existent upstream is not fatal (#30746)Jordan Galby1-3/+1
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-19Fix spack install chgrp on symlinks (#30743)Jordan Galby3-4/+7
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-19Don't try to mkdir upstream directory when nonexistent (#30744)Jordan Galby1-2/+2
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-18Add license dir to config (#30135)robgics8-16/+40
* 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-18bugfix: handle new `dag_hash()` on old concrete specs gracefully. (#30678)Todd Gamblin4-21/+124
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-18vendored externals: update archspec (#30683)Massimiliano Culpo4-38/+109
- Better support for 164fx - Better support for Apple M1(pro)
2022-05-18Compiler wrapper: fix globbing and debug out.log bell chars (#30699)Harmen Stoppels1-2/+4
* Disable globbing * Split on bell char when dumping cmd to out.log
2022-05-17Mark test_repo_last_mtime xfail on Python < 3.5 (#30696)Massimiliano Culpo1-1/+4
2022-05-16Avoid calling a method on a NoneType object (#30637)andymwood1-1/+2
2022-05-16bugfix: use deterministic edge order for `spack graph` (#30681)Todd Gamblin2-4/+6
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-15Introduce GroupedExceptionHandler and use it to simplify bootstrap error ↵Danny McClanahan4-37/+143
handling (#30192)
2022-05-15Fix for `spack stage` command not extracting packages in custom paths (#30448)Alberto Invernizzi2-7/+4
2022-05-14uninstall: fix dependency check (#30674)Michael Kuhn1-1/+1
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-13Preserve Permissions on .zip extraction (#30407)John W. Parent1-9/+11
#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-13directory_layout: remove outdated checks for old DAG hashTodd Gamblin2-34/+6
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-13full hash: fix uninstall and gc with full hash DBTodd Gamblin3-5/+26
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-13concretizer: enable hash reuse with full hashTodd Gamblin7-87/+156
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-13bugfix: tests trying to ignore package changes should use `build_hash`Todd Gamblin3-5/+15
- [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-13Remove all uses of `runtime_hash`; document lockfile formats and fix testsTodd Gamblin14-841/+2719
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`content_hash()`: make it work on abstract specsTodd Gamblin4-40/+78
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-13spec: fix serialization, avoid double call to node_dict_with_hashesTodd Gamblin1-1/+4
2022-05-13hashes: revert `spack monitor` hash changes to preserve original protocolTodd Gamblin4-14/+17
`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-13fix full hash calls in `spack graph`Todd Gamblin1-4/+4
2022-05-13remove no longer needed full hash checkTodd Gamblin1-6/+1
2022-05-13spec: remove hashes_final as it's no longer needed.Todd Gamblin1-29/+1
`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-13gitlab ci: Docstring methods or make them privateScott Wittenburg3-76/+238
2022-05-13binary_distribution: Refactor index generation into smaller methodsScott Wittenburg1-47/+57
2022-05-13env: Use order of roots to resolve DAG hash conflicts in legacy lockfilesScott Wittenburg2-26/+39
2022-05-13env: enforce predictable ordering when reading lockfileScott Wittenburg2-9/+19
Without some enforcement of spec ordering, python 2 produced different results in the affected test than did python 3. This change makes the arbitrary but reproducible decision to sort the specs by their lockfile key alphabetically.
2022-05-13spec: fix infinite recursion when computing package hashScott Wittenburg1-6/+14
Issue described in the following PR comment: https://github.com/spack/spack/pull/28504#issuecomment-1051835568 Solution described in subsequent comment: https://github.com/spack/spack/pull/28504#issuecomment-1053986132
2022-05-13Fix how environments are read from lockfileScott Wittenburg15-109/+832
2022-05-13hashes: remove full_hash and build_hash from spackScott Wittenburg27-710/+334
2022-05-13environment: key by dag_hash instead of build_hashScott Wittenburg5-45/+68
2022-05-13tests: fix failing test_hash_changeScott Wittenburg1-2/+4
The full hash appears twice in the spec dict now, replacing just the value replaces it under "hash" and "full_hash". Only replace the one that appears after "full_hash". I'm actually not sure what purpose this test served, so maybe it could be removed, as it may be testing some distinction between full and dag hash which no longer exists.
2022-05-13Include all deps and package content in the `dag_hash()`Todd Gamblin4-41/+45
For a long time, Spack has used a coarser hash to identify packages than it likely should. Packages are identified by `dag_hash()`, which includes only link and run dependencies. Build dependencies are stripped before hashing, and we have notincluded hashes of build artifacts or the `package.py` files used to build. This means the DAG hash actually doesn't represent all the things Spack can build, and it reduces reproducibility. We did this because, in the early days, users were (rightly) annoyed when a new version of CMake, autotools, or some other build dependency would necessitate a rebuild of their entire stack. Coarsening the hash avoided this issue and enabled a modicum of stability when only reusing packages by hash match. Now that we have `--reuse`, we don't need to be so careful. Users can avoid unnecessary rebuilds much more easily, and we can add more provenance to the spec without worrying that frequent hash changes will cause too many rebuilds. This commit starts the refactor with the following major change: - [x] Make `Spec.dag_hash()` include build, run, and link dependencides and the package hash (it is now equivalent to `full_hash()`). It also adds a couple of bugfixes for problems discovered during the switch: - [x] Don't add a `package_hash()` in `to_node_dict()` unless the spec is concrete (fixes breaks on abstract specs) - [x] Don't add source ids to the package hash for packages without a known fetch strategy (may mock packages are like this) - [x] Change how `Spec.patches` is memoized. Using `llnl.util.lang.memoized` on `Spec` objects causes specs to be stored in a `dict`, which means they need a hash. But, `dag_hash()` now includes patch `sha256`'s via the package hash, which can lead to infinite recursion
2022-05-13Reuse concretization by default (#30396)Massimiliano Culpo2-25/+20
* Enable reuse by default in Spack * Update documentation to match new default * Configure pipelines not to reuse software
2022-05-12Gitlab pipelines: add a small legend in the logs to interpret "[x]" (#30643)Massimiliano Culpo1-5/+2
2022-05-12Add cuda 11.7 compat bounds for gcc/clang (#30639)Harmen Stoppels1-2/+2
2022-05-11Allow read-only access to file cache (when needed) (#29693)Tamara Dahlgren2-2/+47
* Allow read-only access to file cache (when needed) * Tweaked and added unit tests * Skip test_cache_init_entry_fails for windows
2022-05-11Fix default buildcache location (#30230)Thomas Dickerson1-1/+1
Resolve path/URL parsing issues introduced by #27021
2022-05-10oneapi: add v2022.2 (#30531)Robert Cohn1-0/+9
2022-05-10bugfix: `spack pkg list` should be more picky about what's a package (#30577)Todd Gamblin1-3/+11
`spack pkg list` tests were broken by #29593 for cases when your `builtin.mock` repo still has stale backup files (or, really, stale directories) sitting around. This happens if you switch branches a lot. In this case, things like this were causing erroneous packages in the mock listing: ``` var/spack/repos/builtin.mock/packages/ foo/ package.py~ ``` - [x] make `list_packages` consider only directories with one-deep `package.py` files.