ensure view projections for extensions always point to extendee (#33848)

This commit is contained in:
Greg Becker 2022-11-11 09:59:23 -08:00 committed by GitHub
parent d49c992b23
commit 2d2c591633
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -493,9 +493,14 @@ def get_projection_for_spec(self, spec):
Relies on the ordering of projections to avoid ambiguity. Relies on the ordering of projections to avoid ambiguity.
""" """
spec = spack.spec.Spec(spec) spec = spack.spec.Spec(spec)
proj = spack.projections.get_projection(self.projections, spec) locator_spec = spec
if spec.package.extendee_spec:
locator_spec = spec.package.extendee_spec
proj = spack.projections.get_projection(self.projections, locator_spec)
if proj: if proj:
return os.path.join(self._root, spec.format(proj)) return os.path.join(self._root, locator_spec.format(proj))
return self._root return self._root
def get_all_specs(self): def get_all_specs(self):
@ -743,6 +748,10 @@ def get_projection_for_spec(self, spec):
Relies on the ordering of projections to avoid ambiguity. Relies on the ordering of projections to avoid ambiguity.
""" """
spec = spack.spec.Spec(spec) spec = spack.spec.Spec(spec)
if spec.package.extendee_spec:
spec = spec.package.extendee_spec
proj = spack.projections.get_projection(self.projections, spec) proj = spack.projections.get_projection(self.projections, spec)
if proj: if proj:
return os.path.join(self._root, spec.format(proj)) return os.path.join(self._root, spec.format(proj))