From 746056ce30a5a3508d63500d85f33b7ce704cb4b Mon Sep 17 00:00:00 2001 From: Scott McMillan Date: Wed, 29 Apr 2026 15:18:10 -0500 Subject: [PATCH] Base support for Ubuntu 26.04 --- docs/misc_api.md | 6 +++--- docs/primitives.md | 8 ++++---- hpccm/building_blocks/ofed.py | 4 +++- hpccm/config.py | 9 ++++++--- hpccm/primitives/baseimage.py | 12 ++++++++---- test/helpers.py | 9 +++++++++ test/test_baseimage.py | 7 +++++++ test/test_ofed.py | 28 +++++++++++++++++++++++++++- 8 files changed, 67 insertions(+), 16 deletions(-) diff --git a/docs/misc_api.md b/docs/misc_api.md index fcb16ee..cac104b 100644 --- a/docs/misc_api.md +++ b/docs/misc_api.md @@ -91,9 +91,9 @@ __Arguments__ - __distro (string)__: Valid values are `centos7`, `centos8`, `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`. +`ubuntu18`, `ubuntu20`, `ubuntu22`, `ubuntu24`, and `ubuntu26`. +`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 557eb8f..80f3cf8 100644 --- a/docs/primitives.md +++ b/docs/primitives.md @@ -23,10 +23,10 @@ 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`, `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. +`ubuntu`, `ubuntu16`, `ubuntu18`, `ubuntu20`, `ubuntu22`, `ubuntu24`, +and `ubuntu26`. 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/building_blocks/ofed.py b/hpccm/building_blocks/ofed.py index 615ab5b..80ca804 100644 --- a/hpccm/building_blocks/ofed.py +++ b/hpccm/building_blocks/ofed.py @@ -113,7 +113,9 @@ def __distro(self): if hpccm.config.g_linux_version >= Version('18.0'): # Give priority to packages from the Ubuntu repositories over # vendor repositories - if hpccm.config.g_linux_version >= Version('24.0'): + if hpccm.config.g_linux_version >= Version('26.0'): + self.__extra_opts = ['-t resolute'] + elif hpccm.config.g_linux_version >= Version('24.0'): self.__extra_opts = ['-t noble'] elif hpccm.config.g_linux_version >= Version('22.0'): self.__extra_opts = ['-t jammy'] diff --git a/hpccm/config.py b/hpccm/config.py index eb2a1a3..836a973 100644 --- a/hpccm/config.py +++ b/hpccm/config.py @@ -176,9 +176,9 @@ def set_linux_distro(distro): distro (string): Valid values are `centos7`, `centos8`, `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`. + `ubuntu18`, `ubuntu20`, `ubuntu22`, `ubuntu24`, and `ubuntu26`. + `ubuntu` is an alias for `ubuntu16`, `centos` is an alias for `centos7`, + and `rhel` is an alias for `rhel7`. """ this = sys.modules[__name__] @@ -227,6 +227,9 @@ def set_linux_distro(distro): elif distro == 'ubuntu24': this.g_linux_distro = linux_distro.UBUNTU this.g_linux_version = Version('24.04') + elif distro == 'ubuntu26': + this.g_linux_distro = linux_distro.UBUNTU + this.g_linux_version = Version('26.04') else: logging.warning('Unable to determine the Linux distribution, defaulting to Ubuntu') this.g_linux_distro = linux_distro.UBUNTU diff --git a/hpccm/primitives/baseimage.py b/hpccm/primitives/baseimage.py index c35538d..38ba9f7 100644 --- a/hpccm/primitives/baseimage.py +++ b/hpccm/primitives/baseimage.py @@ -51,10 +51,10 @@ class baseimage(object): _distro: The underlying Linux distribution of the base image. Valid values are `centos`, `centos7`, `centos8`, `redhat`, `rhel`, `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. + `ubuntu`, `ubuntu16`, `ubuntu18`, `ubuntu20`, `ubuntu22`, `ubuntu24`, + and `ubuntu26`. 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 @@ -123,6 +123,8 @@ def __init__(self, **kwargs): hpccm.config.set_linux_distro('ubuntu22') elif self.__distro == 'ubuntu24': hpccm.config.set_linux_distro('ubuntu24') + elif self.__distro == 'ubuntu26': + hpccm.config.set_linux_distro('ubuntu26') elif self.__distro == 'centos': hpccm.config.set_linux_distro('centos') elif self.__distro == 'centos7': @@ -167,6 +169,8 @@ def __init__(self, **kwargs): hpccm.config.set_linux_distro('ubuntu22') elif re.search(r'ubuntu:?24', self.image): hpccm.config.set_linux_distro('ubuntu24') + elif re.search(r'ubuntu:?26', self.image): + hpccm.config.set_linux_distro('ubuntu26') elif re.search(r'ubuntu', self.image): hpccm.config.set_linux_distro('ubuntu') else: diff --git a/test/helpers.py b/test/helpers.py index f48b5af..a119afa 100644 --- a/test/helpers.py +++ b/test/helpers.py @@ -230,6 +230,15 @@ def wrapper(*args, **kwargs): return wrapper +def ubuntu26(function): + """Decorator to set the Linux distribution to Ubuntu 26.04""" + def wrapper(*args, **kwargs): + hpccm.config.g_linux_distro = linux_distro.UBUNTU + hpccm.config.g_linux_version = Version('26.04') + return function(*args, **kwargs) + + return wrapper + def x86_64(function): """Decorator to set the CPU architecture to x86_64""" def wrapper(*args, **kwargs): diff --git a/test/test_baseimage.py b/test/test_baseimage.py index c3fa07d..4cabd65 100644 --- a/test/test_baseimage.py +++ b/test/test_baseimage.py @@ -316,6 +316,13 @@ def test_distro_ubuntu24(self): self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU) self.assertEqual(hpccm.config.g_linux_version, Version('24.04')) + @docker + def test_distro_ubuntu26(self): + """Base image Linux distribution specification""" + b = baseimage(image='foo', _distro='ubuntu26') + self.assertEqual(hpccm.config.g_linux_distro, linux_distro.UBUNTU) + self.assertEqual(hpccm.config.g_linux_version, Version('26.04')) + @docker def test_distro_centos(self): """Base image Linux distribution specification""" diff --git a/test/test_ofed.py b/test/test_ofed.py index 08d0d4c..3e7fe2e 100644 --- a/test/test_ofed.py +++ b/test/test_ofed.py @@ -22,7 +22,7 @@ import logging # pylint: disable=unused-import import unittest -from helpers import aarch64, centos, centos8, docker, rockylinux9, ubuntu, ubuntu18, ubuntu20, ubuntu22, ubuntu24, ppc64le, x86_64 +from helpers import aarch64, centos, centos8, docker, rockylinux9, ubuntu, ubuntu18, ubuntu20, ubuntu22, ubuntu24, ubuntu26, ppc64le, x86_64 from hpccm.building_blocks.ofed import ofed @@ -166,6 +166,32 @@ def test_defaults_ubuntu24(self): rdmacm-utils && \ rm -rf /var/lib/apt/lists/*''') + @x86_64 + @ubuntu26 + @docker + def test_defaults_ubuntu26(self): + """Default ofed building block""" + o = ofed() + self.assertEqual(str(o), +r'''# OFED +RUN apt-get update -y && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -t resolute \ + dapl2-utils \ + ibutils \ + ibverbs-providers \ + ibverbs-utils \ + infiniband-diags \ + libdapl-dev \ + libdapl2 \ + libibmad-dev \ + libibmad5 \ + libibverbs-dev \ + libibverbs1 \ + librdmacm-dev \ + librdmacm1 \ + rdmacm-utils && \ + rm -rf /var/lib/apt/lists/*''') + @x86_64 @centos @docker