diff --git a/docs/misc_api.md b/docs/misc_api.md index 417e932..21edbdf 100644 --- a/docs/misc_api.md +++ b/docs/misc_api.md @@ -90,9 +90,10 @@ __Arguments__ - __distro (string)__: Valid values are `centos7`, `centos8`, `rhel7`, -`rhel8`, `rockylinux8`, `rockylinux9`, `ubuntu16`, `ubuntu18`, `ubuntu20`, -`ubuntu22`, and `ubuntu24`. `ubuntu` is an alias for `ubuntu16`, `centos` -is an alias for `centos7`, and `rhel` is an alias for `rhel7`. +`rhel8`, `rockylinux8`, `rockylinux9`, `rockylinux10`, `ubuntu16`, +`ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`. `ubuntu` is an +alias for `ubuntu16`, `centos` is an alias for `centos7`, and `rhel` +is an alias for `rhel7`. ## set_singularity_version diff --git a/docs/primitives.md b/docs/primitives.md index 765e761..5a72acf 100644 --- a/docs/primitives.md +++ b/docs/primitives.md @@ -22,11 +22,11 @@ is `docker` (Singularity specific). - ___distro__: The underlying Linux distribution of the base image. Valid values are `centos`, `centos7`, `centos8`, `redhat`, `rhel`, -`rhel7`, `rhel8`, `rockylinux8`, `rockylinux9`, `ubuntu`, `ubuntu16`, -`ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`. By default, the -primitive attempts to figure out the Linux distribution by inspecting -the image identifier, and falls back to `ubuntu` if unable to determine -the Linux distribution automatically. +`rhel7`, `rhel8`, `rockylinux8`, `rockylinux9`, `rockylinux10`, +`ubuntu`, `ubuntu16`, `ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`. +By default, the primitive attempts to figure out the Linux distribution +by inspecting the image identifier, and falls back to `ubuntu` if unable +to determine the Linux distribution automatically. - ___docker_env__: Boolean specifying whether to load the Docker base image environment, i.e., source diff --git a/hpccm/config.py b/hpccm/config.py index b1734b7..81da3e4 100644 --- a/hpccm/config.py +++ b/hpccm/config.py @@ -174,9 +174,10 @@ def set_linux_distro(distro): # Arguments distro (string): Valid values are `centos7`, `centos8`, `rhel7`, - `rhel8`, `rockylinux8`, `rockylinux9`, `ubuntu16`, `ubuntu18`, `ubuntu20`, - `ubuntu22`, and `ubuntu24`. `ubuntu` is an alias for `ubuntu16`, `centos` - is an alias for `centos7`, and `rhel` is an alias for `rhel7`. + `rhel8`, `rockylinux8`, `rockylinux9`, `rockylinux10`, `ubuntu16`, + `ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`. `ubuntu` is an + alias for `ubuntu16`, `centos` is an alias for `centos7`, and `rhel` + is an alias for `rhel7`. """ this = sys.modules[__name__] @@ -204,6 +205,9 @@ def set_linux_distro(distro): elif distro == 'rockylinux9': this.g_linux_distro = linux_distro.ROCKYLINUX this.g_linux_version = Version('9.0') + elif distro == 'rockylinux10': + this.g_linux_distro = linux_distro.ROCKYLINUX + this.g_linux_version = Version('10.0') elif distro == 'ubuntu': this.g_linux_distro = linux_distro.UBUNTU this.g_linux_version = Version('16.04') diff --git a/hpccm/primitives/baseimage.py b/hpccm/primitives/baseimage.py index a714f99..c35538d 100644 --- a/hpccm/primitives/baseimage.py +++ b/hpccm/primitives/baseimage.py @@ -50,11 +50,11 @@ class baseimage(object): _distro: The underlying Linux distribution of the base image. Valid values are `centos`, `centos7`, `centos8`, `redhat`, `rhel`, - `rhel7`, `rhel8`, `rockylinux8`, `rockylinux9`, `ubuntu`, `ubuntu16`, - `ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`. By default, the - primitive attempts to figure out the Linux distribution by inspecting - the image identifier, and falls back to `ubuntu` if unable to determine - the Linux distribution automatically. + `rhel7`, `rhel8`, `rockylinux8`, `rockylinux9`, `rockylinux10`, + `ubuntu`, `ubuntu16`, `ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`. + By default, the primitive attempts to figure out the Linux distribution + by inspecting the image identifier, and falls back to `ubuntu` if unable + to determine the Linux distribution automatically. _docker_env: Boolean specifying whether to load the Docker base image environment, i.e., source @@ -139,6 +139,8 @@ def __init__(self, **kwargs): hpccm.config.set_linux_distro('rockylinux8') elif self.__distro == 'rockylinux9': hpccm.config.set_linux_distro('rockylinux9') + elif self.__distro == 'rockylinux10': + hpccm.config.set_linux_distro('rockylinux10') elif re.search(r'centos:?7', self.image): hpccm.config.set_linux_distro('centos7') elif re.search(r'centos:?8', self.image): @@ -147,6 +149,8 @@ def __init__(self, **kwargs): hpccm.config.set_linux_distro('rockylinux8') elif re.search(r'rockylinux:?9', self.image): hpccm.config.set_linux_distro('rockylinux9') + elif re.search(r'rockylinux:?10', self.image): + hpccm.config.set_linux_distro('rockylinux10') elif re.search(r'centos|rhel|redhat', self.image): hpccm.config.set_linux_distro('centos') elif re.search(r'ubi:?7', self.image): diff --git a/test/helpers.py b/test/helpers.py index 2c33f6d..f48b5af 100644 --- a/test/helpers.py +++ b/test/helpers.py @@ -133,6 +133,15 @@ def wrapper(*args, **kwargs): return wrapper +def rockylinux10(function): + """Decorator to set the Linux distribution to Rockylinux 10""" + def wrapper(*args, **kwargs): + hpccm.config.g_linux_distro = linux_distro.CENTOS + hpccm.config.g_linux_version = Version('10.0') + return function(*args, **kwargs) + + return wrapper + def singularity(function): """Decorator to set the global container type to singularity""" def wrapper(*args, **kwargs): diff --git a/test/test_baseimage.py b/test/test_baseimage.py index 87362b5..c3fa07d 100644 --- a/test/test_baseimage.py +++ b/test/test_baseimage.py @@ -237,6 +237,13 @@ def test_detect_rockylinux_9(self): self.assertEqual(hpccm.config.g_linux_distro, linux_distro.ROCKYLINUX) self.assertEqual(hpccm.config.g_linux_version, Version('9.0')) + @docker + def test_detect_rockylinux_10(self): + """Base image Linux distribution detection""" + b = baseimage(image='rockylinux/rockylinux:10') + self.assertEqual(hpccm.config.g_linux_distro, linux_distro.ROCKYLINUX) + self.assertEqual(hpccm.config.g_linux_version, Version('10.0')) + @docker def test_detect_ubi7(self): """Base image Linux distribution detection"""