Skip to contentSkip to conversation

scripts/ci: update build environment playbooks

PATCH New Paolo Bonzini 1 participant 6 messages Jan 19, 2023

lore
Share & tools
lore
#0 lore raw

cover scripts/ci: update build environment playbooks

This series cleans up and updates the Ansible playbooks in scripts/ci, with the aim of enabling Python 3.8 in the custom CentOS runner. This is the first step towards bumping the minimum required version of Python past 3.6, because the custom runner has to be updated manually by Cleber unlike the containers in tests/docker/dockerfiles.

The patches comprise other changes than just updating Python 3.8:
- small cleanups (patch 1)
- support CentOS Stream 8 (patch 2)
- make the playbook actually work (patch 3)
- do not force me to test two different sets of packages :) (patch 4)

Paolo Bonzini (5):
scripts/ci: remove unnecessary checks from CentOS playbook scripts/ci: support CentOS Stream 8 in build-environment.yaml scripts/ci: add capstone development packages
scripts/ci: unify package lists for CentOS in build-environment files scripts/ci: bump CentOS Python to 3.8

 .../org.centos/stream/8/build-environment.yml | 38 ++++++++++--
 .../ci/org.centos/stream/8/x86_64/configure   |  1 +
 scripts/ci/setup/build-environment.yml        | 59 +++++++++++++++++--
 3 files changed, 90 insertions(+), 8 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/5 scripts/ci: remove unnecessary checks from CentOS playbook

The playbook is meant for a CentOS 8 install and is already checking /etc/redhat-release. Simplify it by checking only the result of the "extra check" rather than the Ansible facts dictionary.

---
 scripts/ci/org.centos/stream/8/build-environment.yml | 4 ----
 1 file changed, 4 deletions(-)
scripts/ci/org.centos/stream/8/build-environment.yml +0 -4
index 42b0471634c2..fe8807b7b074 100644
@@ -17,8 +17,6 @@
         option: enabled
         value: "1"
       when:
-        - ansible_facts['distribution'] == 'CentOS'
-        - ansible_facts['distribution_major_version'] == '8'
         - centos_stream_8
 
     - name: Install basic packages to build QEMU on CentOS Stream 8
@@ -46,6 +44,4 @@
           - systemd-devel
         state: present
       when:
-        - ansible_facts['distribution'] == 'CentOS'
-        - ansible_facts['distribution_major_version'] == '8'
         - centos_stream_8
Signature · 1 line
2.38.1
#2 lore raw

PATCH 2/5 scripts/ci: support CentOS Stream 8 in build-environment.yaml

In reply to Paolo Bonzini

Update the CI playbook so that it is able to prepare a system with a fresh CentOS Stream 8 install, rather than just support RHEL. The ninja-build package is only available if the CentOS Powertools are enabled, which indeed is what the org.centos/stream/8 playbook is already doing.

---
 scripts/ci/setup/build-environment.yml | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
scripts/ci/setup/build-environment.yml +12 -2
index b04c2b7ceee9..ad63bbb3ccf7 100644
@@ -130,6 +130,16 @@
         - ansible_facts['distribution_version'] == '20.04'
         - ansible_facts['architecture'] == 'aarch64'
 
+    - name: Enable PowerTools repo on CentOS 8
+      ini_file:
+        path: /etc/yum.repos.d/CentOS-Stream-PowerTools.repo
+        section: powertools
+        option: enabled
+        value: "1"
+      when:
+        - ansible_facts['distribution_file_variety'] == 'CentOS'
+        - ansible_facts['distribution_major_version'] == '8'
+
     - name: Install basic packages to build QEMU on EL8
       dnf:
         # This list of packages start with tests/docker/dockerfiles/centos8.docker
@@ -165,7 +175,7 @@
           - zlib-devel
         state: present
       when:
