Skip to content

Commit

Permalink
Add llvm ubuntu 24.04 support (#493)
Browse files Browse the repository at this point in the history
* Add llvm ubuntu 24.04 support

* Fix versions and incorrect distro

Co-authored-by: Andrey Alekseenko <al42and@gmail.com>

---------

Co-authored-by: Andrey Alekseenko <al42and@gmail.com>
  • Loading branch information
gonzalobg and al42and authored Aug 15, 2024
1 parent 25a067a commit e712954
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 3 deletions.
11 changes: 9 additions & 2 deletions hpccm/building_blocks/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,19 @@ def __upstream_package_repos(self):
"""Return the package repositories for the given distro and llvm
version. The development branch repositories are not
versioned and must be handled differently. Currently the
development branch is version 14."""
development branch is version self.__trunk_version."""

codename = 'xenial'
codename_ver = 'xenial'

if (hpccm.config.g_linux_version >= Version('22.0') and
if (hpccm.config.g_linux_version >= Version('24.0') and
hpccm.config.g_linux_version < Version('25.0')):
codename = 'noble'
if self.__version == self.__trunk_version:
codename_ver = 'noble'
else:
codename_ver = 'noble-{}'.format(self.__version)
elif (hpccm.config.g_linux_version >= Version('22.0') and
hpccm.config.g_linux_version < Version('23.0')):
codename = 'jammy'
if self.__version == self.__trunk_version:
Expand Down
9 changes: 9 additions & 0 deletions test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ def wrapper(*args, **kwargs):

return wrapper

def ubuntu24(function):
"""Decorator to set the Linux distribution to Ubuntu 24.04"""
def wrapper(*args, **kwargs):
hpccm.config.g_linux_distro = linux_distro.UBUNTU
hpccm.config.g_linux_version = Version('24.04')
return function(*args, **kwargs)

return wrapper

def x86_64(function):
"""Decorator to set the CPU architecture to x86_64"""
def wrapper(*args, **kwargs):
Expand Down
31 changes: 30 additions & 1 deletion test/test_llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import logging # pylint: disable=unused-import
import unittest

from helpers import aarch64, centos, centos8, docker, ppc64le, ubuntu, ubuntu18, ubuntu20, x86_64, zen2
from helpers import aarch64, centos, centos8, docker, ppc64le, ubuntu, ubuntu18, ubuntu20, ubuntu24, x86_64, zen2

from hpccm.building_blocks.llvm import llvm

Expand Down Expand Up @@ -372,6 +372,35 @@ def test_upstream_ubuntu18(self):
update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-tidy-18) 30''')

@x86_64
@ubuntu24
@docker
def test_upstream_ubuntu24(self):
"""Upstream builds"""
l = llvm(extra_tools=True, upstream=True)
self.assertEqual(str(l),
r'''# LLVM compiler
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
gnupg \
wget && \
rm -rf /var/lib/apt/lists/*
RUN wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble main" >> /etc/apt/sources.list.d/hpccm.list && \
echo "deb-src http://apt.llvm.org/noble/ llvm-toolchain-noble main" >> /etc/apt/sources.list.d/hpccm.list && \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
clang-18 \
clang-format-18 \
clang-tidy-18 \
libomp-18-dev && \
rm -rf /var/lib/apt/lists/*
RUN update-alternatives --install /usr/bin/clang clang $(which clang-18) 30 && \
update-alternatives --install /usr/bin/clang++ clang++ $(which clang++-18) 30 && \
update-alternatives --install /usr/bin/clang-format clang-format $(which clang-format-18) 30 && \
update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-tidy-18) 30''')

@ubuntu20
@docker
def test_upstream_ubuntu20(self):
Expand Down

0 comments on commit e712954

Please sign in to comment.