Skip to content

Commit

Permalink
Add an audit to prevent using the name "all" in packages (spack#47651)
Browse files Browse the repository at this point in the history
Packages cannot be named like that, since we use "all" to indicate
default settings under the "packages" section of the configuration.
  • Loading branch information
alalazo authored Nov 17, 2024
1 parent fdedb6f commit da4f7c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/spack/spack/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, []))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from spack.package import *


class All(CMakePackage):
class AllLibrary(CMakePackage):
"""A Load Balancing Library (ALL)
The library aims to provide an easy way to include dynamic domain-based
Expand Down
2 changes: 1 addition & 1 deletion var/spack/repos/builtin/packages/cabana/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Cabana(CMakePackage, CudaPackage, ROCmPackage):
depends_on("[email protected]:", when="[email protected]:")

# Dependencies for subpackages
depends_on("all", when="@0.5.0:+all")
depends_on("all-library", when="@0.5.0:+all")
depends_on("arborx", when="@0.3.0:+arborx")
depends_on("[email protected]:", when="@0.4.0:+hypre")
depends_on("[email protected]:", when="@0.5.0:+hypre")
Expand Down

0 comments on commit da4f7c2

Please sign in to comment.