From 859745f1a92462fa21af54d80ad6a01cca484dd8 Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Fri, 26 Apr 2024 10:38:09 -0700 Subject: [PATCH] Run audits on windows Add debug log for external detection tests. The debug log is used to print which test is being executed. Skip version audit on Windows where appropriate --- .github/workflows/audit.yaml | 34 ++++++++++++++----- lib/spack/spack/audit.py | 8 ++--- lib/spack/spack/cmd/audit.py | 2 +- .../builtin/packages/arm-forge/package.py | 2 ++ .../repos/builtin/packages/cuda/package.py | 2 +- .../repos/builtin/packages/cudnn/package.py | 2 +- .../builtin/packages/cutensor/package.py | 2 +- .../builtin/packages/gcc-runtime/package.py | 2 +- .../builtin/packages/gcc/detection_test.yaml | 1 + .../builtin/packages/git-annex/package.py | 2 +- .../builtin/packages/hpcviewer/package.py | 2 ++ .../repos/builtin/packages/javafx/package.py | 2 ++ .../builtin/packages/nf-tower-cli/package.py | 2 ++ .../repos/builtin/packages/nvhpc/package.py | 2 +- .../repos/builtin/packages/openjdk/package.py | 2 ++ .../repos/builtin/packages/pandoc/package.py | 2 ++ .../py-azureml-dataprep-native/package.py | 2 ++ .../py-azureml-dataprep-rslex/package.py | 2 ++ .../packages/py-dotnetcore2/package.py | 2 ++ .../repos/builtin/packages/py-itk/package.py | 2 ++ .../packages/py-nvidia-dali/package.py | 2 +- .../builtin/packages/py-shiboken2/package.py | 2 ++ .../packages/rust-bootstrap/package.py | 5 +++ 23 files changed, 66 insertions(+), 20 deletions(-) diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml index de82a31c06..93e71537ef 100644 --- a/.github/workflows/audit.yaml +++ b/.github/workflows/audit.yaml @@ -17,10 +17,16 @@ concurrency: jobs: # Run audits on all the packages in the built-in repository package-audits: - runs-on: ${{ matrix.operating_system }} + runs-on: ${{ matrix.system.os }} strategy: matrix: - operating_system: ["ubuntu-latest", "macos-latest"] + system: + - { os: windows-latest, shell: 'powershell Invoke-Expression -Command "./share/spack/qa/windows_test_setup.ps1"; {0}' } + - { os: ubuntu-latest, shell: bash } + - { os: macos-latest, shell: bash } + defaults: + run: + shell: ${{ matrix.system.shell }} steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d @@ -29,20 +35,32 @@ jobs: - name: Install Python packages run: | pip install --upgrade pip setuptools pytest coverage[toml] + - name: Setup for Windows run + if: runner.os == 'Windows' + run: | + python -m pip install --upgrade pywin32 - name: Package audits (with coverage) - if: ${{ inputs.with_coverage == 'true' }} + if: ${{ inputs.with_coverage == 'true' && runner.os != 'Windows' }} run: | . share/spack/setup-env.sh coverage run $(which spack) audit packages - coverage run $(which spack) -d audit externals + coverage run $(which spack) -d audit externals coverage combine coverage xml - name: Package audits (without coverage) - if: ${{ inputs.with_coverage == 'false' }} + if: ${{ inputs.with_coverage == 'false' && runner.os != 'Windows' }} run: | - . share/spack/setup-env.sh - $(which spack) audit packages - $(which spack) audit externals + . share/spack/setup-env.sh + spack -d audit packages + spack -d audit externals + - name: Package audits (without coverage) + if: ${{ runner.os == 'Windows' }} + run: | + . share/spack/setup-env.sh + spack -d audit packages + ./share/spack/qa/validate_last_exit.ps1 + spack -d audit externals + ./share/spack/qa/validate_last_exit.ps1 - uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed if: ${{ inputs.with_coverage == 'true' }} with: diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py index 96225fd6ac..6d3a63c8a6 100644 --- a/lib/spack/spack/audit.py +++ b/lib/spack/spack/audit.py @@ -1046,7 +1046,7 @@ def _extracts_errors(triggers, summary): group="externals", tag="PKG-EXTERNALS", description="Sanity checks for external software detection", - kwargs=("pkgs",), + kwargs=("pkgs", "debug_log"), ) @@ -1069,7 +1069,7 @@ def packages_with_detection_tests(): @external_detection -def _test_detection_by_executable(pkgs, error_cls): +def _test_detection_by_executable(pkgs, debug_log, error_cls): """Test drive external detection for packages""" import spack.detection @@ -1095,6 +1095,7 @@ def _test_detection_by_executable(pkgs, error_cls): for idx, test_runner in enumerate( spack.detection.detection_tests(pkg_name, spack.repo.PATH) ): + debug_log(f"[{__file__}]: running test {idx} for package {pkg_name}") specs = test_runner.execute() expected_specs = test_runner.expected_specs @@ -1115,11 +1116,10 @@ def _test_detection_by_executable(pkgs, error_cls): for candidate in expected_specs: try: idx = specs.index(candidate) + matched_detection.append((candidate, specs[idx])) except (AttributeError, ValueError): pass - matched_detection.append((candidate, specs[idx])) - def _compare_extra_attribute(_expected, _detected, *, _spec): result = [] # Check items are of the same type diff --git a/lib/spack/spack/cmd/audit.py b/lib/spack/spack/cmd/audit.py index c8cef494ef..77bbbc5d82 100644 --- a/lib/spack/spack/cmd/audit.py +++ b/lib/spack/spack/cmd/audit.py @@ -84,7 +84,7 @@ def externals(parser, args): return pkgs = args.name or spack.repo.PATH.all_package_names() - reports = spack.audit.run_group(args.subcommand, pkgs=pkgs) + reports = spack.audit.run_group(args.subcommand, pkgs=pkgs, debug_log=tty.debug) _process_reports(reports) diff --git a/var/spack/repos/builtin/packages/arm-forge/package.py b/var/spack/repos/builtin/packages/arm-forge/package.py index 74dbbe5563..6d205f2209 100644 --- a/var/spack/repos/builtin/packages/arm-forge/package.py +++ b/var/spack/repos/builtin/packages/arm-forge/package.py @@ -22,6 +22,8 @@ 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 + skip_version_audit = ["platform=windows"] + 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 973fcd95cc..d70fc3d865 100644 --- a/var/spack/repos/builtin/packages/cuda/package.py +++ b/var/spack/repos/builtin/packages/cuda/package.py @@ -592,7 +592,7 @@ class Cuda(Package): maintainers("ax3l", "Rombur") executables = ["^nvcc$"] - skip_version_audit = ["platform=darwin"] + skip_version_audit = ["platform=darwin", "platform=windows"] for ver, packages in _versions.items(): key = "{0}-{1}".format(platform.system(), platform.machine()) diff --git a/var/spack/repos/builtin/packages/cudnn/package.py b/var/spack/repos/builtin/packages/cudnn/package.py index b042529a6e..5b5c10c44e 100644 --- a/var/spack/repos/builtin/packages/cudnn/package.py +++ b/var/spack/repos/builtin/packages/cudnn/package.py @@ -298,7 +298,7 @@ class Cudnn(Package): # need to use modified URLs like in url_for_version. maintainers("adamjstewart", "bvanessen") - skip_version_audit = ["platform=darwin"] + skip_version_audit = ["platform=darwin", "platform=windows"] license("MIT") diff --git a/var/spack/repos/builtin/packages/cutensor/package.py b/var/spack/repos/builtin/packages/cutensor/package.py index d80a8df332..a9e9eb54ee 100644 --- a/var/spack/repos/builtin/packages/cutensor/package.py +++ b/var/spack/repos/builtin/packages/cutensor/package.py @@ -27,7 +27,7 @@ class Cutensor(Package): maintainers("bvanessen") url = "cutensor" - skip_version_audit = ["platform=darwin"] + skip_version_audit = ["platform=darwin", "platform=windows"] for ver, packages in _versions.items(): key = "{0}-{1}".format(platform.system(), platform.machine()) diff --git a/var/spack/repos/builtin/packages/gcc-runtime/package.py b/var/spack/repos/builtin/packages/gcc-runtime/package.py index 659327b763..9c92feb337 100644 --- a/var/spack/repos/builtin/packages/gcc-runtime/package.py +++ b/var/spack/repos/builtin/packages/gcc-runtime/package.py @@ -23,7 +23,7 @@ class GccRuntime(Package): tags = ["runtime"] # gcc-runtime versions are declared dynamically - skip_version_audit = ["platform=linux", "platform=darwin"] + skip_version_audit = ["platform=linux", "platform=darwin", "platform=windows"] maintainers("haampie") diff --git a/var/spack/repos/builtin/packages/gcc/detection_test.yaml b/var/spack/repos/builtin/packages/gcc/detection_test.yaml index cdce43196e..4677a8cdab 100644 --- a/var/spack/repos/builtin/packages/gcc/detection_test.yaml +++ b/var/spack/repos/builtin/packages/gcc/detection_test.yaml @@ -59,6 +59,7 @@ paths: - "bin/x86_64-linux-gnu-gcc-10" - "bin/x86_64-linux-gnu-g++-10" script: "echo 10.1.0" + platforms: [darwin, linux] results: - spec: "gcc@6.5.0 languages=c" extra_attributes: diff --git a/var/spack/repos/builtin/packages/git-annex/package.py b/var/spack/repos/builtin/packages/git-annex/package.py index be50387287..62df61d23e 100644 --- a/var/spack/repos/builtin/packages/git-annex/package.py +++ b/var/spack/repos/builtin/packages/git-annex/package.py @@ -47,7 +47,7 @@ class GitAnnex(Package): # - $ git annex whereis git-annex/linux/current/git-annex-standalone-arm64.tar.gz # -> gives web url - skip_version_audit = ["platform=darwin"] + skip_version_audit = ["platform=darwin", "platform=windows"] license("AGPL-3.0-or-later") diff --git a/var/spack/repos/builtin/packages/hpcviewer/package.py b/var/spack/repos/builtin/packages/hpcviewer/package.py index 7bf6916a52..5995dafc78 100644 --- a/var/spack/repos/builtin/packages/hpcviewer/package.py +++ b/var/spack/repos/builtin/packages/hpcviewer/package.py @@ -46,6 +46,8 @@ class Hpcviewer(Package): homepage = "http://hpctoolkit.org" maintainers("mwkrentel") + skip_version_audit = ["platform=windows"] + darwin_sha = { ("2024.02", "aarch64"): "0f2bf2f89b7b9656b1b249efc8b24763f7865e8ddae5b22a3c21cc79fda49ce9", ("2024.02", "x86_64"): "7f61166155f326179e309aa18568b44d98a2219973a323cd4713123b5bf6fd54", diff --git a/var/spack/repos/builtin/packages/javafx/package.py b/var/spack/repos/builtin/packages/javafx/package.py index fe3d767c8e..20e58fb506 100644 --- a/var/spack/repos/builtin/packages/javafx/package.py +++ b/var/spack/repos/builtin/packages/javafx/package.py @@ -47,6 +47,8 @@ class Javafx(Package): except KeyError: continue + skip_version_audit = ["platform=windows"] + maintainers("snehring") extends("openjdk") diff --git a/var/spack/repos/builtin/packages/nf-tower-cli/package.py b/var/spack/repos/builtin/packages/nf-tower-cli/package.py index e8a8669050..bb9520f98b 100644 --- a/var/spack/repos/builtin/packages/nf-tower-cli/package.py +++ b/var/spack/repos/builtin/packages/nf-tower-cli/package.py @@ -17,6 +17,8 @@ class NfTowerCli(Package): homepage = "https://github.com/seqeralabs/tower-cli" maintainers("marcodelapierre") + skip_version_audit = ["platform=windows"] + if platform.machine() == "x86_64": if platform.system() == "Darwin": version( diff --git a/var/spack/repos/builtin/packages/nvhpc/package.py b/var/spack/repos/builtin/packages/nvhpc/package.py index d627548cd5..bc11e64a39 100644 --- a/var/spack/repos/builtin/packages/nvhpc/package.py +++ b/var/spack/repos/builtin/packages/nvhpc/package.py @@ -388,7 +388,7 @@ class Nvhpc(Package): maintainers("samcmill") tags = ["e4s"] - skip_version_audit = ["platform=darwin"] + skip_version_audit = ["platform=darwin", "platform=windows"] redistribute(source=False, binary=False) diff --git a/var/spack/repos/builtin/packages/openjdk/package.py b/var/spack/repos/builtin/packages/openjdk/package.py index 084b8be34f..ccbe1d88ee 100644 --- a/var/spack/repos/builtin/packages/openjdk/package.py +++ b/var/spack/repos/builtin/packages/openjdk/package.py @@ -367,6 +367,8 @@ class Openjdk(Package): executables = ["^java$"] + skip_version_audit = ["platform=windows"] + @classmethod def determine_version(cls, exe): output = Executable(exe)("-version", output=str, error=str) diff --git a/var/spack/repos/builtin/packages/pandoc/package.py b/var/spack/repos/builtin/packages/pandoc/package.py index 870490a587..81a93f5f57 100644 --- a/var/spack/repos/builtin/packages/pandoc/package.py +++ b/var/spack/repos/builtin/packages/pandoc/package.py @@ -20,6 +20,8 @@ class Pandoc(Package): # the challenges with Haskell. Until the Haskell framework is in Spack this # package will meet the needs of packages that have a dependency on pandoc. + skip_version_audit = ["platform=windows"] + if platform.system() == "Linux" and platform.machine() == "aarch64": url = "https://github.com/jgm/pandoc/releases/download/2.14.0.3/pandoc-2.14.0.3-linux-arm64.tar.gz" version( diff --git a/var/spack/repos/builtin/packages/py-azureml-dataprep-native/package.py b/var/spack/repos/builtin/packages/py-azureml-dataprep-native/package.py index 2ea0d46495..405dcac633 100644 --- a/var/spack/repos/builtin/packages/py-azureml-dataprep-native/package.py +++ b/var/spack/repos/builtin/packages/py-azureml-dataprep-native/package.py @@ -13,6 +13,8 @@ class PyAzuremlDataprepNative(PythonPackage): homepage = "https://docs.microsoft.com/en-us/python/api/overview/azure/ml/?view=azure-ml-py" + skip_version_audit = ["platform=windows"] + if sys.platform == "darwin": version( "30.0.0-py3.9", diff --git a/var/spack/repos/builtin/packages/py-azureml-dataprep-rslex/package.py b/var/spack/repos/builtin/packages/py-azureml-dataprep-rslex/package.py index bf507a5949..c7ade72fee 100644 --- a/var/spack/repos/builtin/packages/py-azureml-dataprep-rslex/package.py +++ b/var/spack/repos/builtin/packages/py-azureml-dataprep-rslex/package.py @@ -16,6 +16,8 @@ class PyAzuremlDataprepRslex(PythonPackage): homepage = "https://docs.microsoft.com/en-us/python/api/overview/azure/ml/?view=azure-ml-py" + skip_version_audit = ["platform=windows"] + if sys.platform == "darwin": version( "1.9.0-py3.9", diff --git a/var/spack/repos/builtin/packages/py-dotnetcore2/package.py b/var/spack/repos/builtin/packages/py-dotnetcore2/package.py index 3bc930b0ea..7838bc1d02 100644 --- a/var/spack/repos/builtin/packages/py-dotnetcore2/package.py +++ b/var/spack/repos/builtin/packages/py-dotnetcore2/package.py @@ -13,6 +13,8 @@ class PyDotnetcore2(PythonPackage): homepage = "https://github.com/dotnet/core" + skip_version_audit = ["platform=windows"] + if sys.platform == "darwin": version( "2.1.14", diff --git a/var/spack/repos/builtin/packages/py-itk/package.py b/var/spack/repos/builtin/packages/py-itk/package.py index 5c11e97c67..92e89c09eb 100644 --- a/var/spack/repos/builtin/packages/py-itk/package.py +++ b/var/spack/repos/builtin/packages/py-itk/package.py @@ -15,6 +15,8 @@ class PyItk(PythonPackage): homepage = "https://itk.org/" + skip_version_audit = ["platform=windows"] + if sys.platform == "darwin": # version 5.1.1 version( diff --git a/var/spack/repos/builtin/packages/py-nvidia-dali/package.py b/var/spack/repos/builtin/packages/py-nvidia-dali/package.py index 14522f2932..5cc0eee3b2 100644 --- a/var/spack/repos/builtin/packages/py-nvidia-dali/package.py +++ b/var/spack/repos/builtin/packages/py-nvidia-dali/package.py @@ -16,7 +16,7 @@ class PyNvidiaDali(PythonPackage): homepage = "https://developer.nvidia.com/dali" url = "https://developer.download.nvidia.com/compute/redist/" - skip_version_audit = ["platform=darwin"] + skip_version_audit = ["platform=darwin", "platform=windows"] maintainers("thomas-bouvier") diff --git a/var/spack/repos/builtin/packages/py-shiboken2/package.py b/var/spack/repos/builtin/packages/py-shiboken2/package.py index 4f50d92b07..fa90c0b61a 100644 --- a/var/spack/repos/builtin/packages/py-shiboken2/package.py +++ b/var/spack/repos/builtin/packages/py-shiboken2/package.py @@ -13,6 +13,8 @@ class PyShiboken2(PythonPackage): homepage = "https://www.pyside.org/" + skip_version_audit = ["platform=windows"] + if sys.platform.startswith("linux"): version( "5.15.2", diff --git a/var/spack/repos/builtin/packages/rust-bootstrap/package.py b/var/spack/repos/builtin/packages/rust-bootstrap/package.py index ea73046f9c..7747f7867a 100644 --- a/var/spack/repos/builtin/packages/rust-bootstrap/package.py +++ b/var/spack/repos/builtin/packages/rust-bootstrap/package.py @@ -16,6 +16,8 @@ class RustBootstrap(Package): maintainers("alecbcs") + skip_version_audit = ["platform=windows"] + # List binary rust releases for multiple operating systems and architectures. # These binary versions are not intended to stay up-to-date. Instead we # should update these binary releases as bootstrapping requirements are @@ -110,6 +112,9 @@ class RustBootstrap(Package): version(release, sha256=rust_releases[release][os][target]) def url_for_version(self, version): + if self.os not in ("linux", "darwin"): + return None + # Allow maintainers to checksum multiple architectures via # `spack checksum rust-bootstrap@1.70.0-darwin-aarch64`. match = re.search(r"(\S+)-(\S+)-(\S+)", str(version))