[packages/libosinfo] add upstream patch to fix build with libxml2 >= 2.14
atler
atler at pld-linux.org
Wed Aug 6 12:05:13 CEST 2025
commit 625b0e6567f26aa8476d1954d7d739b95bb85122
Author: Jan Palus <atler at pld-linux.org>
Date: Wed Aug 6 12:02:43 2025 +0200
add upstream patch to fix build with libxml2 >= 2.14
libosinfo.spec | 2 ++
libxml2.14.patch | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+)
---
diff --git a/libosinfo.spec b/libosinfo.spec
index 623aa85..0f9ec72 100644
--- a/libosinfo.spec
+++ b/libosinfo.spec
@@ -14,6 +14,7 @@ License: LGPL v2+
Group: Libraries
Source0: https://releases.pagure.org/libosinfo/%{name}-%{version}.tar.xz
# Source0-md5: b074a8ccac5c8aa2fa30489acaca7cc5
+Patch0: libxml2.14.patch
URL: https://libosinfo.org/
BuildRequires: gettext-tools >= 0.19.8
BuildRequires: glib2-devel >= 1:2.44
@@ -101,6 +102,7 @@ API libosinfo dla języka Vala.
%prep
%setup -q
+%patch -P0 -p1
%build
%meson \
diff --git a/libxml2.14.patch b/libxml2.14.patch
new file mode 100644
index 0000000..71d6205
--- /dev/null
+++ b/libxml2.14.patch
@@ -0,0 +1,83 @@
+From 0adf38535637ec668e658d43f04f60f11f51574f Mon Sep 17 00:00:00 2001
+From: Roman Bogorodskiy <bogorodskiy at gmail.com>
+Date: Thu, 10 Apr 2025 13:54:02 +0200
+Subject: [PATCH] loader: don't use libxml2 deprecated APIs
+
+Address the following items:
+
+ - Deprecated direct access to buf's content
+ - Mismatching error function signature
+ - Deprecated direct access to ctxt's lastError
+
+Signed-off-by: Roman Bogorodskiy <bogorodskiy at gmail.com>
+---
+ osinfo/osinfo_loader.c | 42 +++++++++++++++++++++++-------------------
+ 1 file changed, 23 insertions(+), 19 deletions(-)
+
+diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
+index 0a9004af..b3fd4535 100644
+--- a/osinfo/osinfo_loader.c
++++ b/osinfo/osinfo_loader.c
+@@ -354,7 +354,7 @@ osinfo_loader_doc(const char *xpath,
+ xmlXPathFreeObject(obj);
+ OSINFO_LOADER_SET_ERROR(err, "Cannot format stylesheet");
+ }
+- ret = g_strdup((char *)buf->content);
++ ret = g_strdup((char *)xmlBufferContent(buf));
+
+ xmlBufferFree(buf);
+ xmlXPathFreeObject(obj);
+@@ -1902,28 +1902,32 @@ static void osinfo_loader_root(OsinfoLoader *loader,
+ }
+
+ static void
+-catchXMLError(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...)
++catchXMLError(void *ctx, const char *msg, ...)
+ {
+ xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
++ const xmlError *xmlErr = NULL;
++ g_autofree gchar *xmlmsg = NULL;
+
+- if (ctxt && ctxt->_private) {
+- GError **err = ctxt->_private;
+- if (!error_is_set(err)) {
+- gchar *xmlmsg;
+- if (ctxt->lastError.file) {
+- xmlmsg = g_strdup_printf("%s:%d: %s",
+- ctxt->lastError.file,
+- ctxt->lastError.line,
+- ctxt->lastError.message);
+- } else {
+- xmlmsg = g_strdup_printf("at line %d: %s",
+- ctxt->lastError.line,
+- ctxt->lastError.message);
+- }
+- OSINFO_LOADER_SET_ERROR(ctxt->_private, xmlmsg);
+- g_free(xmlmsg);
+- }
++ if (!ctxt || !ctxt->_private)
++ return;
++
++ if (error_is_set(ctxt->_private))
++ return;
++
++ if (!(xmlErr = xmlCtxtGetLastError(ctx)))
++ return;
++
++ if (xmlErr->file) {
++ xmlmsg = g_strdup_printf("%s:%d: %s",
++ xmlErr->file,
++ xmlErr->line,
++ xmlErr->message);
++ } else {
++ xmlmsg = g_strdup_printf("at line %d: %s",
++ xmlErr->line,
++ xmlErr->message);
+ }
++ OSINFO_LOADER_SET_ERROR(ctxt->_private, xmlmsg);
+ }
+
+ static void osinfo_loader_process_xml(OsinfoLoader *loader,
+--
+GitLab
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/libosinfo.git/commitdiff/41dbda4aba263f058b01d75f38fc8b1fa91cda59
More information about the pld-cvs-commit
mailing list