diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2023-04-17 16:54:27 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2023-05-15 09:15:49 -0700 |
commit | fd3efc71fd3c97a9b83bd0b44d706a32049d3fc0 (patch) | |
tree | 26c2076036e128ebe5b49f1aef4d130e3767ea8b | |
parent | 0458de18def570e8eb28625a474336edcd039e4e (diff) | |
download | spack-fd3efc71fd3c97a9b83bd0b44d706a32049d3fc0.tar.gz spack-fd3efc71fd3c97a9b83bd0b44d706a32049d3fc0.tar.bz2 spack-fd3efc71fd3c97a9b83bd0b44d706a32049d3fc0.tar.xz spack-fd3efc71fd3c97a9b83bd0b44d706a32049d3fc0.zip |
bugfix: don't look up virtual information for unknown packages
`spec_clauses()` attempts to look up package information for concrete specs in order to
determine which virtuals they may provide. This fails for renamed/deleted dependencies
of buildcaches and installed packages.
This will eventually be fixed by #35258, which adds virtual information on edges, but we
need a workaround to make older buildcaches usable.
- [x] make an exception for renamed packages and omit their virtual constraints
- [x] add a note that this will be solved by adding virtuals to edges
-rw-r--r-- | lib/spack/spack/solver/asp.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 359684db47..a4decb4b12 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -1669,9 +1669,20 @@ class SpackSolverSetup(object): if concrete_build_deps or dtype != "build": clauses.append(fn.attr("depends_on", spec.name, dep.name, dtype)) - # Ensure Spack will not coconcretize this with another provider - # for the same virtual - for virtual in dep.package.virtuals_provided: + # Skip virtual node constriants for renamed/deleted packages, + # so their binaries can still be installed. + # NOTE: with current specs (which lack edge attributes) this + # can allow concretizations with two providers, but it's unlikely. + try: + virtuals = dep.package.virtuals_provided + except spack.repo.UnknownPackageError: + continue + + # Don't concretize with two providers of the same virtual. + # See above for exception for unknown packages. + # TODO: we will eventually record provider information on edges, + # TODO: which avoids the need for the package lookup above. + for virtual in virtuals: clauses.append(fn.attr("virtual_node", virtual.name)) clauses.append(fn.provider(dep.name, virtual.name)) |