From eae3149d16f22e6f530e797ea00b9fe61fc4c09e Mon Sep 17 00:00:00 2001 From: zhangxianting Date: Thu, 11 Apr 2024 00:11:20 +0800 Subject: [PATCH] sync submissions, make xmlError structs constant, to resolve compilation error --- Make-xmlError-structs-constant.patch | 61 ++++++++++++++++++++++++++++ libvirt-glib.spec | 6 ++- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 Make-xmlError-structs-constant.patch diff --git a/Make-xmlError-structs-constant.patch b/Make-xmlError-structs-constant.patch new file mode 100644 index 0000000..eb83c54 --- /dev/null +++ b/Make-xmlError-structs-constant.patch @@ -0,0 +1,61 @@ +From 56acbe8a0765a02418f80fb3599b3cf7160ef446 Sat Nov 25 00:00:00 2001 +From: Michal Privoznik +Date: Sat, 25 Nov 2023 +Subject: [PATCH] Make xmlError structs constant +In libxml2 commits v2.12.0~14 and v2.12.0~77 the API changed so +that: + +1) xmlGetLastError() returns pointer to a constant xmlError + struct, and + +2) xmlSetStructuredErrorFunc() changed the signature of callback + (gvir_xml_structured_error_nop()), it too is passed pointer to + a constant xmlError struct. + +But of course, older libxml2 expects different callback +signature. Therefore, we need to typecast it anyway. + +--- + libvirt-gconfig/libvirt-gconfig-helpers.c | 2 +- + libvirt-gconfig/libvirt-gconfig-object.c | 5 +++-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c b/libvirt-gconfig/libvirt-gconfig-helpers.c +index e8f9664..37075e3 100644 +--- a/libvirt-gconfig/libvirt-gconfig-helpers.c ++++ b/libvirt-gconfig/libvirt-gconfig-helpers.c +@@ -41,7 +41,7 @@ static GError *gvir_config_error_new_literal(GQuark domain, + gint code, + const gchar *message) + { +- xmlErrorPtr xerr = xmlGetLastError(); ++ const xmlError *xerr = xmlGetLastError(); + + if (!xerr) + return NULL; +diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c +index eb8763e..1fcc667 100644 +--- a/libvirt-gconfig/libvirt-gconfig-object.c ++++ b/libvirt-gconfig/libvirt-gconfig-object.c +@@ -59,7 +59,7 @@ static void gvir_xml_generic_error_nop(void *userData G_GNUC_UNUSED, + } + + static void gvir_xml_structured_error_nop(void *userData G_GNUC_UNUSED, +- xmlErrorPtr error G_GNUC_UNUSED) ++ const xmlError *error G_GNUC_UNUSED) + { + } + +@@ -197,7 +197,8 @@ void gvir_config_object_validate(GVirConfigObject *config, + priv = config->priv; + + xmlSetGenericErrorFunc(NULL, gvir_xml_generic_error_nop); +- xmlSetStructuredErrorFunc(NULL, gvir_xml_structured_error_nop); ++ /* Drop this typecast when >=libxml2-2.12.0 is required */ ++ xmlSetStructuredErrorFunc(NULL, (xmlStructuredErrorFunc) gvir_xml_structured_error_nop); + + if (!priv->node) { + gvir_config_set_error_literal(err, +-- +2.43.0 + diff --git a/libvirt-glib.spec b/libvirt-glib.spec index 9e158b2..89fbf94 100644 --- a/libvirt-glib.spec +++ b/libvirt-glib.spec @@ -1,6 +1,6 @@ Name: libvirt-glib Version: 4.0.0 -Release: 2 +Release: 3 Summary: libvirt glib integration for events License: LGPLv2+ URL: http://libvirt.org/ @@ -9,6 +9,7 @@ BuildRequires: glib2-devel >= 2.48.0 libvirt-devel >= 1.2.8 gobject-introspectio BuildRequires: libxml2-devel >= 2.9.1 vala gettext gtk-doc meson Patch00: libvirt-glib-4.0.0-cast-align.patch Patch01: build-don-t-set-glib-version-constraints-for-g-ir-sc.patch +Patch02: Make-xmlError-structs-constant.patch Provides: libvirt-gconfig libvirt-gobject Obsoletes: libvirt-gconfig libvirt-gobject @@ -64,6 +65,9 @@ This package provides development header files and libraries for integration bet %{_datadir}/vala/vapi/libvirt-g* %changelog +* Wed May 29 2024 zhangxianting - 4.0.0-3 +- sync submissions, make xmlError structs constant, to resolve compilation error + * Mon Jun 13 2022 yezengruan - 4.0.0-2 - build: don't set glib version constraints for g-ir-scanner -- Gitee