summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2023-07-13 12:47:47 +0200
committerGitHub <noreply@github.com>2023-07-13 06:47:47 -0400
commit3261889e3a93ab942fd1776188c7ad31524574b4 (patch)
treeb26934b49f1ae11a0ee8e42b6f17c80e49404121
parent161b30a32f2ec8f0c6b53d3171089eb17f8217ba (diff)
downloadspack-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.
-rw-r--r--.github/workflows/audit.yaml7
-rw-r--r--lib/spack/spack/audit.py13
-rw-r--r--var/spack/repos/builtin/packages/arm-forge/package.py2
-rw-r--r--var/spack/repos/builtin/packages/cuda/package.py2
-rw-r--r--var/spack/repos/builtin/packages/cudnn/package.py2
-rw-r--r--var/spack/repos/builtin/packages/cutensor/package.py2
-rw-r--r--var/spack/repos/builtin/packages/git-annex/package.py2
-rw-r--r--var/spack/repos/builtin/packages/hpcviewer/package.py2
-rw-r--r--var/spack/repos/builtin/packages/javafx/package.py2
-rw-r--r--var/spack/repos/builtin/packages/nvhpc/package.py2
10 files changed, 31 insertions, 5 deletions
diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml
index 9ea27e2834..edd3c9c62e 100644
--- a/.github/workflows/audit.yaml
+++ b/.github/workflows/audit.yaml
@@ -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
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}"
diff --git a/var/spack/repos/builtin/packages/arm-forge/package.py b/var/spack/repos/builtin/packages/arm-forge/package.py
index 952b6f42b1..16d842bd1e 100644
--- a/var/spack/repos/builtin/packages/arm-forge/package.py
+++ b/var/spack/repos/builtin/packages/arm-forge/package.py
@@ -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"
)
diff --git a/var/spack/repos/builtin/packages/cuda/package.py b/var/spack/repos/builtin/packages/cuda/package.py
index 93573d4698..e2e9a71112 100644
--- a/var/spack/repos/builtin/packages/cuda/package.py
+++ b/var/spack/repos/builtin/packages/cuda/package.py
@@ -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)
diff --git a/var/spack/repos/builtin/packages/cudnn/package.py b/var/spack/repos/builtin/packages/cudnn/package.py
index df98518c8c..54d6708e40 100644
--- a/var/spack/repos/builtin/packages/cudnn/package.py
+++ b/var/spack/repos/builtin/packages/cudnn/package.py
@@ -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)
diff --git a/var/spack/repos/builtin/packages/cutensor/package.py b/var/spack/repos/builtin/packages/cutensor/package.py
index 15bc9fc22a..9f42a27e95 100644
--- a/var/spack/repos/builtin/packages/cutensor/package.py
+++ b/var/spack/repos/builtin/packages/cutensor/package.py
@@ -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)
diff --git a/var/spack/repos/builtin/packages/git-annex/package.py b/var/spack/repos/builtin/packages/git-annex/package.py
index 4cc0490ece..ece00cd376 100644
--- a/var/spack/repos/builtin/packages/git-annex/package.py
+++ b/var/spack/repos/builtin/packages/git-annex/package.py
@@ -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(
diff --git a/var/spack/repos/builtin/packages/hpcviewer/package.py b/var/spack/repos/builtin/packages/hpcviewer/package.py
index 670a286427..48a3565769 100644
--- a/var/spack/repos/builtin/packages/hpcviewer/package.py
+++ b/var/spack/repos/builtin/packages/hpcviewer/package.py
@@ -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":
diff --git a/var/spack/repos/builtin/packages/javafx/package.py b/var/spack/repos/builtin/packages/javafx/package.py
index f37429a4ab..ceceb9f1c4 100644
--- a/var/spack/repos/builtin/packages/javafx/package.py
+++ b/var/spack/repos/builtin/packages/javafx/package.py
@@ -20,7 +20,7 @@ _versions = {
),
},
"darwin": {
- "aarch64": (
+ "arm64": (
"https://download2.gluonhq.com/openjfx/20.0.1/openjfx-20.0.1_osx-aarch64_bin-sdk.zip",
"baebdbbe283c17df62fc4c0bdc2bde4415f2253f99ba41437f9336e2272c255e",
),
diff --git a/var/spack/repos/builtin/packages/nvhpc/package.py b/var/spack/repos/builtin/packages/nvhpc/package.py
index ba5cfd2ac1..b5ce6b44e8 100644
--- a/var/spack/repos/builtin/packages/nvhpc/package.py
+++ b/var/spack/repos/builtin/packages/nvhpc/package.py
@@ -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)