summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2024-12-07extensions.py: remove import of spack.cmd (#47963)Harmen Stoppels4-34/+30
2024-12-06directives.py: remove redundant import (#47965)Harmen Stoppels1-2/+0
2024-12-06build_environment: drop off by one fix (#47960)Harmen Stoppels1-10/+3
2024-12-05Don't inject import statements in package recipesMassimiliano Culpo5-38/+32
Remove a hack done by RepoLoader, which was injecting an extra ``` from spack.package import * ``` at the beginning of each package.py
2024-12-05solver: partition classes related to requirement parsing into their own file ↵Massimiliano Culpo3-224/+238
(#47915)
2024-12-05spack.mirror: split into submodules (#47936)Harmen Stoppels32-532/+578
2024-12-04`resource`: clean up arguments and typingTodd Gamblin4-41/+43
- [x] Clean up arguments on the `resource` directive. - [x] Add type annotations - [x] Add `resource` to type annotations on `PackageBase` - [x] Fix up `resource` docstrings Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-04directives: add type annotations to `DirectiveMeta` classTodd Gamblin1-11/+13
Some of the class-level annotations were wrong, and some were missing. Annotate all the functions here and fix the class properties to match what's actually happening. Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-04directives: use `Type[PackageBase]` instead of `PackageBase`Todd Gamblin4-21/+30
The first argument to each Spack directive is not a `PackageBase` instance but a `PackageBase` class object, so fix the type annotations to reflect this. Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-04directives: don't include `Optional` in `PatchesType`Todd Gamblin1-3/+3
`Optional` shouldn't be part of `PatchesType` -- it's clearer to specify `Optional` it in the methods that need their arguments to be optional. Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-12-04stage.py: improve path to url (#47898)Harmen Stoppels1-1/+1
2024-12-03bug fix: updated warning message to reflect impending v1.0 release (#47887)Carson Woods1-2/+2
2024-12-03style.py: do not remove import spack in packages (#47895)Harmen Stoppels1-2/+0
2024-12-03build(deps): bump pytest from 8.3.3 to 8.3.4 in /lib/spack/docs (#47882)dependabot[bot]1-1/+1
Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.3.3 to 8.3.4. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.3.3...8.3.4) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-30`version_types`: clean up type hierarchy and add annotations (#47781)Todd Gamblin3-201/+328
In preparation for adding `when=` to `version()`, I'm cleaning up the types in `version_types` and making sure the methods here pass `mypy` checks. This started as an attempt to use `ConcreteVersion` outside of `spack.version` and grew into a larger type refactor. The hierarchy now looks like this: * `VersionType` * `ConcreteVersion` * `StandardVersion` * `GitVersion` * `ClosedOpenRange` * `VersionList` Note that the top-level thing can't easily be `Version` as that is a method and it returns only `ConcreteVersion` right now. I *could* do something fancy with `__new__` to make `Version` a synonym for the `ConcreteVersion` constructor, which would allow it to be used as a type. I could also do something similar with `VersionRange` but not sure if it's worth it just to make these into types. There are still some places where I think `GitVersion` might not be handled properly, but I have not attempted to fix those here. - [x] Add a top-level `VersionType` class that all version types extend from - [x] Define and document common methods and rich comparisons on `VersionType` - [x] Replace complicated `Union` types with `VersionType` and `ConcreteVersion` as needed - [x] Annotate most methods (skipping `__getitem__` and friends as the typing is a pain) - [x] Fix up the `VersionList` constructor a bit - [x] Add cases to methods that weren't handling all `VersionType`s - [x] Rework some places to clarify typing for `mypy` - [x] Simplify / optimize _next_version - [x] Make StandardVersion.string a property to enable lazy comparison Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-28filesystem.py: remove unused md5sum (#47832)Harmen Stoppels1-16/+0
2024-11-28traverse: add MixedDepthVisitor, use in cmake (#47750)Harmen Stoppels3-19/+136
This visitor accepts the sub-dag of all nodes and unique edges that have deptype X directly from given roots, or deptype Y transitively for any of the roots.
2024-11-28darwin: preserve hardlinks on codesign/install_name_tool (#47808)Harmen Stoppels5-13/+49
2024-11-27gcc-runtime: remove libz.so from libgfortran.so if present (#47812)Harmen Stoppels1-24/+42
2024-11-26Docs: Reference 7z requirement on Windows (#35943)kwryankrattiger1-0/+8
2024-11-26Intel/oneapi compilers: correct version ranges for diab-disable flag (#47428)Dom Heinzeller2-4/+4
* c/c++ flags should have been modified for all 2023.x.y versions, but upper bound was too low * Fortran flags should have been modified for all 2024.x.y versions, but likewise the upper bound was too low
2024-11-25install_test: first look at builder, then package (#47735)Harmen Stoppels1-14/+7
2024-11-22traverse.py: ensure topo order is bfs for trees (#47720)Harmen Stoppels5-109/+96
2024-11-20spack style: import-check -> import, fix bugs, exclude spack.pkg (#47690)Harmen Stoppels13-13/+50
2024-11-19Make oneAPI library-with-sdk specialize library class (#47632)Mark Abraham1-1/+1
2024-11-19solver: add a timeout handle for users (#47661)Massimiliano Culpo2-1/+18
This PR adds a configuration setting to allow setting time limits for concretization. For backward compatibility, the default is to set no time limit.
2024-11-19Restore message when concretizing in parallel (#47663)Massimiliano Culpo1-0/+5
It was lost in #44843
2024-11-18cached_cmake: mpifc is not always defined (#46861)Richard Berger1-1/+4
* cached_cmake: mpifc is not always defined * mpich: only depend on fortran when +fortran
2024-11-17Add an audit to prevent using the name "all" in packages (#47651)Massimiliano Culpo1-0/+5
Packages cannot be named like that, since we use "all" to indicate default settings under the "packages" section of the configuration.
2024-11-17style.py: add import-check for missing & redundant imports (#47619)Harmen Stoppels2-20/+241
2024-11-17spack.package / builtin repo: fix exports/imports (#47617)Harmen Stoppels2-8/+6
Add various missing imports in packages. Remove redundant imports Export NoLibrariesError, NoHeadersError, which_string in spack.package
2024-11-15build(deps): bump sphinx-rtd-theme in /lib/spack/docs (#47588)dependabot[bot]1-1/+1
Bumps [sphinx-rtd-theme](https://github.com/readthedocs/sphinx_rtd_theme) from 3.0.1 to 3.0.2. - [Changelog](https://github.com/readthedocs/sphinx_rtd_theme/blob/master/docs/changelog.rst) - [Commits](https://github.com/readthedocs/sphinx_rtd_theme/compare/3.0.1...3.0.2) --- updated-dependencies: - dependency-name: sphinx-rtd-theme dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-15Add missing llnl.* imports (#47618)Harmen Stoppels2-2/+3
2024-11-15Improve type hints for package API (#47576)Harmen Stoppels37-700/+817
by disentangling `package_base`, `builder` and `directives`.
2024-11-14Rework `spack.database.InstallStatuses` into a flag (#47321)Massimiliano Culpo15-155/+192
2024-11-14Remove support for PGI compilers (#47195)Massimiliano Culpo13-260/+28
2024-11-13Spec: prefer a splice-specific method to `__len__` (#47585)Todd Gamblin5-25/+37
Automatic splicing say `Spec` grow a `__len__` method but it's only used in one place and it's not clear the semantics are useful elsewhere. It also runs the risk of Specs one day being confused for other types of containers. Rather than introduce a new function for one algorithm, let's use a more specific method in the splice code. - [x] Use topological ordering in `_resolve_automatic_splices` instead of sorting by node count - [x] delete `Spec.__len__()` and `Spec.__bool__()` --------- Signed-off-by: Todd Gamblin <tgamblin@llnl.gov> Co-authored-by: Greg Becker <becker33@llnl.gov> Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-11-14Update tutorial version (#47593)psakievich1-1/+1
2024-11-13`spack spec`: simplify and unify output (#47574)Todd Gamblin1-42/+23
`spack spec` output has looked like this for a while: ```console > spack spec /v5fn6xo /wd2p2v7 Input spec -------------------------------- - /v5fn6xo Concretized -------------------------------- [+] openssl@3.3.1%apple-clang@16.0.0~docs+shared build_system=generic certs=mozilla arch=darwin-sequoia-m1 [+] ^ca-certificates-mozilla@2023-05-30%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1 ... Input spec -------------------------------- - /wd2p2v7 Concretized -------------------------------- [+] py-six@1.16.0%apple-clang@16.0.0 build_system=python_pip arch=darwin-sequoia-m1 [+] ^py-pip@23.1.2%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1 ``` But the input spec is right there on the CLI, and it doesn't add anything to the output. Also, since #44843, specs concretized in the CLI line can be unified, so it makes sense to display them as we did in #44489 -- as one multi-root tree instead of as multiple single-root trees. With this PR, concretize output now looks like this: ```console > spack spec /v5fn6xo /wd2p2v7 [+] openssl@3.3.1%apple-clang@16.0.0~docs+shared build_system=generic certs=mozilla arch=darwin-sequoia-m1 [+] ^ca-certificates-mozilla@2023-05-30%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1 [+] ^gmake@4.4.1%apple-clang@16.0.0~guile build_system=generic arch=darwin-sequoia-m1 [+] ^perl@5.40.0%apple-clang@16.0.0+cpanm+opcode+open+shared+threads build_system=generic arch=darwin-sequoia-m1 [+] ^berkeley-db@18.1.40%apple-clang@16.0.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=darwin-sequoia-m1 [+] ^bzip2@1.0.8%apple-clang@16.0.0~debug~pic+shared build_system=generic arch=darwin-sequoia-m1 [+] ^diffutils@3.10%apple-clang@16.0.0 build_system=autotools arch=darwin-sequoia-m1 [+] ^libiconv@1.17%apple-clang@16.0.0 build_system=autotools libs=shared,static arch=darwin-sequoia-m1 [+] ^gdbm@1.23%apple-clang@16.0.0 build_system=autotools arch=darwin-sequoia-m1 [+] ^readline@8.2%apple-clang@16.0.0 build_system=autotools patches=bbf97f1 arch=darwin-sequoia-m1 [+] ^ncurses@6.5%apple-clang@16.0.0~symlinks+termlib abi=none build_system=autotools patches=7a351bc arch=darwin-sequoia-m1 [+] ^pkgconf@2.2.0%apple-clang@16.0.0 build_system=autotools arch=darwin-sequoia-m1 [+] ^zlib-ng@2.2.1%apple-clang@16.0.0+compat+new_strategies+opt+pic+shared build_system=autotools arch=darwin-sequoia-m1 [+] ^gnuconfig@2022-09-17%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1 [+] py-six@1.16.0%apple-clang@16.0.0 build_system=python_pip arch=darwin-sequoia-m1 [+] ^py-pip@23.1.2%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1 [+] ^py-setuptools@69.2.0%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1 [-] ^py-wheel@0.41.2%apple-clang@16.0.0 build_system=generic arch=darwin-sequoia-m1 ... ``` With no input spec displayed -- just the concretization output shown as one consolidated tree and multiple roots. - [x] remove "Input Spec" section and "Concretized" header from `spack spec` output - [x] print concretized specs as one BFS tree instead of multiple --------- Signed-off-by: Todd Gamblin <tgamblin@llnl.gov> Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2024-11-13bump version to 0.24.0.dev0 (#47578)Harmen Stoppels1-1/+1
2024-11-13missing and redundant imports (#47577)Harmen Stoppels5-4/+5
2024-11-12Add solver capability for synthesizing splices of ABI compatible packages. ↵John Gouwar14-56/+689
(#46729) This PR provides complementary 2 features: 1. An augmentation to the package language to express ABI compatibility relationships among packages. 2. An extension to the concretizer that can synthesize splices between ABI compatible packages. 1. The `can_splice` directive and ABI compatibility We augment the package language with a single directive: `can_splice`. Here is an example of a package `Foo` exercising the `can_splice` directive: class Foo(Package): version("1.0") version("1.1") variant("compat", default=True) variant("json", default=False) variant("pic", default=False) can_splice("foo@1.0", when="@1.1") can_splice("bar@1.0", when="@1.0+compat") can_splice("baz@1.0+compat", when="@1.0+compat", match_variants="*") can_splice("quux@1.0", when=@1.1~compat", match_variants="json") Explanations of the uses of each directive: - `can_splice("foo@1.0", when="@1.1")`: If `foo@1.0` is the dependency of an already installed spec and `foo@1.1` could be a valid dependency for the parent spec, then `foo@1.1` can be spliced in for `foo@1.0` in the parent spec. - `can_splice("bar@1.0", when="@1.0+compat")`: If `bar@1.0` is the dependency of an already installed spec and `foo@1.0+compat` could be a valid dependency for the parent spec, then `foo@1.0+compat` can be spliced in for `bar@1.0+compat` in the parent spec - `can_splice("baz@1.0", when="@1.0+compat", match_variants="*")`: If `baz@1.0+compat` is the dependency of an already installed spec and `foo@1.0+compat` could be a valid dependency for the parent spec, then `foo@1.0+compat` can be spliced in for `baz@1.0+compat` in the parent spec, provided that they have the same value for all other variants (regardless of what those values are). - `can_splice("quux@1.0", when=@1.1~compat", match_variants="json")`:If `quux@1.0` is the dependency of an already installed spec and `foo@1.1~compat` could be a valid dependency for the parent spec, then `foo@1.0~compat` can be spliced in for `quux@1.0` in the parent spec, provided that they have the same value for their `json` variant. 2. Augmenting the solver to synthesize splices ### Changes to the hash encoding in `asp.py` Previously, when including concrete specs in the solve, they would have the following form: installed_hash("foo", "xxxyyy") imposed_constraint("xxxyyy", "foo", "attr1", ...) imposed_constraint("xxxyyy", "foo", "attr2", ...) % etc. Concrete specs now have the following form: installed_hash("foo", "xxxyyy") hash_attr("xxxyyy", "foo", "attr1", ...) hash_attr("xxxyyy", "foo", "attr2", ...) This transformation allows us to control which constraints are imposed when we select a hash, to facilitate the splicing of dependencies. 2.1 Compiling `can_splice` directives in `asp.py` Consider the concrete spec: foo@2.72%gcc@11.4 arch=linux-ubuntu22.04-icelake build_system=autotools ^bar ... It will emit the following facts for reuse (below is a subset) installed_hash("foo", "xxxyyy") hash_attr("xxxyyy", "hash", "foo", "xxxyyy") hash_attr("xxxyyy", "version", "foo", "2.72") hash_attr("xxxyyy", "node_os", "ubuntu22.04") hash_attr("xxxyyy", "hash", "bar", "zzzqqq") hash_attr("xxxyyy", "depends_on", "foo", "bar", "link") Rules that derive abi_splice_conditions_hold will be generated from use of the `can_splice` directive. They will have the following form: can_splice("foo@1.0.0+a", when="@1.0.1+a", match_variants=["b"]) ---> abi_splice_conditions_hold(0, node(SID, "foo"), "foo", BaseHash) :- installed_hash("foo", BaseHash), attr("node", node(SID, SpliceName)), attr("node_version_satisfies", node(SID, "foo"), "1.0.1"), hash_attr("hash", "node_version_satisfies", "foo", "1.0.1"), attr("variant_value", node(SID, "foo"), "a", "True"), hash_attr("hash", "variant_value", "foo", "a", "True"), attr("variant_value", node(SID, "foo"), "b", VariVar0), hash_attr("hash", "variant_value", "foo", "b", VariVar0). 2.2 Synthesizing splices in `concretize.lp` and `splices.lp` The ASP solver generates "splice_at_hash" attrs to indicate that a particular node has a splice in one of its immediate dependencies. Splices can be introduced in the dependencies of concrete specs when `splices.lp` is conditionally loaded (based on the config option `concretizer:splice:True`. 2.3 Constructing spliced specs in `asp.py` The method `SpecBuilder._resolve_splices` implements a top-down memoized implementation of hybrid splicing. This is an optimization over the more general `Spec.splice`, since the solver gives a global view of exactly which specs can be shared, to ensure the minimal number of splicing operations. Misc changes to facilitate configuration and benchmarking - Added the method `Solver.solve_with_stats` to expose timers from the public interface for easier benchmarking - Added the boolean config option `concretizer:splice` to conditionally load splicing behavior Co-authored-by: Greg Becker <becker33@llnl.gov>
2024-11-12parse_specs: special case for concretizing lookups quickly (#47556)Greg Becker4-3/+182
We added unification semantics for parsing specs from the CLI, but there are a couple of special cases in which we can avoid calls to the concretizer for speed when the specs can all be resolved by lookups. - [x] special case 1: solving a single spec - [x] special case 2: all specs are either concrete (come from a file) or have an abstract hash. In this case if concretizer:unify:true we need an additional check to confirm the specs are compatible. - [x] add a parameterized test for unifying on the CI --------- Signed-off-by: Todd Gamblin <tgamblin@llnl.gov> Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-12getting_started.rst: fix list of spack deps (#47557)Harmen Stoppels1-3/+3
2024-11-11Compiler.default_libc: early exit on darwin/win (#47554)Harmen Stoppels1-2/+13
* Compiler.default_libc: early exit on darwin/win * use .cc when testing c++ compiler if c compiler is missing
2024-11-11Bugfix: `spack find -x` in environments (#46798)Peter Scheibel5-45/+242
This addresses part [1] of #46345 #44713 introduced a bug where all non-spec query parameters like date ranges, -x, etc. were ignored when an env was active. This fixes that issue and adds tests for it. --------- Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl>
2024-11-11Move concretization tests to the same folder (#47539)Massimiliano Culpo6-0/+0
* Move concretization tests to the same folder Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com> * Fix for clingo-cffi --------- Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-11-11mirrors: allow username/password as environment variables (#46549)kwryankrattiger9-57/+520
`spack mirror add` and `set` now have flags `--oci-password-variable`, `--oci-password-variable`, `--s3-access-key-id-variable`, `--s3-access-key-secret-variable`, `--s3-access-token-variable`, which allows users to specify an environment variable in which a username or password is stored. Storing plain text passwords in config files is considered deprecated. The schema for mirrors.yaml has changed, notably the `access_pair` list is generally replaced with a dictionary of `{id: ..., secret_variable: ...}` or `{id_variable: ..., secret_variable: ...}`.
2024-11-11solver: avoid parsing specs in setupTodd Gamblin5-16/+20
- [x] Get rid of a call to `parser.quote_if_needed()` during solver setup, which introduces a circular import and also isn't necessary. - [x] Rename `spack.variant.Value` to `spack.variant.ConditionalValue`, as it is *only* used for conditional values. This makes it much easier to understand some of the logic for variant definitions. Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl> Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-11-11imports: move `conditional` to `directives.py`Todd Gamblin3-15/+13
`conditional()`, which defines conditional variant values, and the other ways to declare variant values should probably be in a layer above `spack.variant`. This does the simple thing and moves *just* `conditional()` to `spack.directives` to avoid a circular import. We can revisit the public variant interface later, when we split packages from core. Co-authored-by: Harmen Stoppels <me@harmenstoppels.nl> Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>