diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2023-07-13 12:47:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-13 06:47:47 -0400 |
commit | 3261889e3a93ab942fd1776188c7ad31524574b4 (patch) | |
tree | b26934b49f1ae11a0ee8e42b6f17c80e49404121 /lib | |
parent | 161b30a32f2ec8f0c6b53d3171089eb17f8217ba (diff) | |
download | spack-3261889e3a93ab942fd1776188c7ad31524574b4.tar.gz spack-3261889e3a93ab942fd1776188c7ad31524574b4.tar.bz2 spack-3261889e3a93ab942fd1776188c7ad31524574b4.tar.xz spack-3261889e3a93ab942fd1776188c7ad31524574b4.zip |
spack audit: allow skipping version checks from package.py (#28372)
A few packages have version directives evaluated
within if statements, conditional on the value of
`platform.platform()`.
Sometimes there are no cases for e.g. platform=darwin and that
causes a lot of spurious failures with version existence
audits.
This PR allows expressing conditions to skip version
existence checks in audits and avoid these spurious reports.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/audit.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py index d8d1875ab7..e59ffaae55 100644 --- a/lib/spack/spack/audit.py +++ b/lib/spack/spack/audit.py @@ -725,11 +725,22 @@ def _version_constraints_are_satisfiable_by_some_version_in_repo(pkgs, error_cls dependencies_to_check.extend([edge.spec for edge in dependency_data.values()]) + host_architecture = spack.spec.ArchSpec.default_arch() for s in dependencies_to_check: dependency_pkg_cls = None try: dependency_pkg_cls = spack.repo.path.get_pkg_class(s.name) - assert any(v.intersects(s.versions) for v in list(dependency_pkg_cls.versions)) + # Some packages have hacks that might cause failures on some platform + # Allow to explicitly set conditions to skip version checks in that case + skip_conditions = getattr(dependency_pkg_cls, "skip_version_audit", []) + skip_version_check = False + for condition in skip_conditions: + if host_architecture.satisfies(spack.spec.Spec(condition).architecture): + skip_version_check = True + break + assert skip_version_check or any( + v.intersects(s.versions) for v in list(dependency_pkg_cls.versions) + ) except Exception: summary = ( "{0}: dependency on {1} cannot be satisfied " "by known versions of {1.name}" |