Skip to content

Commit d893840

Browse files
authored
Add base support for Ubuntu 24.04 and Rocky Linux 9 (#486)
1 parent ce582fa commit d893840

File tree

6 files changed

+49
-26
lines changed

6 files changed

+49
-26
lines changed

.github/workflows/python3.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest, macos-latest, windows-latest]
11-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
12-
include:
13-
- os: macos-latest
14-
python-version: '3.5'
15-
- os: macos-latest
16-
python-version: '3.6'
17-
- os: windows-latest
18-
python-version: '3.5'
19-
- os: windows-latest
20-
python-version: '3.6'
11+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
2112

2213
steps:
2314
- uses: actions/checkout@v2

docs/misc_api.md

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

9191

9292
- __distro (string)__: Valid values are `centos7`, `centos8`, `rhel7`,
93-
`rhel8`, `rockylinux8`, `ubuntu16`, `ubuntu18`, `ubuntu20`, and
94-
`ubuntu22`. `ubuntu` is an alias for `ubuntu16`, `centos` is an
95-
alias for `centos7`, and `rhel` is an alias for `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`.
9696

9797

9898
## 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`, `ubuntu`, `ubuntu16`, `ubuntu18`,
26-
`ubuntu20`, and `ubuntu22`. By default, the primitive attempts to
27-
figure out the Linux distribution by inspecting the image
28-
identifier, and falls back to `ubuntu` if unable to determine the
29-
Linux distribution automatically.
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.
3030

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

hpccm/config.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ def set_linux_distro(distro):
174174
# Arguments
175175
176176
distro (string): Valid values are `centos7`, `centos8`, `rhel7`,
177-
`rhel8`, `rockylinux8`, `ubuntu16`, `ubuntu18`, `ubuntu20`, and
178-
`ubuntu22`. `ubuntu` is an alias for `ubuntu16`, `centos` is an
179-
alias for `centos7`, and `rhel` is an alias for `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`.
180180
181181
"""
182182
this = sys.modules[__name__]
@@ -201,6 +201,9 @@ def set_linux_distro(distro):
201201
elif distro == 'rockylinux8':
202202
this.g_linux_distro = linux_distro.ROCKYLINUX
203203
this.g_linux_version = Version('8.0')
204+
elif distro == 'rockylinux9':
205+
this.g_linux_distro = linux_distro.ROCKYLINUX
206+
this.g_linux_version = Version('9.0')
204207
elif distro == 'ubuntu':
205208
this.g_linux_distro = linux_distro.UBUNTU
206209
this.g_linux_version = Version('16.04')
@@ -216,6 +219,9 @@ def set_linux_distro(distro):
216219
elif distro == 'ubuntu22':
217220
this.g_linux_distro = linux_distro.UBUNTU
218221
this.g_linux_version = Version('22.04')
222+
elif distro == 'ubuntu24':
223+
this.g_linux_distro = linux_distro.UBUNTU
224+
this.g_linux_version = Version('24.04')
219225
else:
220226
logging.warning('Unable to determine the Linux distribution, defaulting to Ubuntu')
221227
this.g_linux_distro = linux_distro.UBUNTU

hpccm/primitives/baseimage.py

Lines changed: 11 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`, `ubuntu`, `ubuntu16`, `ubuntu18`,
54-
`ubuntu20`, and `ubuntu22`. By default, the primitive attempts to
55-
figure out the Linux distribution by inspecting the image
56-
identifier, and falls back to `ubuntu` if unable to determine the
57-
Linux distribution automatically.
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.
5858
5959
_docker_env: Boolean specifying whether to load the Docker base
6060
image environment, i.e., source
@@ -135,12 +135,16 @@ def __init__(self, **kwargs):
135135
hpccm.config.set_linux_distro('rhel8')
136136
elif self.__distro == 'rockylinux8':
137137
hpccm.config.set_linux_distro('rockylinux8')
138+
elif self.__distro == 'rockylinux9':
139+
hpccm.config.set_linux_distro('rockylinux9')
138140
elif re.search(r'centos:?7', self.image):
139141
hpccm.config.set_linux_distro('centos7')
140142
elif re.search(r'centos:?8', self.image):
141143
hpccm.config.set_linux_distro('centos8')
142144
elif re.search(r'rockylinux:?8', self.image):
143145
hpccm.config.set_linux_distro('rockylinux8')
146+
elif re.search(r'rockylinux:?9', self.image):
147+
hpccm.config.set_linux_distro('rockylinux9')
144148
elif re.search(r'centos|rhel|redhat', self.image):
145149
hpccm.config.set_linux_distro('centos')
146150
elif re.search(r'ubi:?7', self.image):
@@ -155,6 +159,8 @@ def __init__(self, **kwargs):
155159
hpccm.config.set_linux_distro('ubuntu20')
156160
elif re.search(r'ubuntu:?22', self.image):
157161
hpccm.config.set_linux_distro('ubuntu22')
162+
elif re.search(r'ubuntu:?24', self.image):
163+
hpccm.config.set_linux_distro('ubuntu24')
158164
elif re.search(r'ubuntu', self.image):
159165
hpccm.config.set_linux_distro('ubuntu')
160166
else:

test/test_config.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ def test_set_linux_distro_ubuntu(self):
6868
hpccm.linux_distro.UBUNTU)
6969
self.assertEqual(hpccm.config.g_linux_version, Version('18.04'))
7070

71+
hpccm.config.set_linux_distro('ubuntu20')
72+
self.assertEqual(hpccm.config.g_linux_distro,
73+
hpccm.linux_distro.UBUNTU)
74+
self.assertEqual(hpccm.config.g_linux_version, Version('20.04'))
75+
76+
hpccm.config.set_linux_distro('ubuntu22')
77+
self.assertEqual(hpccm.config.g_linux_distro,
78+
hpccm.linux_distro.UBUNTU)
79+
self.assertEqual(hpccm.config.g_linux_version, Version('22.04'))
80+
81+
hpccm.config.set_linux_distro('ubuntu24')
82+
self.assertEqual(hpccm.config.g_linux_distro,
83+
hpccm.linux_distro.UBUNTU)
84+
self.assertEqual(hpccm.config.g_linux_version, Version('24.04'))
85+
7186
@docker
7287
def test_set_linux_distro_centos(self):
7388
"""Set Linux distribution to CentOS"""
@@ -112,6 +127,11 @@ def test_set_linux_distro_rockylinux(self):
112127
hpccm.linux_distro.ROCKYLINUX)
113128
self.assertEqual(hpccm.config.g_linux_version, Version('8.0'))
114129

130+
hpccm.config.set_linux_distro('rockylinux9')
131+
self.assertEqual(hpccm.config.g_linux_distro,
132+
hpccm.linux_distro.ROCKYLINUX)
133+
self.assertEqual(hpccm.config.g_linux_version, Version('9.0'))
134+
115135
@docker
116136
def test_set_linux_distro_invalid(self):
117137
"""Set Linux distribution to an invalid value"""

0 commit comments

Comments
 (0)