From e3297c11caf9dea67bbc2561e9747621d5fb18e8 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 2 Apr 2026 14:45:59 +0200 Subject: [PATCH] Explicitly set py311 on rocky9 and minor fixes to dockerfiles. --- common/cmdtool | 84 +++++++++++++++++---------- packagingbuild/jammy/Dockerfile | 2 +- packagingbuild/noble/Dockerfile | 2 +- packagingbuild/rockylinux9/Dockerfile | 5 +- packagingtest/jammy/Dockerfile | 5 +- packagingtest/noble/Dockerfile | 5 +- packagingtest/rockylinux9/Dockerfile | 8 +-- 7 files changed, 69 insertions(+), 42 deletions(-) diff --git a/common/cmdtool b/common/cmdtool index cad9da1..ad5b1b1 100644 --- a/common/cmdtool +++ b/common/cmdtool @@ -10,6 +10,11 @@ distro_unsupported() echo "Unsupported distro $TGT" >&2 exit 1 } +version_unsupported() +{ + echo "Unsupported distro version $TGT" >&2 + exit 1 +} # Detect unsupported distribution early. if [[ ! "$TGT" =~ rocky|ubuntu ]]; then @@ -274,20 +279,6 @@ install_build_dependencies() ) dnf -y install ${PKGS[@]} dnf -y autoremove; dnf clean all - case "$TGT" in - rocky-9*) - PKGS=( - python39 - python3-devel - ) - dnf -y install ${PKGS[@]} - dnf -y autoremove; dnf clean all - ;; - *) - echo "Unsupported Redhat compatible version." - exit 1 - ;; - esac ;; ubuntu*) PKGS=( @@ -354,19 +345,53 @@ install_python() { case "$TGT" in rocky*) - PKGS=( - python3 - python3-devel - rpmdevtools - ) - dnf -y install ${PKGS[@]} - dnf -y autoremove; dnf clean all + case "$TGT" in + *9.*) + # St2 v3.10 supports py3.11 + PKGS+=( + python3.11 + python3.11-devel + python3.11-pip + python3.11-setuptools + rpmdevtools + ) + # Set py3.11 as default python3 interpreter for the system + for alt in python pip + do + alternatives --install /usr/bin/${alt} ${alt} /usr/bin/${alt}3.11 50 + alternatives --install /usr/bin/${alt}3 ${alt}3 /usr/bin/${alt}3.11 50 + alternatives --set ${alt} /usr/bin/${alt}3.11 + alternatives --set ${alt}3 /usr/bin/${alt}3.11 + done + + dnf -y install ${PKGS[@]} + dnf -y autoremove; dnf clean all + ;; + *10.*) + # Py3.12 is default on rocky10 + PKGS+=( + python3 + python3-devel + python3-setuptools + rpmdevtools + ) + dnf -y install ${PKGS[@]} + dnf -y autoremove; dnf clean all + ;; + *) + version_unsupported + ;; + esac + echo "PYTHON/PIP VERSION" + python3 --version + pip3 --version PYPKGS=( "virtualenv==20.30.0" "pip==25.0.1" wheel setuptools + build ) pip3 install --upgrade ${PYPKGS[@]} rm -rf /root/.cache @@ -391,18 +416,17 @@ install_python() "requests[security]" ) # Violate system package manager and force our requirements ... Leroy Jenkins! - case $TGT in - ubuntu-22*) + case "$TGT" in + *22.*) apt install --only-upgrade python3-pip pip3 install --ignore-installed --upgrade ${PYPKGS[@]} ;; - ubuntu-24*) + *24.*) apt install --only-upgrade python3-pip pip3 install --ignore-installed --break-system-packages --upgrade ${PYPKGS[@]} ;; *) - echo "Unsupported Ubuntu version." - exit 1 + version_unsupported ;; esac rm -rf /root/.cache @@ -414,14 +438,14 @@ install_python() } -execute_operation() +compare_operations() { test -n "$1" && test -n "$2" && test "$1" = "$2" } run() { # Permitted operation calls to be run from docker build. - OPS=( + ALLOWED_OPS=( configure_base install_download_tools install_system_tools @@ -433,9 +457,9 @@ run() ) OP="$1" EXEC=0 - for ALLOWED_OP in ${OPS[@]} + for ALLOWED_OP in ${ALLOWED_OPS[@]} do - if execute_operation "$OP" "$ALLOWED_OP"; then + if compare_operations "$OP" "$ALLOWED_OP"; then "$1" EXEC=1 fi diff --git a/packagingbuild/jammy/Dockerfile b/packagingbuild/jammy/Dockerfile index 473b0b6..c2a2aaa 100644 --- a/packagingbuild/jammy/Dockerfile +++ b/packagingbuild/jammy/Dockerfile @@ -18,7 +18,7 @@ RUN /usr/local/bin/cmdtool install_st2_build_dependencies RUN /usr/local/bin/cmdtool install_python -VOLUME ['/home/busybee/build'] +VOLUME ["/home/busybee/build"] EXPOSE 22 # Run ssh daemon in foreground and wait for bees to connect. diff --git a/packagingbuild/noble/Dockerfile b/packagingbuild/noble/Dockerfile index 1e42bf5..58cab50 100644 --- a/packagingbuild/noble/Dockerfile +++ b/packagingbuild/noble/Dockerfile @@ -18,7 +18,7 @@ RUN /usr/local/bin/cmdtool install_st2_build_dependencies RUN /usr/local/bin/cmdtool install_python -VOLUME ['/home/busybee/build'] +VOLUME ["/home/busybee/build"] EXPOSE 22 # Run ssh daemon in foreground and wait for bees to connect. diff --git a/packagingbuild/rockylinux9/Dockerfile b/packagingbuild/rockylinux9/Dockerfile index a9efab2..29be08e 100644 --- a/packagingbuild/rockylinux9/Dockerfile +++ b/packagingbuild/rockylinux9/Dockerfile @@ -5,17 +5,18 @@ COPY common/cmdtool /usr/local/bin COPY common/busybee* /tmp RUN chmod +x /usr/local/bin/cmdtool +RUN /usr/local/bin/cmdtool configure_base RUN /usr/local/bin/cmdtool install_download_tools RUN /usr/local/bin/cmdtool install_system_tools -RUN /usr/local/bin/cmdtool configure_base - RUN /usr/local/bin/cmdtool install_build_dependencies RUN /usr/local/bin/cmdtool install_st2_build_dependencies +RUN /usr/local/bin/cmdtool install_python + VOLUME ["/home/busybee/build"] EXPOSE 22 diff --git a/packagingtest/jammy/Dockerfile b/packagingtest/jammy/Dockerfile index 2aea1c0..d4560e0 100644 --- a/packagingtest/jammy/Dockerfile +++ b/packagingtest/jammy/Dockerfile @@ -15,13 +15,16 @@ RUN /usr/local/bin/cmdtool configure_base RUN /usr/local/bin/cmdtool install_system_tools RUN /usr/local/bin/cmdtool install_locale + ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 RUN /usr/local/bin/cmdtool install_download_tools RUN /usr/local/bin/cmdtool configure_testing_system -RUN systemctl preset ssh; +RUN systemctl preset ssh EXPOSE 22 diff --git a/packagingtest/noble/Dockerfile b/packagingtest/noble/Dockerfile index 73ab73f..f5f2a78 100644 --- a/packagingtest/noble/Dockerfile +++ b/packagingtest/noble/Dockerfile @@ -15,13 +15,16 @@ RUN /usr/local/bin/cmdtool configure_base RUN /usr/local/bin/cmdtool install_system_tools RUN /usr/local/bin/cmdtool install_locale + ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 RUN /usr/local/bin/cmdtool install_download_tools RUN /usr/local/bin/cmdtool configure_testing_system -RUN systemctl preset ssh; +RUN systemctl preset ssh EXPOSE 22 diff --git a/packagingtest/rockylinux9/Dockerfile b/packagingtest/rockylinux9/Dockerfile index fc23bca..918f781 100644 --- a/packagingtest/rockylinux9/Dockerfile +++ b/packagingtest/rockylinux9/Dockerfile @@ -7,14 +7,8 @@ COPY common/cmdtool /usr/local/bin COPY common/busybee* /tmp RUN chmod +x /usr/local/bin/cmdtool -RUN /usr/local/bin/cmdtool install_download_tools - RUN /usr/local/bin/cmdtool configure_base -RUN /usr/local/bin/cmdtool install_build_dependencies - -RUN /usr/local/bin/cmdtool install_st2_build_dependencies - RUN /usr/local/bin/cmdtool install_system_tools RUN /usr/local/bin/cmdtool install_locale @@ -23,6 +17,8 @@ ENV LANG=en_US.UTF-8 ENV LANGUAGE=en_US:en ENV LC_ALL=en_US.UTF-8 +RUN /usr/local/bin/cmdtool install_download_tools + RUN /usr/local/bin/cmdtool configure_testing_system EXPOSE 22