summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2024-10-07Bugfix/Installer: properly track task queueing (#46293)Tamara Dahlgren4-64/+121
* Bugfix/Installer: properly track task queueing * Move ordinal() to llnl.string; change time to attempt * Convert BuildTask to use kwargs (after pkg); convert STATUS_ to BuildStats enum * BuildTask: instantiate with keyword only args after the request * Installer: build request is required for initializing task * Installer: only the initial BuildTask cannnot have status REMOVED * Change queueing check * ordinal(): simplify suffix determination [tgamblin] * BuildStatus: ADDED -> QUEUED [becker33] * BuildTask: clarify TypeError for 'installed' argument
2024-10-04`gc`: restrict to specific specs (#46790)Todd Gamblin2-1/+23
`spack gc` has so far been a global or environment-specific thing. This adds the ability to restrict garbage collection to specific specs, e.g. if you *just* want to get rid of all your unused python installations, you could write: ```console spack gc python ``` - [x] add `constraint` arg to `spack gc` - [x] add a simple test Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-10-04re2c: rework package to use multiple build systems (#46748)Massimiliano Culpo7-7/+7
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-10-03Better docs and typing for `_setup_pkg_and_run` (#46709)Todd Gamblin1-8/+52
There was a bit of mystery surrounding the arguments for `_setup_pkg_and_run`. It passes two file descriptors for handling the `gmake`'s job server in child processes, but they are unsed in the method. It turns out that there are good reasons to do this -- depending on the multiprocessing backend, these file descriptors may be closed in the child if they're not passed directly to it. - [x] Document all args to `_setup_pkg_and_run`. - [x] Document all arguments to `_setup_pkg_and_run`. - [x] Add type hints for `_setup_pkg_and_run`. - [x] Refactor exception handling in `_setup_pkg_and_run` so it's easier to add type hints. `exc_info()` was problematic because it *can* return `None` (just not in the context where it's used). `mypy` was too dumb to notice this. Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-10-03Stand-alone testing: remove deprecated methods (#45752)AcriusWinter15-475/+224
* Stand-alone testing: remove deprecated methods * audit: replace deprecated test method checks for test callbacks (AcriusWinter) * install_test: replace deprecated with new test method name starts (AcriusWinter) * package_base: removed deprecated test methods (AcriusWinter) * test/package_class: remove deprecated test methods (AcriusWinter) * test/reporters: remove deprecated test methods (AcriusWinter) * reporters/extract: remove deprecated test-related methods (AcriusWinter) * py-test-callback: rename test in callbacks and output (AcriusWinter) * reporters/extract: remove deprecated expected failure output capture (AcriusWinter) * stand-alone test cleanup: f-string, remove deprecation warning, etc. (AcriusWinter) * stand-alone tests: f-string fix and remove unused imports (AcriusWinter) * package_base: finish removing the rest of deprecated run_test method (AcriusWinter) * py-test-callback: remove stand-alone test method (AcriusWinter) * package_base: remove now unused imports (AcriusWinter) * Python: test_imports replaces test (tldahlgren) * mptensor, trivial-smoke-test: replace deprecated cache_extra_test_sources method (tldahlgren) * trivial-smoke-test: replace deprecated install_test_root method (tldahlgren) * docs: update perl and scons package's test methods (tldahlgren) * builder: remove deprecated test() method (tldahlgren) * Update legion and mfem test data for stand-alone tests (tldahlgren) * py-test-callback: restore the test method * Audit/stand-alone testing: Fix and added stand-alone test audit checks - fix audit failure message for build-time test callback check - remove empty test method check during stand-alone testing - change build-time test callback check to package_properties - add test method docstring audit check and mock fail-test-audit-docstring pkg - add test method implementation audit check and mock fail-test-audit-impl pkg - add new mock packages to test_package_audits and test_test_list_all * audits: loosen docstring content constraints * Add missing test method docstring * py-test-callback: resolve builder issues * Audits: Add checks for use of deprecated stand-alone test methods; improve output for other test-related checks * Fix style issues * test_test_list_all: add new fail-test-audit-deprecated package --------- Signed-off-by: Tamara Dahlgren <dahlgren1@llnl.gov> Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
2024-10-02Do not fail noop jobs in Spack CI (#46713)kwryankrattiger1-1/+3
2024-10-02aspell_dict: remove unused import (#46716)Harmen Stoppels1-1/+0
2024-10-02GoPackage: fix attributes to allow for custom build_directory values (#46707)Alec Scott1-2/+13
2024-10-02cuda: add conflict for aarch64 with gcc-13.2.0 and cuda@12.4 (#46694)Andrew W Elble1-0/+5
https://github.com/spack/spack/pull/39666#issuecomment-2377609263
2024-10-02Revert "`cc`: ensure that RPATHs passed to linker are unique" (#46712)Harmen Stoppels2-175/+136
* Revert "`cc`: ensure that RPATHs passed to linker are unique" This reverts commit 2613a14c43b11ab92181bdd7ba57cd5b99f128a8. * Revert "`cc`: simplify ordered list handling" This reverts commit a76a48c42e8d6657f9dcb0500bff574651f317d9.
2024-10-01Docs: environment update (#44087)Tamara Dahlgren3-124/+140
Updated the terminology for the two types of environments to be consistent with that used in the tutorial for the last three years. Additionally: * changed 'anonymous' to 'independent in environment command+test for consistency.
2024-10-01build_environment: small cleanup and add todo comments (#46687)Harmen Stoppels1-51/+44
2024-10-01stable_partition: use TypeVar (#46686)Harmen Stoppels2-6/+12
2024-10-01Do not use single letter packages in unit-tests (#46665)Massimiliano Culpo1-89/+106
#45205 already removed previous use of single letter packages from unit tests, in view of reserving `c` as a language (see #45191). Some use of them has been re-introduced accidentally in #46382, and is making unit-tests fail in the feature branch #45189 since there `c` is a virtual package. Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-09-30avoid rpath'ing default search paths (#44686)Harmen Stoppels3-14/+71
On sysroot systems like gentoo prefix, as well as nix/guix, our "is system path" logic is broken cause it's static. Talking about "the system paths" is not helpful, we have to talk about default search paths of the dynamic linker instead. If glibc is recent enough, we can query the dynamic loader's default search paths, which is a much more robust way to avoid registering rpaths to system dirs, which can shadow Spack dirs. This PR adds an **additional** filter on rpaths the compiler wrapper adds, dropping rpaths that are default search paths. The PR **does not** remove any of the original `is_system_path` code yet. This fixes issues where build systems run just-built executables linked against their *not-yet-installed libraries*, typically: ``` LD_LIBRARY_PATH=. ./exe ``` which happens in `perl`, `python`, and other non-cmake packages. If a default path is rpath'ed, it takes precedence over `LD_LIBRARY_PATH`, and a system library gets loaded instead of the just-built library in the stage dir, breaking the build. If default paths are not rpath'ed, then LD_LIBRARY_PATH takes precedence, as is desired. This PR additionally fixes an inconsistency in rpaths between cmake and non-cmake packages. The cmake build system computed rpaths by itself, but used a different order than computed for the compiler wrapper. In fact it's not necessary to compute rpaths at all, since we let cmake do that thanks to `CMAKE_INSTALL_RPATH_USE_LINK_PATH`. This covers rpaths for all dependencies. The only install rpaths we need to set are `<install prefix>/{lib,lib64}`, which cmake unfortunately omits, although it could also know these. Also, cmake does *not* delete rpaths added by the toolchain (i.e. Spack's compiler wrapper), so I don't think it should be controversial to simplify things.
2024-09-27Better shell completion support for packages (#44756)Alec Scott2-0/+49
2024-09-27Spec.splice: Allow splices when multiples nodes in the DAG share a name (#46382)Greg Becker6-136/+514
The current `Spec.splice` model is very limited by the inability to splice specs that contain multiple nodes with the same name. This is an artifact of the original algorithm design predating the separate concretization of build dependencies, which was the first feature to allow multiple specs in a DAG to share a name. This PR provides a complete reimplementation of `Spec.splice` to avoid that limitation. At the same time, the new algorithm ensures that build dependencies for spliced specs are not changed, since the splice by definition cannot change the build-time information of the spec. This is handled by splitting the dependency edges and link/run edges into separate dependencies as needed. Signed-off-by: Gregory Becker <becker33@llnl.gov>
2024-09-27CI: Add documentation for adding new stacks and runners (#42179)kwryankrattiger1-0/+209
* CI: Add documentation for adding new stacks and runners * More docs for runner registration --------- Co-authored-by: Zack Galbreath <zack.galbreath@kitware.com> Co-authored-by: Bernhard Kaindl <contact@bernhard.kaindl.dev>
2024-09-27spec: simplify string formatting (#46609)Massimiliano Culpo6-18/+20
This PR shorten the string representation for concrete specs, in order to make it more legible. Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-09-27docs: add --depth=2 to reduce download size (#46605)Alec Scott2-3/+12
* docs: add --depth=2 to reduce download size * Add note to tell users about --depth=2 and manyFiles * Fix inline code in info block
2024-09-27`cc`: ensure that RPATHs passed to linker are uniqueTodd Gamblin2-26/+114
macOS Sequoia's linker will complain if RPATHs on the CLI are specified more than once. To avoid errors due to this, make `cc` only append unique RPATHs to the final args list. This required a few improvements to the logic in `cc`: 1. List functions in `cc` didn't have any way to append unique elements to a list. Add a `contains()` shell function that works like our other list functions. Use it to implement an optional `"unique"` argument to `append()` and an `extend_unique()`. Use that to add RPATHs to the `args_list`. 2. In the pure `ld` case, we weren't actually parsing `RPATH` arguments separately as we do for `ccld`. Fix this by adding *another* nested case statement for raw `RPATH` parsing. There are now 3 places where we deal with `-rpath` and friends, but I don't see a great way to unify them, as `-Wl,`, `-Xlinker`, and raw `-rpath` arguments are all ever so slightly different. 3. Fix ordering of assertions to make `pytest` diffs more intelligible. The meaning of `+` and `-` in diffs changed in `pytest` 6.0 and the "preferred" order for assertions became `assert actual == expected` instead of the other way around. Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-09-27`cc`: simplify ordered list handlingTodd Gamblin1-114/+65
`cc` divides most paths up into system paths, spack managed paths, and other paths. This gets really repetitive and makes the code hard to read. Simplify the script by adding some functions to do most of the redundant work for us. Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-09-27aspell: various fixes and updates (#46383)Richard Berger1-13/+9
SimpleFilesystemView was producing an error due to looking for a <prefix>/lib/.spack folder. Also, view_destination had no effect and wasn't called. Changed this by instead patching in the correct installation prefix for dictionaries. Since aspell is using the resolved path of the executable prefix, the runtime environment variable ASPELL_CONF is set to correct the prefix when in a view. With this change aspell can now find installed dictionaries. Verified with: aspell dump config aspell dump dicts
2024-09-26Add a custom hook for dev_path changes (#46529)psakievich3-6/+21
* Add a custom hook for dev_path changes Co-authored-by: Greg Becker <becker33@llnl.gov>
2024-09-25Remove a few redundant imports (#46512)Harmen Stoppels5-5/+0
2024-09-24Fix off-by-one padding bug (#46560)Samuel Browne2-3/+27
If `add_padding()` is allowed to return a path with a trailing path separator, it will get collapsed elsewhere in Spack. This can lead to buildcache entries that have RPATHS that are too short to be replaced by other users whose install root happens to be padded to the correct length. Detect this and replace the trailing path separator with a concrete path character. Signed-off-by: Samuel E. Browne <sebrown@sandia.gov>
2024-09-23database: don't call `socket.getfqdn()` on every write (#46554)Todd Gamblin1-1/+13
We've seen `getfqdn()` cause slowdowns on macOS in CI when added elsewhere. It's also called by database.py every time we write the DB file. - [x] replace the call with a memoized version so that it is only called once per process. Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
2024-09-23solver: use a new heuristic (#46548)Massimiliano Culpo1-22/+27
This PR introduces a new heuristic for the solver, which behaves better when compilers are treated as nodes. Apparently, it performs better also on `develop`, where compilers are still node attributes. The new heuristic: - Sets an initial priority for guessing a few attributes. The order is "nodes" (300), "dependencies" (150), "virtual dependencies" (60), "version" and "variants" (30), and "targets" and "compilers" (1). This initial priority decays over time during the solve, and falls back to the defaults. - By default, it considers most guessed facts as "false". For instance, by default a node doesn't exist in the optimal answer set, or a version is not picked as a node version etc. - There are certain conditions that override the default heuristic using the _priority_ of a rule, which previously we didn't use. For instance, by default we guess that a `attr("variant", Node, Variant, Value)` is false, but if we know that the node is already in the answer set, and the value is the default one, then we guess it is true. Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-09-24spec: fix spelling (#46550)Justin Cook1-4/+4
Signed-off-by: Justin Cook <jscook@lbl.gov>
2024-09-21Remove `spack.target` from code (#46503)Massimiliano Culpo20-308/+178
The `spack.target.Target` class is a weird entity, that is just needed to: 1. Sort microarchitectures in lists deterministically 2. Being able to use microarchitectures in hashed containers This PR removes it, and uses `archspec.cpu.Microarchitecture` directly. To sort lists, we use a proper `key=` when needed. Being able to use `Microarchitecture` objects in sets is achieved by updating the external `archspec`. Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-09-20Docs/Windows: Clarify supported shells and caveats (#46381)John W. Parent2-22/+20
While the existing getting started guide does in fact reference the powershell support, it's a footnote and easily missed. This PR adds explicit, upfront mentions of the powershell support. Additionally this PR adds notes about some of the issues with certain components of the spec syntax when using CMD.
2024-09-20spack.modules: move get_module up (#46428)Harmen Stoppels4-67/+76
2024-09-20Remove code from Compiler that is not used anymore (#45982)Massimiliano Culpo19-314/+26
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-09-20do_install: post #46423 cleanup (#46496)Tamara Dahlgren3-4/+5
2024-09-19package_base: break dependency on installer (#46423)Harmen Stoppels29-196/+249
Removes `spack.package_base.PackageBase.do_{install,deprecate}` in favor of `spack.installer.PackageInstaller.install` and `spack.installer.deprecate` resp. That drops a dependency of `spack.package_base` on `spack.installer`, which is necessary to get rid of circular dependencies in Spack. Also change the signature of `PackageInstaller.__init__` from taking a dict as positional argument, to an explicit list of keyword arguments.
2024-09-19require spec in develop entry (#46485)Harmen Stoppels1-0/+1
2024-09-19url join: fix oci scheme (#46483)Harmen Stoppels3-4/+7
* url.py: also special case oci scheme in join * avoid fetching keys from oci mirror
2024-09-19Revert "For "when:" and install_environment.json: Support fully qualified ↵Harmen Stoppels2-4/+2
hos…" (#46478) This reverts commit 6b0011c8f1293510a784a0eaa0a2a10e03339f16. It caused a major performance penalty in unit test time on macOS (about 30 minutes).
2024-09-19docs: refer to upstreams.yaml in chain.rst title (#46475)Harmen Stoppels1-3/+3
2024-09-19spack.util.url: fix join breakage in python 3.12.6 (#46453)Harmen Stoppels2-318/+84
2024-09-19avoid multiprocessing in tests (#46439)Harmen Stoppels5-15/+23
- silences a few pytest warnings related to forking in xdist - speeds up a few tests / avoids possible oversubscription in xdist
2024-09-18Bump archspec to latest commit (#46445)Massimiliano Culpo2-7/+3
This should fix an issue with Neoverse XX detection Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2024-09-17variants: Unify metadata dictionaries to index by `when` (#44425)Todd Gamblin19-633/+1122
Continuing the work started in #40326, his changes the structure of Variant metadata on Packages from a single variant definition per name with a list of `when` specs: ``` name: (Variant, [when_spec, ...]) ``` to a Variant definition per `when_spec` per name: ``` when_spec: { name: Variant } ``` With this change, everything on a package *except* versions is keyed by `when` spec. This: 1. makes things consistent, in that conditional things are (nearly) all modeled in the same way; and 2. fixes an issue where we would lose information about multiple variant definitions in a package (see #38302). We can now have, e.g., different defaults for the same variant in different versions of a package. Some notes: 1. This required some pretty deep changes to the solver. Previously, the solver's job was to select value(s) for a single variant definition per name per package. Now, the solver needs to: a. Determine which variant definition should be used for a given node, which can depend on the node's version, compiler, target, other variants, etc. b. Select valid value(s) for variants for each node based on the selected variant definition. When multiple variant definitions are enabled via their `when=` clause, we will always prefer the *last* matching definition, by declaration order in packages. This is implemented by adding a `precedence` to each variant at definition time, and we ensure they are added to the solver in order of precedence. This has the effect that variant definitions from derived classes are preferred over definitions from superclasses, and the last definition within the same class sticks. This matches python semantics. Some examples: ```python class ROCmPackage(PackageBase): variant("amdgpu_target", ..., when="+rocm") class Hipblas(ROCmPackage): variant("amdgpu_target", ...) ``` The global variant in `hipblas` will always supersede the `when="+rocm"` variant in `ROCmPackage`. If `hipblas`'s variant was also conditional on `+rocm` (as it probably should be), we would again filter out the definition from `ROCmPackage` because it could never be activated. If you instead have: ```python class ROCmPackage(PackageBase): variant("amdgpu_target", ..., when="+rocm") class Hipblas(ROCmPackage): variant("amdgpu_target", ..., when="+rocm+foo") ``` The variant on `hipblas` will win for `+rocm+foo` but the one on `ROCmPackage` will win with `rocm~foo`. So, *if* we can statically determine if a variant is overridden, we filter it out. This isn't strictly necessary, as the solver can handle many definitions fine, but this reduces the complexity of the problem instance presented to `clingo`, and simplifies output in `spack info` for derived packages. e.g., `spack info hipblas` now shows only one definition of `amdgpu_target` where before it showed two, one of which would never be used. 2. Nearly all access to the `variants` dictionary on packages has been refactored to use the following class methods on `PackageBase`: * `variant_names(cls) -> List[str]`: get all variant names for a package * `has_variant(cls, name) -> bool`: whether a package has a variant with a given name * `variant_definitions(cls, name: str) -> List[Tuple[Spec, Variant]]`: all definitions of variant `name` that are possible, along with their `when` specs. * `variant_items() -> `: iterate over `pkg.variants.items()`, with impossible variants filtered out. Consolidating to these methods seems to simplify the code a lot. 3. The solver does a lot more validation on variant values at setup time now. In particular, it checks whether a variant value on a spec is valid given the other constraints on that spec. This allowed us to remove the crufty logic in `update_variant_validate`, which was needed because we previously didn't *know* after a solve which variant definition had been used. Now, variant values from solves are constructed strictly based on which variant definition was selected -- no more heuristics. 4. The same prevalidation can now be done in package audits, and you can run: ``` spack audit packages --strict-variants ``` This turns up around 18 different places where a variant specification isn't valid given the conditions on variant definitions in packages. I haven't fixed those here but will open a separate PR to iterate on them. I plan to make strict checking the defaults once all existing package issues are resolved. It's not clear to me that strict checking should be the default for the prevalidation done at solve time. There are a few other changes here that might be of interest: 1. The `generator` variant in `CMakePackage` is now only defined when `build_system=cmake`. 2. `spack info` has been updated to support the new metadata layout. 3. split out variant propagation into its own `.lp` file in the `solver` code. 4. Add better typing and clean up code for variant types in `variant.py`. 5. Add tests for new variant behavior.
2024-09-17drop main dep from build_environment/subprocess_context (#46426)Harmen Stoppels4-18/+18
2024-09-17untangle spack.config / spack.util.cpus & spack.spec (#46427)Harmen Stoppels9-72/+65
2024-09-17package_base.py: do not depend on spack.environment (#46424)Harmen Stoppels1-3/+1
2024-09-17imports: automate missing imports (#46410)Harmen Stoppels136-170/+383
2024-09-16Add repositories for "requirements" and "flag mixing" unit tests (#46412)Massimiliano Culpo2-181/+29
2024-09-16Add missing & remove redundant imports (#46407)Harmen Stoppels111-189/+14
2024-09-16Fix a few circular deps (#46373)Harmen Stoppels26-226/+196