Skip to content

Commit 7d4fd34

Browse files
authored
Base support for Rockylinux10 (#523)
* Base support for Rockylinux10
1 parent a415fcb commit 7d4fd34

File tree

6 files changed

+41
-16
lines changed

6 files changed

+41
-16
lines changed

docs/misc_api.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ __Arguments__
9090

9191

9292
- __distro (string)__: Valid values are `centos7`, `centos8`, `rhel7`,
93-
`rhel8`, `rockylinux8`, `rockylinux9`, `ubuntu16`, `ubuntu18`, `ubuntu20`,
94-
`ubuntu22`, and `ubuntu24`. `ubuntu` is an alias for `ubuntu16`, `centos`
95-
is an alias for `centos7`, and `rhel` is an alias for `rhel7`.
93+
`rhel8`, `rockylinux8`, `rockylinux9`, `rockylinux10`, `ubuntu16`,
94+
`ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`. `ubuntu` is an
95+
alias for `ubuntu16`, `centos` is an alias for `centos7`, and `rhel`
96+
is an alias for `rhel7`.
9697

9798

9899
## set_singularity_version

docs/primitives.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ is `docker` (Singularity specific).
2222

2323
- ___distro__: The underlying Linux distribution of the base image.
2424
Valid values are `centos`, `centos7`, `centos8`, `redhat`, `rhel`,
25-
`rhel7`, `rhel8`, `rockylinux8`, `rockylinux9`, `ubuntu`, `ubuntu16`,
26-
`ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`. By default, the
27-
primitive attempts to figure out the Linux distribution by inspecting
28-
the image identifier, and falls back to `ubuntu` if unable to determine
29-
the Linux distribution automatically.
25+
`rhel7`, `rhel8`, `rockylinux8`, `rockylinux9`, `rockylinux10`,
26+
`ubuntu`, `ubuntu16`, `ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`.
27+
By default, the primitive attempts to figure out the Linux distribution
28+
by inspecting the image identifier, and falls back to `ubuntu` if unable
29+
to determine the Linux distribution automatically.
3030

3131
- ___docker_env__: Boolean specifying whether to load the Docker base
3232
image environment, i.e., source

hpccm/config.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,10 @@ def set_linux_distro(distro):
174174
# Arguments
175175
176176
distro (string): Valid values are `centos7`, `centos8`, `rhel7`,
177-
`rhel8`, `rockylinux8`, `rockylinux9`, `ubuntu16`, `ubuntu18`, `ubuntu20`,
178-
`ubuntu22`, and `ubuntu24`. `ubuntu` is an alias for `ubuntu16`, `centos`
179-
is an alias for `centos7`, and `rhel` is an alias for `rhel7`.
177+
`rhel8`, `rockylinux8`, `rockylinux9`, `rockylinux10`, `ubuntu16`,
178+
`ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`. `ubuntu` is an
179+
alias for `ubuntu16`, `centos` is an alias for `centos7`, and `rhel`
180+
is an alias for `rhel7`.
180181
181182
"""
182183
this = sys.modules[__name__]
@@ -204,6 +205,9 @@ def set_linux_distro(distro):
204205
elif distro == 'rockylinux9':
205206
this.g_linux_distro = linux_distro.ROCKYLINUX
206207
this.g_linux_version = Version('9.0')
208+
elif distro == 'rockylinux10':
209+
this.g_linux_distro = linux_distro.ROCKYLINUX
210+
this.g_linux_version = Version('10.0')
207211
elif distro == 'ubuntu':
208212
this.g_linux_distro = linux_distro.UBUNTU
209213
this.g_linux_version = Version('16.04')

hpccm/primitives/baseimage.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ class baseimage(object):
5050
5151
_distro: The underlying Linux distribution of the base image.
5252
Valid values are `centos`, `centos7`, `centos8`, `redhat`, `rhel`,
53-
`rhel7`, `rhel8`, `rockylinux8`, `rockylinux9`, `ubuntu`, `ubuntu16`,
54-
`ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`. By default, the
55-
primitive attempts to figure out the Linux distribution by inspecting
56-
the image identifier, and falls back to `ubuntu` if unable to determine
57-
the Linux distribution automatically.
53+
`rhel7`, `rhel8`, `rockylinux8`, `rockylinux9`, `rockylinux10`,
54+
`ubuntu`, `ubuntu16`, `ubuntu18`, `ubuntu20`, `ubuntu22`, and `ubuntu24`.
55+
By default, the primitive attempts to figure out the Linux distribution
56+
by inspecting the image identifier, and falls back to `ubuntu` if unable
57+
to determine the Linux distribution automatically.
5858
5959
_docker_env: Boolean specifying whether to load the Docker base
6060
image environment, i.e., source
@@ -139,6 +139,8 @@ def __init__(self, **kwargs):
139139
hpccm.config.set_linux_distro('rockylinux8')
140140
elif self.__distro == 'rockylinux9':
141141
hpccm.config.set_linux_distro('rockylinux9')
142+
elif self.__distro == 'rockylinux10':
143+
hpccm.config.set_linux_distro('rockylinux10')
142144
elif re.search(r'centos:?7', self.image):
143145
hpccm.config.set_linux_distro('centos7')
144146
elif re.search(r'centos:?8', self.image):
@@ -147,6 +149,8 @@ def __init__(self, **kwargs):
147149
hpccm.config.set_linux_distro('rockylinux8')
148150
elif re.search(r'rockylinux:?9', self.image):
149151
hpccm.config.set_linux_distro('rockylinux9')
152+
elif re.search(r'rockylinux:?10', self.image):
153+
hpccm.config.set_linux_distro('rockylinux10')
150154
elif re.search(r'centos|rhel|redhat', self.image):
151155
hpccm.config.set_linux_distro('centos')
152156
elif re.search(r'ubi:?7', self.image):

test/helpers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ def wrapper(*args, **kwargs):
133133

134134
return wrapper
135135

136+
def rockylinux10(function):
137+
"""Decorator to set the Linux distribution to Rockylinux 10"""
138+
def wrapper(*args, **kwargs):
139+
hpccm.config.g_linux_distro = linux_distro.CENTOS
140+
hpccm.config.g_linux_version = Version('10.0')
141+
return function(*args, **kwargs)
142+
143+
return wrapper
144+
136145
def singularity(function):
137146
"""Decorator to set the global container type to singularity"""
138147
def wrapper(*args, **kwargs):

test/test_baseimage.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,13 @@ def test_detect_rockylinux_9(self):
237237
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.ROCKYLINUX)
238238
self.assertEqual(hpccm.config.g_linux_version, Version('9.0'))
239239

240+
@docker
241+
def test_detect_rockylinux_10(self):
242+
"""Base image Linux distribution detection"""
243+
b = baseimage(image='rockylinux/rockylinux:10')
244+
self.assertEqual(hpccm.config.g_linux_distro, linux_distro.ROCKYLINUX)
245+
self.assertEqual(hpccm.config.g_linux_version, Version('10.0'))
246+
240247
@docker
241248
def test_detect_ubi7(self):
242249
"""Base image Linux distribution detection"""

0 commit comments

Comments
 (0)