From: John Mulligan Date: Fri, 1 May 2026 19:14:34 +0000 (-0400) Subject: script: move llvm.sh logic to a function X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F68602%2Fhead;p=ceph.git script: move llvm.sh logic to a function 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 --- diff --git a/src/script/run-make.sh b/src/script/run-make.sh index 49f144acc5bb..30ca35ce2740 100755 --- a/src/script/run-make.sh +++ b/src/script/run-make.sh @@ -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