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.
This commit is contained in:
parent
161b30a32f
commit
3261889e3a
10 changed files with 31 additions and 5 deletions
7
.github/workflows/audit.yaml
vendored
7
.github/workflows/audit.yaml
vendored
|
@ -17,7 +17,10 @@ concurrency:
|
|||
jobs:
|
||||
# Run audits on all the packages in the built-in repository
|
||||
package-audits:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ${{ matrix.operating_system }}
|
||||
strategy:
|
||||
matrix:
|
||||
operating_system: ["ubuntu-latest", "macos-latest"]
|
||||
steps:
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # @v2
|
||||
- uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # @v2
|
||||
|
@ -41,4 +44,4 @@ jobs:
|
|||
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # @v2.1.0
|
||||
if: ${{ inputs.with_coverage == 'true' }}
|
||||
with:
|
||||
flags: unittests,linux,audits
|
||||
flags: unittests,audits
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -22,7 +22,7 @@ class ArmForge(Package):
|
|||
# TODO: this mess should be fixed as soon as a way to parametrize/constrain
|
||||
# versions (and checksums) based on the target platform shows up
|
||||
|
||||
if platform.machine() == "aarch64":
|
||||
if platform.machine() in ["aarch64", "arm64"]:
|
||||
version(
|
||||
"22.1.3", sha256="131884f998b82673e885a7b42cc883210e3a0229b50af374092140cdfd42a408"
|
||||
)
|
||||
|
|
|
@ -494,6 +494,8 @@ class Cuda(Package):
|
|||
maintainers("ax3l", "Rombur")
|
||||
executables = ["^nvcc$"]
|
||||
|
||||
skip_version_audit = ["platform=darwin"]
|
||||
|
||||
for ver, packages in _versions.items():
|
||||
key = "{0}-{1}".format(platform.system(), platform.machine())
|
||||
pkg = packages.get(key)
|
||||
|
|
|
@ -260,6 +260,8 @@ class Cudnn(Package):
|
|||
# need to use modified URLs like in url_for_version.
|
||||
maintainers("adamjstewart", "bvanessen")
|
||||
|
||||
skip_version_audit = ["platform=darwin"]
|
||||
|
||||
for ver, packages in _versions.items():
|
||||
key = "{0}-{1}".format(platform.system(), platform.machine())
|
||||
pkg = packages.get(key)
|
||||
|
|
|
@ -27,6 +27,8 @@ class Cutensor(Package):
|
|||
maintainers("bvanessen")
|
||||
url = "cutensor"
|
||||
|
||||
skip_version_audit = ["platform=darwin"]
|
||||
|
||||
for ver, packages in _versions.items():
|
||||
key = "{0}-{1}".format(platform.system(), platform.machine())
|
||||
pkg = packages.get(key)
|
||||
|
|
|
@ -47,6 +47,8 @@ class GitAnnex(Package):
|
|||
# - $ git annex whereis git-annex/linux/current/git-annex-standalone-arm64.tar.gz
|
||||
# -> gives web url
|
||||
|
||||
skip_version_audit = ["platform=darwin"]
|
||||
|
||||
if platform.system() == "Linux" and platform.machine() == "aarch64":
|
||||
# git-annex-standalone-arm64.tar.gz
|
||||
version(
|
||||
|
|
|
@ -178,6 +178,8 @@ class Hpcviewer(Package):
|
|||
|
||||
system = platform.system().lower()
|
||||
machine = platform.machine().lower()
|
||||
if machine == "arm64":
|
||||
machine = "aarch64"
|
||||
|
||||
# Versions for MacOSX / Darwin
|
||||
if system == "darwin":
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
),
|
||||
},
|
||||
"darwin": {
|
||||
"aarch64": (
|
||||
"arm64": (
|
||||
"https://download2.gluonhq.com/openjfx/20.0.1/openjfx-20.0.1_osx-aarch64_bin-sdk.zip",
|
||||
"baebdbbe283c17df62fc4c0bdc2bde4415f2253f99ba41437f9336e2272c255e",
|
||||
),
|
||||
|
|
|
@ -322,6 +322,8 @@ class Nvhpc(Package):
|
|||
maintainers("samcmill")
|
||||
tags = ["e4s"]
|
||||
|
||||
skip_version_audit = ["platform=darwin"]
|
||||
|
||||
for ver, packages in _versions.items():
|
||||
key = "{0}-{1}".format(platform.system(), platform.machine())
|
||||
pkg = packages.get(key)
|
||||
|
|
Loading…
Reference in a new issue