From 18b4670d9f5bdc71f4178442e6639ead24a76511 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 17 Apr 2023 15:03:37 -0700 Subject: [PATCH] bugfix: don't look up patches from packages for concrete specs The concretizer can fail with `reuse:true` if a buildcache or installation contains a package with a dependency that has been renamed or deleted in the main repo (e.g., `netcdf` was refactored to `netcdf-c`, `netcdf-fortran`, etc., but there are still binary packages with dependencies called `netcdf`). We should still be able to install things for which we are missing `package.py` files. `Spec.inject_patches_variant()` was failing this requirement by attempting to look up the package class for concrete specs. This isn't needed -- we can skip it. - [x] swap two conditions in `Spec.inject_patches_variant()` --- lib/spack/spack/spec.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 7d3014a71de..522485f57ea 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -2789,11 +2789,11 @@ def inject_patches_variant(root): # Also record all patches required on dependencies by # depends_on(..., patch=...) for dspec in root.traverse_edges(deptype=all, cover="edges", root=False): - pkg_deps = dspec.parent.package_class.dependencies - if dspec.spec.name not in pkg_deps: + if dspec.spec.concrete: continue - if dspec.spec.concrete: + pkg_deps = dspec.parent.package_class.dependencies + if dspec.spec.name not in pkg_deps: continue patches = []