diff options
-rw-r--r-- | etc/spack/defaults/packages.yaml | 1 | ||||
-rw-r--r-- | lib/spack/spack/audit.py | 16 | ||||
-rw-r--r-- | lib/spack/spack/test/repo.py | 13 |
3 files changed, 17 insertions, 13 deletions
diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml index 581b01e1f6..25a707e4dd 100644 --- a/etc/spack/defaults/packages.yaml +++ b/etc/spack/defaults/packages.yaml @@ -61,6 +61,7 @@ packages: tbb: [intel-tbb] unwind: [libunwind] uuid: [util-linux-uuid, libuuid] + wasi-sdk: [wasi-sdk-prebuilt] xxd: [xxd-standalone, vim] yacc: [bison, byacc] ziglang: [zig] diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py index faef15393d..c5e12017e2 100644 --- a/lib/spack/spack/audit.py +++ b/lib/spack/spack/audit.py @@ -351,6 +351,22 @@ def _wrongly_named_spec(error_cls): return errors +@config_packages +def _ensure_all_virtual_packages_have_default_providers(error_cls): + """All virtual packages must have a default provider explicitly set.""" + configuration = spack.config.create() + defaults = configuration.get("packages", scope="defaults") + default_providers = defaults["all"]["providers"] + virtuals = spack.repo.PATH.provider_index.providers + default_providers_filename = configuration.scopes["defaults"].get_section_filename("packages") + + return [ + error_cls(f"'{virtual}' must have a default provider in {default_providers_filename}", []) + for virtual in virtuals + if virtual not in default_providers + ] + + def _make_config_error(config_data, summary, error_cls): s = io.StringIO() s.write("Occurring in the following file:\n") diff --git a/lib/spack/spack/test/repo.py b/lib/spack/spack/test/repo.py index e08d148289..a013078a82 100644 --- a/lib/spack/spack/test/repo.py +++ b/lib/spack/spack/test/repo.py @@ -131,19 +131,6 @@ def test_relative_import_spack_packages_as_python_modules(mock_packages): assert issubclass(Mpileaks, spack.package_base.PackageBase) -def test_all_virtual_packages_have_default_providers(): - """All virtual packages must have a default provider explicitly set.""" - configuration = spack.config.create() - defaults = configuration.get("packages", scope="defaults") - default_providers = defaults["all"]["providers"] - providers = spack.repo.PATH.provider_index.providers - default_providers_filename = configuration.scopes["defaults"].get_section_filename("packages") - for provider in providers: - assert provider in default_providers, ( - "all providers must have a default in %s" % default_providers_filename - ) - - def test_get_all_mock_packages(mock_packages): """Get the mock packages once each too.""" for name in mock_packages.all_package_names(): |