]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
CI: Fix builds following qemu-xen update
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 4 Oct 2024 13:27:02 +0000 (14:27 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 4 Oct 2024 18:27:40 +0000 (19:27 +0100)
A recent update to qemu-xen has bumped the build requirements, with Python 3.8
being the new baseline but also needing the 'ensurepip' and 'tomllib/tomli'
packages.

 * Ubuntu/Debian package 'ensurepip' separately, but it can be obtained by
   installing the python3-venv package.

 * 'tomllib' was added to the python standard library in Python 3.11, but
   previously it was a separate package named 'tomli'.

In terms of changes required to build QEMU:

 * Ubuntu 24.04 (Noble) has Python 3.12 so only needs python3-venv

 * Ubuntu 22.04 (Jammy) has Python 3.10 but does have a python3-tomli package
   that QEMU is happy with.

 * FreeBSD has Python 3.9, but Python 3.11 is available.

In terms of exclusions:

 * Ubuntu 20.04 (Focal) has Python 3.8, but lacks any kind of tomli package.

 * Fedora 29 (Python 3.7), OpenSUSE Leap 15.6 (Python 3.6), and Ubuntu
   18.04/Bionic (Python 3.6) are now too old.

Detecting tomllib/tomli is more than can fit in build's one-liner, so break it
out into a proper script.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
.cirrus.yml
automation/build/ubuntu/22.04-x86_64.dockerfile
automation/build/ubuntu/24.04-x86_64.dockerfile
automation/scripts/build
automation/scripts/qemu-deps-check.py [new file with mode: 0755]

index 1c2a6cb8120e55da269a39ec2d34067228ce53c8..00e4c57678c228fc0df0d2d59cf651f6c7d77590 100644 (file)
@@ -7,10 +7,11 @@ freebsd_template: &FREEBSD_TEMPLATE
   install_script: pkg install -y seabios gmake ninja bash
                                  pkgconf python bison perl5
                                  yajl lzo2 pixman argp-standalone
-                                 libxml2 glib git
+                                 libxml2 glib git python311
 
   build_script:
     - cc --version
+    - export PYTHON=/usr/local/bin/python3.11
     - ./configure --with-system-seabios=/usr/local/share/seabios/bios.bin
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
index 230903f624d928ae6e1f084b1f3e599b3467f3ab..6aa3c4d1881d910903cd6babae0ba544d178b3f8 100644 (file)
@@ -62,6 +62,8 @@ RUN <<EOF
         meson
         ninja-build
         python3-packaging
+        python3-tomli
+        python3-venv
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
index 277f92facfd9d5c341e47109bd51a0be7480ab3b..c46d152abf103a9e8fc25d80127ec29c70591ec4 100644 (file)
@@ -62,6 +62,7 @@ RUN <<EOF
         meson
         ninja-build
         python3-packaging
+        python3-venv
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
index 1879c1db6d0dc9ad8b12db356abd7d7c8bee0804..34416297a4b7bc46be0d903cadd3819eb48a9d53 100755 (executable)
@@ -91,9 +91,9 @@ else
         cfgargs+=("--with-extra-qemuu-configure-args=\"--disable-werror\"")
     fi
 
-    # Qemu requires Python 3.5 or later, and ninja
+    # Qemu requires Python 3.8 or later, and ninja
     # and Clang 10 or later
-    if ! type python3 || python3 -c "import sys; res = sys.version_info < (3, 5); exit(not(res))" \
+    if ! type python3 || ! python3 automation/scripts/qemu-deps-check.py \
             || [[ "$cc_is_clang" == y && "$cc_ver" -lt 0x0a0000 ]] \
             || ! type ninja; then
         cfgargs+=("--with-system-qemu=/bin/false")
diff --git a/automation/scripts/qemu-deps-check.py b/automation/scripts/qemu-deps-check.py
new file mode 100755 (executable)
index 0000000..f6188af
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+import sys
+
+if sys.version_info < (3, 8):
+    print("Python %d.%d.%d too old" %
+          (sys.version_info.major,
+           sys.version_info.minor,
+           sys.version_info.micro))
+    exit(1)
+
+try:
+    import tomllib
+except ImportError:
+    try:
+        import tomli
+    except ImportError:
+        print("No tomli")
+        exit(1)