diff mbox series

[5/5] scripts/ci: bump CentOS Python to 3.8

Message ID 20230119154145.471156-6-pbonzini@redhat.com
State New
Headers show
Series scripts/ci: update build environment playbooks | expand

Commit Message

Paolo Bonzini Jan. 19, 2023, 3:41 p.m. UTC
In preparation for bumping the minimum requirement for the Python
runtime in QEMU 8.0, use the Python 3.8 package in the CentOS Stream 8
build environments.  To cover all bases, the "generic" playbook sets up
alternatives so that /usr/bin/python3 points to Python 3.8, while the
custom runner uses the --python option to configure.  The latter is
probably more suitable for the task of building an RPM file.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 .../ci/org.centos/stream/8/build-environment.yml   |  2 +-
 scripts/ci/org.centos/stream/8/x86_64/configure    |  1 +
 scripts/ci/setup/build-environment.yml             | 14 +++++++++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/scripts/ci/org.centos/stream/8/build-environment.yml b/scripts/ci/org.centos/stream/8/build-environment.yml
index b1768d18afac..0d094d70c3b3 100644
--- a/scripts/ci/org.centos/stream/8/build-environment.yml
+++ b/scripts/ci/org.centos/stream/8/build-environment.yml
@@ -65,7 +65,7 @@ 
           - nmap-ncat
           - numactl-devel
           - pixman-devel
-          - python36
+          - python38
           - python3-sphinx
           - rdma-core-devel
           - redhat-rpm-config
diff --git a/scripts/ci/org.centos/stream/8/x86_64/configure b/scripts/ci/org.centos/stream/8/x86_64/configure
index 75882faa9ca5..65eacf3c56bb 100755
--- a/scripts/ci/org.centos/stream/8/x86_64/configure
+++ b/scripts/ci/org.centos/stream/8/x86_64/configure
@@ -16,6 +16,7 @@ 
 # that patches adding downstream specific devices are not available.
 #
 ../configure \
+--python=/usr/bin/python3.8 \
 --prefix="/usr" \
 --libdir="/usr/lib64" \
 --datadir="/usr/share" \
diff --git a/scripts/ci/setup/build-environment.yml b/scripts/ci/setup/build-environment.yml
index 2274f736f7de..78b1021cd420 100644
--- a/scripts/ci/setup/build-environment.yml
+++ b/scripts/ci/setup/build-environment.yml
@@ -191,7 +191,7 @@ 
           - nmap-ncat
           - numactl-devel
           - pixman-devel
-          - python36
+          - python38
           - python3-sphinx
           - rdma-core-devel
           - redhat-rpm-config
@@ -217,3 +217,15 @@ 
         - ansible_facts['distribution_file_variety'] in ['RedHat', 'CentOS']
         - ansible_facts['distribution_version'] == '8'
         - ansible_facts['architecture'] == 'aarch64' or ansible_facts['architecture'] == 'x86_64'
+
+    - name: Check whether the Python runtime version is managed by alternatives
+      stat:
+        path: /etc/alternatives/python3
+      register: python3
+
+    - name: Set default Python runtime to 3.8 on EL8
+      command: alternatives --set python3 /usr/bin/python3.8
+      when:
+        - ansible_facts['distribution_file_variety'] in ['RedHat', 'CentOS']
+        - ansible_facts['distribution_version'] == '8'
+        - python3.stat.islnk and python3.stat.lnk_target != '/usr/bin/python3.8'