diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2024-11-17 21:32:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-17 13:32:24 -0700 |
commit | da4f7c2952e4dcc9f0581db2fac43da13b0bcb47 (patch) | |
tree | d22e92b06d9b2bc75c4f46e8c914aa506007b27b /lib | |
parent | fdedb6f95d09c7f7a78ebce827ba0092b82c8f21 (diff) | |
download | spack-da4f7c2952e4dcc9f0581db2fac43da13b0bcb47.tar.gz spack-da4f7c2952e4dcc9f0581db2fac43da13b0bcb47.tar.bz2 spack-da4f7c2952e4dcc9f0581db2fac43da13b0bcb47.tar.xz spack-da4f7c2952e4dcc9f0581db2fac43da13b0bcb47.zip |
Add an audit to prevent using the name "all" in packages (#47651)
Packages cannot be named like that, since we use "all" to indicate
default settings under the "packages" section of the configuration.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/audit.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py index 273e335ade..7e6b87c987 100644 --- a/lib/spack/spack/audit.py +++ b/lib/spack/spack/audit.py @@ -571,8 +571,13 @@ def _search_for_deprecated_package_methods(pkgs, error_cls): @package_properties def _ensure_all_package_names_are_lowercase(pkgs, error_cls): """Ensure package names are lowercase and consistent""" + reserved_names = ("all",) badname_regex, errors = re.compile(r"[_A-Z]"), [] for pkg_name in pkgs: + if pkg_name in reserved_names: + error_msg = f"The name '{pkg_name}' is reserved, and cannot be used for packages" + errors.append(error_cls(error_msg, [])) + if badname_regex.search(pkg_name): error_msg = f"Package name '{pkg_name}' should be lowercase and must not contain '_'" errors.append(error_cls(error_msg, [])) |