Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/misc_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions docs/primitives.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions hpccm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__]
Expand Down Expand Up @@ -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')
Expand Down
14 changes: 9 additions & 5 deletions hpccm/primitives/baseimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down
9 changes: 9 additions & 0 deletions test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 7 additions & 0 deletions test/test_baseimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
Loading