]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
script: move llvm.sh logic to a function 68602/head
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 1 May 2026 19:14:34 +0000 (15:14 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 5 May 2026 14:46:40 +0000 (10:46 -0400)
Move llvm.sh logic to a function and call that function in a way that
lets newer systems skip using it and install llvm packages (that
are new enough) from the distro repositories.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/script/run-make.sh

index 49f144acc5bba251d256b482dfed65d800b1a1c5..30ca35ce2740a46662bdd0f2880a757758c9ac36 100755 (executable)
@@ -48,35 +48,55 @@ function detect_ceph_dev_pkgs() {
     echo "$cmake_opts"
 }
 
+function get_llvm() {
+    if ! in_jenkins; then
+        return 0
+    fi
+
+    source /etc/os-release
+    if [ "${VERSION_ID}" = "26.04" ]; then
+        ci_debug "Skipping LLVM install script. Can use distro LLVM/clang."
+        return 10  # indicates distro too new
+    fi
+
+    wrap_sudo
+    # require clang-19. uninstall previous versions to work around package conflicts
+    local v=19
+    local remove_from=13
+    local remove_to=$(($v-1))
+    ci_debug "Removing clang package versions from $remove_from-$remove_to"
+    for i in $(seq $remove_from $remove_to); do
+        $DRY_RUN $SUDO apt-get purge --auto-remove clang-$i lldb-$i lld-$i clangd-$i python3-lldb-$i -y || true
+    done
+
+    if ! type clang-$v > /dev/null 2>&1 ; then
+        ci_debug "Getting clang-$v"
+        wget https://download.ceph.com/qa/llvm.sh
+        chmod +x llvm.sh
+        $DRY_RUN $SUDO ./llvm.sh $v
+        rm llvm.sh
+    fi
+}
+
 function prepare() {
     local which_pkg="which"
+    local distro_llvm=
     if command -v apt-get > /dev/null 2>&1 ; then
         which_pkg="debianutils"
 
-        if in_jenkins; then
-            wrap_sudo
-            # require clang-19. uninstall previous versions to work around package conflicts
-            local v=19
-            local remove_from=13
-            local remove_to=$(($v-1))
-            ci_debug "Removing clang package versions from $remove_from-$remove_to"
-            for i in $(seq $remove_from $remove_to); do
-                $DRY_RUN $SUDO apt-get purge --auto-remove clang-$i lldb-$i lld-$i clangd-$i python3-lldb-$i -y || true
-            done
-
-            if ! type clang-$v > /dev/null 2>&1 ; then
-                ci_debug "Getting clang-$v"
-                wget https://download.ceph.com/qa/llvm.sh
-                chmod +x llvm.sh
-                $DRY_RUN $SUDO ./llvm.sh $v
-                rm llvm.sh
-            fi
+        get_llvm
+        sts=$?
+        if [ $sts -eq 10 ]; then
+            distro_llvm=clang
+        elif [ $sts -ne 0 ]; then
+            echo "error: get_llvm function failed"
+            return 1
         fi
     fi
 
     if test -f ./install-deps.sh ; then
         ci_debug "Running install-deps.sh"
-        INSTALL_EXTRA_PACKAGES="ccache git $which_pkg lvm2"
+        INSTALL_EXTRA_PACKAGES="ccache git $which_pkg lvm2 ${distro_llvm}"
         # We need to add extra packages in case of ppc64 arch because python wheels are not available
         # and these dependencies are required for building the wheels from scratch.
         if [ "$(uname -m)" == "ppc64le" ]; then