libosinfo: update 1.11.0 -> 1.12.0

- remove backported patch
- add a patch to fix:
| ../git/osinfo/osinfo_loader.c:357:5: error: 'content' is deprecated [-Werror=deprecated-declarations]
|   357 |     ret = g_strdup((char *)buf->content);
|       |     ^~~
| In file included from /home/flk/poky/build/tmp/work/corei7-64-poky-linux/libosinfo/1.12.0/recipe-sysroot/usr/include/libxml2/libxml/parser.h:16,
|                  from ../git/osinfo/osinfo_loader.c:29:
| /home/flk/poky/build/tmp/work/corei7-64-poky-linux/libosinfo/1.12.0/recipe-sysroot/usr/include/libxml2/libxml/tree.h:103:14: note: declared here
|   103 |     xmlChar *content XML_DEPRECATED_MEMBER;
|       |              ^~~~~~~
| ../git/osinfo/osinfo_loader.c: At top level:
| ../git/osinfo/osinfo_loader.c:1905:42: error: expected ';', ',' or ')' before 'ATTRIBUTE_UNUSED'
|  1905 | catchXMLError(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...)
|       |                                          ^~~~~~~~~~~~~~~~
| ../git/osinfo/osinfo_loader.c: In function 'osinfo_loader_process_xml':
| ../git/osinfo/osinfo_loader.c:1948:25: error: 'catchXMLError' undeclared (first use in this function)
|  1948 |     pctxt->sax->error = catchXMLError;
|       |                         ^~~~~~~~~~~~~
| ../git/osinfo/osinfo_loader.c:1948:25: note: each undeclared identifier is reported only once for each function it appears in
| cc1: all warnings being treated as errors

1.12.0 - Oct 23, 2023
=====================

- Some memory leak fixes #156
- Adapt to change in libxml2 #155
- Several CI improvements
- Several translations improvements

Signed-off-by: Markus Volk <f_l_k@t-online.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Markus Volk 2025-04-27 22:51:23 +02:00 committed by Khem Raj
parent fe472f5a83
commit 87779ef306
No known key found for this signature in database
GPG Key ID: BB053355919D3314
3 changed files with 88 additions and 34 deletions

View File

@ -1,32 +0,0 @@
From 5bbdd06503456784c5ffa22409e8bab50470d673 Mon Sep 17 00:00:00 2001
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 27 Nov 2023 15:11:45 +0100
Subject: [PATCH] osinfo: Make xmlError struct constant in
propagate_libxml_error()
In libxml2 commit v2.12.0~14 the API changed so that
xmlGetLastError() returns pointer to a constant xmlError struct.
Reflect this change in our code.
Upstream-Status: Backport [https://gitlab.com/libosinfo/libosinfo/-/merge_requests/155]
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
osinfo/osinfo_install_script.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index 5800f37..303245a 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -769,7 +769,7 @@ static void propagate_libxml_error(GError **error, const char *format, ...) G_GN
static void propagate_libxml_error(GError **error, const char *format, ...)
{
- xmlErrorPtr err = xmlGetLastError();
+ const xmlError *err = xmlGetLastError();
char *prefix;
va_list ap;
--
2.44.0

View File

@ -0,0 +1,86 @@
From 0adf38535637ec668e658d43f04f60f11f51574f Mon Sep 17 00:00:00 2001
From: Roman Bogorodskiy <bogorodskiy@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@gmail.com>
Signed-off-by: Markus Volk <f_l_k@t-online.de>
Upstream-Status: Backport [https://gitlab.com/libosinfo/libosinfo/-/commit/0adf38535637ec668e658d43f04f60f11f51574f.patch]
---
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

View File

@ -8,10 +8,10 @@ LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
SRC_URI = " \
git://gitlab.com/libosinfo/libosinfo.git;branch=main;protocol=https \
file://0001-meson.build-allow-crosscompiling-gir.patch \
file://0001-osinfo-Make-xmlError-struct-constant-in-propagate_li.patch \
file://0adf38535637ec668e658d43f04f60f11f51574f.patch \
"
SRCREV = "ca9dd5b810dc04ea38048ae9be491654c8596ef9"
SRCREV = "b505ef5161d2552102a743acd4ad83298d3d8f99"
S = "${WORKDIR}/git"