]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: Bump minimum glib2 version to 2.66.0
authorPeter Krempa <pkrempa@redhat.com>
Mon, 27 Jan 2025 16:42:34 +0000 (17:42 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 28 Jan 2025 16:04:39 +0000 (17:04 +0100)
Per our supported platforms the minimum available versions are:

         CentOS Stream 9: 2.68.4
               Debian 11: 2.66.8
               Fedora 39: 2.78.6
      openSUSE Leap 15.6: 2.78.6
            Ubuntu 22.04: 2.72.4
           FreeBSD ports: 2.80.5
          macOS homebrew: 2.82.4
          macOS macports: 2.78.4

Bump to 2.66 which is limited by Debian 11. While ideally we'd bump to
2.68 which would give us 'g_strv_builder' and friends 2.66 is enough for
g_ptr_array_steal() which can be used to emulate the former with almost
no extra code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
libvirt.spec.in
meson.build
src/libvirt_private.syms
src/qemu/qemu_agent.c
src/qemu/qemu_monitor.c
src/util/glibcompat.c
src/util/glibcompat.h
src/util/vireventglib.c

index 0483baddbeb926a9b2603b24cd80910610bb754c..a82c366334cf48584aef1ea264d2af112662e745 100644 (file)
@@ -357,7 +357,7 @@ BuildRequires: gcc
     %if %{with_libxl}
 BuildRequires: xen-devel
     %endif
-BuildRequires: glib2-devel >= 2.58
+BuildRequires: glib2-devel >= 2.66
 BuildRequires: libxml2-devel
 BuildRequires: readline-devel
 BuildRequires: pkgconfig(bash-completion) >= 2.0
index 0bcab73ed89da5482cdf1bd0c248dd916de83385..c7e5947d10e21d9670290631c7f8d3bc2506a094 100644 (file)
@@ -1009,7 +1009,7 @@ else
   endif
 endif
 
-glib_version = '2.58.0'
+glib_version = '2.66.0'
 glib_dep = dependency('glib-2.0', version: '>=' + glib_version)
 gobject_dep = dependency('gobject-2.0', version: '>=' + glib_version)
 if host_machine.system() == 'windows'
index ee90fb2b849ecc71743f0493a629f670ae4eabc8..2fe0a079442796405ba25e548c0f3c64cfaf310d 100644 (file)
@@ -1879,10 +1879,6 @@ virStorageSourceUpdatePhysicalSize;
 
 
 # util/glibcompat.h
-vir_g_fsync;
-vir_g_source_unref;
-vir_g_strdup_printf;
-vir_g_strdup_vprintf;
 vir_g_string_replace;
 
 
index 22359f85186138d0d1f3213a2640e87d57d77410..43fca86f10ed66078a8a2e63a488ed9b1a6abc7a 100644 (file)
@@ -448,7 +448,7 @@ qemuAgentUnregister(qemuAgent *agent)
 {
     if (agent->watch) {
         g_source_destroy(agent->watch);
-        vir_g_source_unref(agent->watch, agent->context);
+        g_source_unref(agent->watch);
         agent->watch = NULL;
     }
 }
index ec2f1667853c9009b83b0c91d2dc03eb7fcb064a..e0b1bf1d370884841117902634e0426cb7e8e67a 100644 (file)
@@ -745,7 +745,7 @@ qemuMonitorUnregister(qemuMonitor *mon)
 {
     if (mon->watch) {
         g_source_destroy(mon->watch);
-        vir_g_source_unref(mon->watch, mon->context);
+        g_source_unref(mon->watch);
         mon->watch = NULL;
     }
 }
index 98dcfab38958524ac0685333c02a3b93cef07a66..bcb666992a838cedda80fccd00ac9526ebe8ff0b 100644 (file)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
-#undef g_fsync
-#undef g_strdup_printf
-#undef g_strdup_vprintf
-
-
-/* Drop when min glib >= 2.63.0 */
-gint
-vir_g_fsync(gint fd)
-{
-#ifdef G_OS_WIN32
-    return _commit(fd);
-#else
-    return fsync(fd);
-#endif
-}
-
-
-/* Due to a bug in glib, g_strdup_printf() nor g_strdup_vprintf()
- * abort on OOM.  It's fixed in glib's upstream. Provide our own
- * implementation until the fix gets distributed. */
-char *
-vir_g_strdup_printf(const char *msg, ...)
-{
-    va_list args;
-    char *ret;
-    va_start(args, msg);
-    ret = g_strdup_vprintf(msg, args);
-    if (!ret)
-        abort();
-    va_end(args);
-    return ret;
-}
-
-
-char *
-vir_g_strdup_vprintf(const char *msg, va_list args)
-{
-    char *ret;
-    ret = g_strdup_vprintf(msg, args);
-    if (!ret)
-        abort();
-    return ret;
-}
-
-
-/*
- * If the last reference to a GSource is released in a non-main
- * thread we're exposed to a race condition that causes a
- * crash:
- *
- *    https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1358
- *
- * Thus we're using an idle func to release our ref...
- *
- * ...but this imposes a significant performance penalty on
- * I/O intensive workloads which are sensitive to the iterations
- * of the event loop, so avoid the workaround if we know we have
- * new enough glib.
- *
- * The function below is used from a header file definition.
- *
- * Drop when min glib >= 2.64.0
- */
-#if GLIB_CHECK_VERSION(2, 64, 0)
-void vir_g_source_unref(GSource *src, GMainContext *ctx G_GNUC_UNUSED)
-{
-    g_source_unref(src);
-}
-#else
-
-static gboolean
-virEventGLibSourceUnrefIdle(gpointer data)
-{
-    GSource *src = data;
-
-    g_source_unref(src);
-
-    return FALSE;
-}
-
-void vir_g_source_unref(GSource *src, GMainContext *ctx)
-{
-    GSource *idle = g_idle_source_new();
-
-    g_source_set_callback(idle, virEventGLibSourceUnrefIdle, src, NULL);
-
-    g_source_attach(idle, ctx);
-
-    g_source_unref(idle);
-}
-
-#endif
-
-
 /**
  * Adapted (to pass syntax check) from 'g_string_replace' from
  * glib-2.81.1. Drop once minimum glib is bumped to 2.68.
index 474ff95bc5265e7c792b6406c4cfd08a8c382dad..a3d01089e6b1597cc5e1f3fe52c5b1809545566c 100644 (file)
 
 #endif /* GLib < 2.67.0 */
 
-
-gint vir_g_fsync(gint fd);
-char *vir_g_strdup_printf(const char *msg, ...)
-    G_GNUC_PRINTF(1, 2);
-char *vir_g_strdup_vprintf(const char *msg, va_list args)
-    G_GNUC_PRINTF(1, 0);
-
-#if !GLIB_CHECK_VERSION(2, 64, 0)
-# define g_strdup_printf vir_g_strdup_printf
-# define g_strdup_vprintf vir_g_strdup_vprintf
-#endif
-
-#undef g_fsync
-#define g_fsync vir_g_fsync
-
-void vir_g_source_unref(GSource *src, GMainContext *ctx);
-
-
 /* Drop once we require glib-2.68 at minimum */
 guint
 vir_g_string_replace(GString *string,
index 023dc37445c259f9f5b8491634bd3ea71dc768cc..6c54f621234c732c3aeab7957b26fc13dc23d7d3 100644 (file)
@@ -213,7 +213,7 @@ virEventGLibHandleUpdate(int watch,
         if (data->source != NULL) {
             VIR_DEBUG("Removed old handle source=%p", data->source);
             g_source_destroy(data->source);
-            vir_g_source_unref(data->source, NULL);
+            g_source_unref(data->source);
         }
 
         data->source = virEventGLibAddSocketWatch(
@@ -227,7 +227,7 @@ virEventGLibHandleUpdate(int watch,
 
         VIR_DEBUG("Removed old handle source=%p", data->source);
         g_source_destroy(data->source);
-        vir_g_source_unref(data->source, NULL);
+        g_source_unref(data->source);
         data->source = NULL;
         data->events = 0;
     }
@@ -276,7 +276,7 @@ virEventGLibHandleRemove(int watch)
 
     if (data->source != NULL) {
         g_source_destroy(data->source);
-        vir_g_source_unref(data->source, NULL);
+        g_source_unref(data->source);
         data->source = NULL;
         data->events = 0;
     }
@@ -409,7 +409,7 @@ virEventGLibTimeoutUpdate(int timer,
     if (interval >= 0) {
         if (data->source != NULL) {
             g_source_destroy(data->source);
-            vir_g_source_unref(data->source, NULL);
+            g_source_unref(data->source);
         }
 
         data->interval = interval;
@@ -419,7 +419,7 @@ virEventGLibTimeoutUpdate(int timer,
             goto cleanup;
 
         g_source_destroy(data->source);
-        vir_g_source_unref(data->source, NULL);
+        g_source_unref(data->source);
         data->source = NULL;
     }
 
@@ -468,7 +468,7 @@ virEventGLibTimeoutRemove(int timer)
 
     if (data->source != NULL) {
         g_source_destroy(data->source);
-        vir_g_source_unref(data->source, NULL);
+        g_source_unref(data->source);
         data->source = NULL;
     }