wasi-sdk: add default provider
This was missed in #45394 because we don't run unit tests for package PRs, and `test_all_virtual_packages_have_default_providers`, which would've caught it, is a unit test, not an audit. - [x] add a default provider for `wasi-sdk` in `etc/spack/defaults/packages.yaml` (which we require for all virtuals) - [x] rework `test_all_virtual_packages_have_default_providers` as an audit called `_ensure_all_virtual_packages_have_default_providers` Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
This commit is contained in:
parent
c294b9d3b9
commit
4a35dec206
@ -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]
|
||||
|
@ -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")
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user