From 43c8bb9fa3faabe832152990b81384ae09444255 Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Wed, 10 Jul 2024 14:20:51 -0700 Subject: [PATCH] fix bug with transitive splice with dependency virtuals --- lib/spack/spack/spec.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 7e143d57ab9..06823bb4dab 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -4187,9 +4187,19 @@ def splice(self, other, transitive): for v in other.package.virtuals_provided if v in self or v in self.package.virtuals_provided ] + if transitive: + virtuals_to_replace.extend([ + v.name + for od in other.traverse(root=False) + for v in od.package.virtuals_provided + if v in self or v in self.package.virtuals_provided + ]) if virtuals_to_replace: - deps_to_replace = dict((self[v], other) for v in virtuals_to_replace) + deps_to_replace = { + self[v]: (other[v] if v in other else other) + for v in virtuals_to_replace + } # deps_to_replace = [self[v] for v in virtuals_to_replace] else: # TODO: sanity check and error raise here for other.name not in self