From fd3efc71fd3c97a9b83bd0b44d706a32049d3fc0 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 17 Apr 2023 16:54:27 -0700 Subject: 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 --- lib/spack/spack/solver/asp.py | 17 ++++++++++++++--- 1 file 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)) -- cgit v1.2.3-70-g09d2