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]
|
tbb: [intel-tbb]
|
||||||
unwind: [libunwind]
|
unwind: [libunwind]
|
||||||
uuid: [util-linux-uuid, libuuid]
|
uuid: [util-linux-uuid, libuuid]
|
||||||
|
wasi-sdk: [wasi-sdk-prebuilt]
|
||||||
xxd: [xxd-standalone, vim]
|
xxd: [xxd-standalone, vim]
|
||||||
yacc: [bison, byacc]
|
yacc: [bison, byacc]
|
||||||
ziglang: [zig]
|
ziglang: [zig]
|
||||||
|
@ -351,6 +351,22 @@ def _wrongly_named_spec(error_cls):
|
|||||||
return errors
|
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):
|
def _make_config_error(config_data, summary, error_cls):
|
||||||
s = io.StringIO()
|
s = io.StringIO()
|
||||||
s.write("Occurring in the following file:\n")
|
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)
|
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):
|
def test_get_all_mock_packages(mock_packages):
|
||||||
"""Get the mock packages once each too."""
|
"""Get the mock packages once each too."""
|
||||||
for name in mock_packages.all_package_names():
|
for name in mock_packages.all_package_names():
|
||||||
|
Loading…
Reference in New Issue
Block a user