-        - ansible_facts['distribution_file_variety'] == 'RedHat'
+        - ansible_facts['distribution_file_variety'] in ['RedHat', 'CentOS']
         - ansible_facts['distribution_version'] == '8'
 
     - name: Install packages only available on x86 and aarch64
@@ -175,6 +185,6 @@
           - spice-server
         state: present
       when:
-        - ansible_facts['distribution_file_variety'] == 'RedHat'
+        - ansible_facts['distribution_file_variety'] in ['RedHat', 'CentOS']
         - ansible_facts['distribution_version'] == '8'
         - ansible_facts['architecture'] == 'aarch64' or ansible_facts['architecture'] == 'x86_64'
Signature · 1 line
2.38.1
#3 lore raw

PATCH 3/5 scripts/ci: add capstone development packages

In reply to Paolo Bonzini

Capstone is not provided anymore by QEMU as a submodule since commit 83602083b4ad ("capstone: Remove the capstone submodule", 2022-05-18). For the org.centos/stream/8 playbook to actually provide a usable build environment, it needs to include the capstone-devel package.

Include it in the "basic" build packages as well so that the resulting QEMU has full disassembling functionality.

---
 scripts/ci/org.centos/stream/8/build-environment.yml |  9 +++++++++
 scripts/ci/setup/build-environment.yml               | 11 +++++++++++
 2 files changed, 20 insertions(+)
scripts/ci/org.centos/stream/8/build-environment.yml +9 -0
index fe8807b7b074..95474ad034dc 100644
@@ -10,6 +10,14 @@
       check_mode: yes
       register: centos_stream_8
 
+    - name: Enable EPEL repo on CentOS Stream 8
+      dnf:
+        name:
+          - epel-release
+        state: present
+      when:
+        - centos_stream_8
+
     - name: Enable PowerTools repo on CentOS Stream 8
       ini_file:
         path: /etc/yum.repos.d/CentOS-Stream-PowerTools.repo
@@ -22,6 +30,7 @@
     - name: Install basic packages to build QEMU on CentOS Stream 8
       dnf:
         name:
+          - capstone-devel
           - device-mapper-multipath-devel
           - glusterfs-api-devel
           - gnutls-devel
scripts/ci/setup/build-environment.yml +11 -0
index ad63bbb3ccf7..2e5f3b06028a 100644
@@ -46,6 +46,7 @@
           - libbrlapi-dev
           - libbz2-dev
           - libcacard-dev
+          - libcapstone-dev
           - libcap-ng-dev
           - libcurl4-gnutls-dev
           - libdrm-dev
@@ -130,6 +131,15 @@
         - ansible_facts['distribution_version'] == '20.04'
         - ansible_facts['architecture'] == 'aarch64'
 
+    - name: Enable EPEL repo on EL8
+      dnf:
+        name:
+          - epel-release
+        state: present
+      when:
+        - ansible_facts['distribution_file_variety'] in ['RedHat', 'CentOS']
+        - ansible_facts['distribution_major_version'] == '8'
+
     - name: Enable PowerTools repo on CentOS 8
       ini_file:
         path: /etc/yum.repos.d/CentOS-Stream-PowerTools.repo
@@ -148,6 +158,7 @@
         name:
           - bzip2
           - bzip2-devel
+          - capstone-devel
           - dbus-daemon
           - diffutils
           - gcc
Signature · 1 line
2.38.1
#4 lore raw

PATCH 4/5 scripts/ci: unify package lists for CentOS in build-environment files

In reply to Paolo Bonzini

scripts/ci/org.centos/stream/8/build-environment.yml has a slightly different list of packages compared to scripts/ci/setup/build-environment.yaml. Make them the same for simplicity.

---
 .../org.centos/stream/8/build-environment.yml | 25 +++++++++++++++++++
 scripts/ci/setup/build-environment.yml        | 20 ++++++++++++++-
 2 files changed, 44 insertions(+), 1 deletion(-)
