summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2021-11-05Prevent additional properties to be in the answer set when reusing specs ↵Massimiliano Culpo3-1/+42
(#27240) * Prevent additional properties to be in the answer set when reusing specs fixes #27237 The mechanism to reuse concrete specs relies on imposing the set of constraints stemming from the concrete spec being reused. We also need to prevent that other constraints get added to this set.
2021-11-05make version docs reflect reality (#27149)Harmen Stoppels1-26/+30
* make version docs reflect reality * typo and make things * 2.6 -> 2.7 in example
2021-11-05commands: `spack load --list` alias for `spack find --loaded` (#27184)Todd Gamblin4-10/+50
See #25249 and https://github.com/spack/spack/pull/27159#issuecomment-958163679. This adds `spack load --list` as an alias for `spack find --loaded`. The new command is not as powerful as `spack find --loaded`, as you can't combine it with all the queries or formats that `spack find` provides. However, it is more intuitively located in the command structure in that it appears in the output of `spack load --help`. The idea here is that people can use `spack load --list` for simple stuff but fall back to `spack find --loaded` if they need more. - add help to `spack load --list` that references `spack find` - factor some parts of `spack find` out to be called from `spack load` - add shell tests - update docs Co-authored-by: Peter Josef Scheibel <scheibel1@llnl.gov> Co-authored-by: Richarda Butler <39577672+RikkiButler20@users.noreply.github.com>
2021-11-05docs for experimental `--reuse` argument to `spack install`Todd Gamblin1-0/+28
Add docs for `--reuse`, along with a warning that it will likely be removed and refactored.
2021-11-05error message for reusing multiple hashes for packageGregory Becker1-1/+2
2021-11-05concretizer: add error messages and simplify asp.pyTodd Gamblin2-8/+18
2021-11-05Fix logic program for multi-valued variantsMassimiliano Culpo1-45/+71
Reformulate variant rules so that we minimize both 1. The number of non-default values being used 2. The number of default values not-being used This is crucial for MV variants where we may have more than one default value
2021-11-05bugfix: handle hashes that only exist in input specsTodd Gamblin1-27/+48
In our tests, we use concrete specs generated from mock packages, which *only* occur as inputs to the solver. This fixes two problems: 1. We weren't previously adding facts to encode the necessary `depends_on()` relationships, and specs were unsatisfiable on reachability. 2. Our hash lookup for reconstructing the DAG does not consider that a hash may have come from the inputs.
2021-11-05concretizer: exempt already-installed specs from compiler and variant rulesTodd Gamblin2-7/+22
Concrete specs that are already installed or that come from a buildcache may have compilers and variant settings that we do not recognize, but that shouldn't prevent reuse (at least not until we have a more detailed compiler model). - [x] make sure compiler and variant consistency rules only apply to built specs - [x] don't validate concrete specs on input, either -- they're concrete and we shouldn't apply today's rules to yesterday's build
2021-11-05spack diff: more flexible tests, restore transitive diff with spec_clausesTodd Gamblin3-12/+39
In switching to hash facts for concrete specs, we lost the transitive facts from dependencies. This was fine for solves, because they were implied by the imposed constraints from every hash. However, for `spack diff`, we want to see what the hashes mean, so we need another mode for `spec_clauses()` to show that. This adds a `expand_hashes` argument to `spec_clauses()` that allows us to output *both* the hashes and their implications on dependencies. We use this mode in `spack diff`.
2021-11-05Add a missing definition in the logic programMassimiliano Culpo1-0/+1
2021-11-05Add buildcache to reusable specsMassimiliano Culpo4-16/+51
2021-11-05spack install: add --reuse argumentMassimiliano Culpo2-4/+6
2021-11-05spack concretize: add --reuse argumentMassimiliano Culpo4-16/+35
2021-11-05spack spec: add --reuse argumentMassimiliano Culpo4-16/+33
2021-11-05concretizer: get rid of last maximize directive in concretize.lpTodd Gamblin1-32/+5
- [x] Get rid of forgotten maximize directive. - [x] Simplify variant handling - [x] Fix bug in treatment of defaults on externals (don't count non-default variants on externals against them)
2021-11-05Trim dependencies on externalsMassimiliano Culpo1-1/+2
2021-11-05Fix a unit test to match the new OS semanticsMassimiliano Culpo1-1/+1
CNL, debian6 and Suse are not compatible
2021-11-05ASP-based solve: if an OS is set, respect the valueMassimiliano Culpo1-0/+3
2021-11-05Fix a type in "variant_not_default" ruleMassimiliano Culpo1-1/+1
2021-11-05concretizer: rework spack solve output to handle reuse betterTodd Gamblin3-75/+137
2021-11-05spec: ensure_valid_variants() should not validate concrete specsTodd Gamblin1-0/+4
Variants in concrete specs are "always" correct -- or at least we assume them to be b/c they were concretized before. Their variants need not match the current version of the package.
2021-11-05concretizer: unify handling of single- and multi-valued variantsTodd Gamblin1-18/+5
Multi-valued variants previously maximized default values to handle cases where the default contained two values, e.g.: variant("foo", default="bar,baz") This is because previously we were minimizing non-default values, and `foo=bar`, `foo=baz`, and `foo=bar,baz` all had the same score, as none of them had any "non-default" values. This commit changes the approach and considers a non-default value to be either a value set to something not default *or* the absence of a default value from the set value. This allows multi- and single-valued variants to be handled the same way, with the same minimization criterion. It alse means that the "best" value for every optimization criterion is now zero, which allows us to make useful assumptions about the optimization criteria.
2021-11-05concretizer: reuse installs, but assign default values for new buildsTodd Gamblin1-35/+119
Minimizing builds is tricky. We want a minimizing criterion because we want to reuse the avaialble installs, but we also want things that have to be built to stick to *default preferences* from the package and from the user. We therefore treat built specs differently and apply a different set of optimization criteria to them. Spack's *first* priority is to reuse what it can, but if it builds something, the built specs will respect defaults and preferences. This is implemented by bumping the priority of optimization criteria for built specs -- so that they take precedence over the otherwise topmost-priority criterion to reuse what is installed. The scheme relies on all of our optimization criteria being minimizations. That is, we need the case where all specs are reused to be better than any built spec could be. Basically, if nothing is built, all the build criteria are zero (the best possible) and the number of built packages dominates. If something *has* to be built, it must be strictly worse than full reuse, because: 1. it increases the number of built specs 2. it must have either zero or some positive number for all criteria Our optimziation criteria effectively sum into two buckets at once to accomplish this. We use a `build_priority()` number to shift the priority of optimization criteria for built specs higher.
2021-11-05tests: make `spack diff` test more lenientTodd Gamblin1-4/+12
The constraints in the `spack diff` test were very specific and assumed a lot about the structure of what was being diffed. Relax them a bit to make them more resilient to changes.
2021-11-05concretizer: only minimize builds when `--reuse` is enabled.Todd Gamblin2-1/+4
Make the first minimization conditional on whether `--reuse` is enabled in the solve. If `--reuse` is not enabled, there will be nothing in the set to minimize and the objective function (for this criterion) will be 0 for every answer set.
2021-11-05concretizer: adjust integrity constraints to only apply to builds.Todd Gamblin1-6/+13
Many of the integrity constraints in the concretizer are there to restrict how solves are done, but they ignore that past solves may have had different initial conditions. For example, for things we're building, we want the allowed variants to be restricted to those currently in Spack packages, but if we are reusing a concrete spec, we need to be flexible about names that may have existed in old packages. Similarly, restrictions around compatibility of OS's, compiler versions, compiler OS support, etc. are really only about what is supported by the *current* set of compilers/build tools known to Spack, not about what we may get from concrete specs. - [x] restrict certain integrity constraints to only apply to packages that we need to build, and omit concrete specs from consideration.
2021-11-05concretizer: rework operating system semantics for installed packagesTodd Gamblin2-64/+104
The OS logic in the concretizer is still the way it was in the first version. Defaults are implemented in a fairly inflexible way using straight logic. Most of the other sections have been reworked to leave these kinds of decisions to optimization. This commit does that for OS's as well. As with targets, we optimize for target matches. We also try to optimize for OS matches between nodes. Additionally, this commit adds the notion of "OS compatibility" where we allow for builds to depend on binaries for certain other OS's. e.g, for macos, a bigsur build can depend on an already installed (concrete) catalina build. One cool thing about this is that we can declare additional compatible OS's later, e.g. CentOS and RHEL.
2021-11-05concretizer: `impose()` for concrete specs should use body facts.Todd Gamblin1-3/+3
The concretizer doesn't get a say in whether constraints from concrete specs are imposed, so use body facts for them.
2021-11-05include installed hashes in solve and optimize for reuseTodd Gamblin3-15/+104
2021-11-05rename `checked_spec_clauses()` to `spec_clauses()`Todd Gamblin1-8/+8
2021-11-05add `--reuse` option to `spack solve`Todd Gamblin2-6/+13
2021-11-04Rename the temporary scope for bootstrap buildcache (#27231)Massimiliano Culpo1-1/+1
If we don't rename Spack will fail with: ``` ImportError: cannot bootstrap the "clingo" Python module from spec "clingo-bootstrap@spack+python %gcc target=x86_64" due to the following failures: 'spack-install' raised ValueError: Invalid config scope: 'bootstrap'. Must be one of odict_keys(['_builtin', 'defaults', 'defaults/cray', 'bootstrap/cray', 'disable_modules', 'overrides-0']) Please run `spack -d spec zlib` for more verbose error messages ``` in case bootstrapping from binaries fails and we are falling back to bootstrapping from sources.
2021-11-04Sort arguments lexicographically in command's help (#27196)Massimiliano Culpo1-0/+5
2021-11-03sip: fix python_include_dir (#26953)Manuela Kuhn1-1/+3
2021-11-03Allow conditional variants (#24858)Greg Becker12-32/+193
A common question from users has been how to model variants that are new in new versions of a package, or variants that are dependent on other variants. Our stock answer so far has been an unsatisfying combination of "just have it do nothing in the old version" and "tell Spack it conflicts". This PR enables conditional variants, on any spec condition. The syntax is straightforward, and matches that of previous features.
2021-11-02Bootstrap GnuPG (#24003)Massimiliano Culpo5-75/+251
* GnuPG: allow bootstrapping from buildcache and sources * Add a test to bootstrap GnuPG from binaries * Disable bootstrapping in tests * Add e2e test to bootstrap GnuPG from sources on Ubuntu * Add e2e test to bootstrap GnuPG on macOS
2021-11-02Update docs how to display loaded modules (#27159)Richarda Butler1-2/+17
* Update spack load docs
2021-11-02Improved error messages from clingo (#26719)Greg Becker7-72/+223
This PR adds error message sentinels to the clingo solve, attached to each of the rules that could fail a solve. The unsat core is then restricted to these messages, which makes the minimization problem tractable. Errors that can only be generated by a bug in the logic program or generating code are prefaced with "Internal error" to make clear to users that something has gone wrong on the Spack side of things. * minimize unsat cores manually * only errors messages are choices/assumptions for performance * pre-check for unreachable nodes * update tests for new error message * make clingo concretization errors show up in cdash reports fully * clingo: make import of clingo.ast parsing routines robust to clingo version Older `clingo` has `parse_string`; newer `clingo` has `parse_files`. Make the code work wtih both. * make AST access functions backward-compatible with clingo 5.4.0 Clingo AST API has changed since 5.4.0; make some functions to help us handle both versions of the AST. Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2021-11-02relocate: do not change library id to use rpaths on package install (#27139)Seth R. Johnson3-23/+7
After #26608 I got a report about missing rpaths when building a downstream package independently using a spack-installed toolchain (@tmdelellis). This occurred because the spack-installed libraries were being linked into the downstream app, but the rpaths were not being manually added. Prior to #26608 autotools-installed libs would retain their hard-coded path and would thus propagate their link information into the downstream library on mac. We could solve this problem *if* the mac linker (ld) respected `LD_RUN_PATH` like it does on GNU systems, i.e. adding `rpath` entries to each item in the environment variable. However on mac we would have to manually add rpaths either using spack's compiler wrapper scripts or manually (e.g. using `CMAKE_BUILD_RPATH` and pointing to the libraries of all the autotools-installed spack libraries). The easier and safer thing to do for now is to simply stop changing the dylib IDs.
2021-11-02spack arch: add --generic argument (#27061)Michael Kuhn1-0/+8
The `--generic` argument allows printing the best generic target for the current machine. This can be quite handy when wanting to find the generic architecture to use when building a shared software stack for multiple machines.
2021-11-02Add tag filters to `spack test list` (#26842)Tamara Dahlgren1-5/+21
2021-11-01feature: add "spack tags" command (#26136)Tamara Dahlgren9-77/+490
This PR adds a "spack tags" command to output package tags or (available) packages with those tags. It also ensures each package is listed in the tag cache ONLY ONCE per tag.
2021-11-01Fix caching of spack.repo.all_package_names() (#26991)Massimiliano Culpo2-9/+16
fixes #24522
2021-10-29For Spack commands that fail but don't throw exceptions, we were discarding ↵Peter Scheibel1-1/+1
the return code (#27077)
2021-10-29config add: infer type based on JSON schema validation errors (#27035)Massimiliano Culpo3-19/+45
- [x] Allow dding enumerated types and types whose default value is forbidden by the schema - [x] Add a test for using enumerated types in the tests for `spack config add` - [x] Make `config add` tests use the `mutable_config` fixture so they do not affect other tests Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2021-10-28bugfix: config edit should work with a malformed `spack.yaml`Todd Gamblin2-10/+31
If you don't format `spack.yaml` correctly, `spack config edit` still fails and you have to edit your `spack.yaml` manually. - [x] Add some code to `_main()` to defer `ConfigFormatError` when loading the environment, until we know what command is being run. - [x] Make `spack config edit` use `SPACK_ENV` instead of the config scope object to find `spack.yaml`, so it can work even if the environment is bad. Co-authored-by: scheibelp <scheibel1@llnl.gov>
2021-10-28bugfix: `spack config get <section>` in environmentsTodd Gamblin1-4/+4
`spack config get <section>` was erroneously returning just the `spack.yaml` for the environment. It should return the combined configuration for that section (including anything from `spack.yaml`), even in an environment. - [x] reorder conditions in `cmd/config.py` to fix
2021-10-28config: ensure that options like `--debug` are set firstTodd Gamblin1-17/+38
`spack --debug config edit` was not working properly -- it would not do show a stack trace for configuration errors. - [x] Rework `_main()` and add some notes for maintainers on where things need to go for configuration to work properly. - [x] Move config setup to *after* command-line parsing is done. Co-authored-by: scheibelp <scheibel1@llnl.gov>
2021-10-28errors: Rework error handling in `main()`Todd Gamblin1-23/+48
`main()` has grown, and in some cases code that can generate errors has gotten outside the top-level try/catch in there. This means that simple errors like config issues give you large stack traces, which shouldn't happen without `--debug`. - [x] Split `main()` into `main()` for the top-level error handling and `_main()` with all logic.