diff options
author | Greg Becker <becker33@llnl.gov> | 2022-03-30 05:19:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-30 14:19:52 +0200 |
commit | 58a32b04d90da7d2edc4388e78feb84abe8fb089 (patch) | |
tree | afe6efb047cbcd638e78df72a6caa0aa324c10a6 | |
parent | d13c1cfa9fd6155adf7483d4ca42fd389f4b3638 (diff) | |
download | spack-58a32b04d90da7d2edc4388e78feb84abe8fb089.tar.gz spack-58a32b04d90da7d2edc4388e78feb84abe8fb089.tar.bz2 spack-58a32b04d90da7d2edc4388e78feb84abe8fb089.tar.xz spack-58a32b04d90da7d2edc4388e78feb84abe8fb089.zip |
patch cache: fix bug finding inherited packages (#29574)
-rw-r--r-- | lib/spack/spack/package.py | 19 | ||||
-rw-r--r-- | lib/spack/spack/patch.py | 8 |
2 files changed, 25 insertions, 2 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index e200985cdd..edd00caae6 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -401,6 +401,21 @@ class PackageMeta( return '%s.%s' % (self.namespace, self.name) @property + def fullnames(self): + """ + Fullnames for this package and any packages from which it inherits. + """ + fullnames = [] + for cls in inspect.getmro(self): + namespace = getattr(cls, 'namespace', None) + if namespace: + fullnames.append('%s.%s' % (namespace, self.name)) + if namespace == 'builtin': + # builtin packages cannot inherit from other repos + break + return fullnames + + @property def name(self): """The name of this package. @@ -912,6 +927,10 @@ class PackageBase(six.with_metaclass(PackageMeta, PackageViewMixin, object)): return type(self).fullname @property + def fullnames(self): + return type(self).fullnames + + @property def name(self): """Name of this package (the module without parent modules).""" return type(self).name diff --git a/lib/spack/spack/patch.py b/lib/spack/spack/patch.py index 4485313053..33f9fa57eb 100644 --- a/lib/spack/spack/patch.py +++ b/lib/spack/spack/patch.py @@ -368,8 +368,12 @@ class PatchCache(object): "Couldn't find patch for package %s with sha256: %s" % (pkg.fullname, sha256)) - patch_dict = sha_index.get(pkg.fullname) - if not patch_dict: + # Find patches for this class or any class it inherits from + for fullname in pkg.fullnames: + patch_dict = sha_index.get(fullname) + if patch_dict: + break + else: raise NoSuchPatchError( "Couldn't find patch for package %s with sha256: %s" % (pkg.fullname, sha256)) |