scripts/ci/org.centos/stream/8/build-environment.yml +25 -0
index 95474ad034dc..b1768d18afac 100644
@@ -30,13 +30,26 @@
     - name: Install basic packages to build QEMU on CentOS Stream 8
       dnf:
         name:
+          - bzip2
+          - bzip2-devel
           - capstone-devel
+          - dbus-daemon
           - device-mapper-multipath-devel
+          - diffutils
+          - gcc
+          - gcc-c++
+          - genisoimage
+          - gettext
+          - git
+          - glib2-devel
           - glusterfs-api-devel
           - gnutls-devel
+          - libaio-devel
           - libcap-ng-devel
           - libcurl-devel
+          - libepoxy-devel
           - libfdt-devel
+          - libgcrypt-devel
           - libiscsi-devel
           - libpmem-devel
           - librados-devel
@@ -44,13 +57,25 @@
           - libseccomp-devel
           - libssh-devel
           - libxkbcommon-devel
+          - lzo-devel
+          - make
+          - mesa-libEGL-devel
+          - nettle-devel
           - ninja-build
+          - nmap-ncat
           - numactl-devel
+          - pixman-devel
+          - python36
           - python3-sphinx
+          - rdma-core-devel
           - redhat-rpm-config
           - snappy-devel
+          - spice-glib-devel
           - spice-server-devel
           - systemd-devel
+          - systemtap-sdt-devel
+          - tar
+          - zlib-devel
         state: present
       when:
         - centos_stream_8
scripts/ci/setup/build-environment.yml +19 -1
index 2e5f3b06028a..2274f736f7de 100644
@@ -160,6 +160,7 @@
           - bzip2-devel
           - capstone-devel
           - dbus-daemon
+          - device-mapper-multipath-devel
           - diffutils
           - gcc
           - gcc-c++
@@ -167,20 +168,36 @@
           - gettext
           - git
           - glib2-devel
+          - glusterfs-api-devel
+          - gnutls-devel
           - libaio-devel
+          - libcap-ng-devel
+          - libcurl-devel
           - libepoxy-devel
+          - libfdt-devel
           - libgcrypt-devel
+          - libiscsi-devel
+          - libpmem-devel
+          - librados-devel
+          - librbd-devel
+          - libseccomp-devel
+          - libssh-devel
+          - libxkbcommon-devel
           - lzo-devel
           - make
           - mesa-libEGL-devel
           - nettle-devel
           - ninja-build
           - nmap-ncat
-          - perl-Test-Harness
+          - numactl-devel
           - pixman-devel
           - python36
+          - python3-sphinx
           - rdma-core-devel
+          - redhat-rpm-config
+          - snappy-devel
           - spice-glib-devel
+          - systemd-devel
           - systemtap-sdt-devel
           - tar
           - zlib-devel
@@ -194,6 +211,7 @@
         # Spice server not available in ppc64le
         name:
           - spice-server
+          - spice-server-devel
         state: present
       when:
         - ansible_facts['distribution_file_variety'] in ['RedHat', 'CentOS']
Signature · 1 line
2.38.1
#5 lore raw

PATCH 5/5 scripts/ci: bump CentOS Python to 3.8

In reply to Paolo Bonzini

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.

---
 .../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(-)
scripts/ci/org.centos/stream/8/build-environment.yml +1 -1
index b1768d18afac..0d094d70c3b3 100644
@@ -65,7 +65,7 @@
           - nmap-ncat
           - numactl-devel
           - pixman-devel
-          - python36
+          - python38
           - python3-sphinx
           - rdma-core-devel
           - redhat-rpm-config
scripts/ci/org.centos/stream/8/x86_64/configure +1 -0
index 75882faa9ca5..65eacf3c56bb 100755
@@ -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" \
scripts/ci/setup/build-environment.yml +13 -1
index 2274f736f7de..78b1021cd420 100644
@@ -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'
Signature · 1 line
2.38.1