[gentoo-commits] repo/gentoo:master commit in: sys-libs/libosinfo/, sys-libs/libosinfo/files/

2025-05-21 Thread Sam James
commit: 5843588a1a5c149326efd0c60ba70d7b8900b5b9
Author: Alfred Wingate  protonmail  com>
AuthorDate: Mon May 19 05:29:57 2025 +
Commit: Sam James  gentoo  org>
CommitDate: Wed May 21 20:58:11 2025 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5843588a

sys-libs/libosinfo: handle libxml2-2.14 breakage

Bug: https://bugs.gentoo.org/955816
Signed-off-by: Alfred Wingate  protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/42150
Closes: https://github.com/gentoo/gentoo/pull/42150
Signed-off-by: Sam James  gentoo.org>

 .../files/libosinfo-1.12.0-libxml2-2.14.patch  | 81 ++
 sys-libs/libosinfo/libosinfo-1.12.0-r1.ebuild  |  4 ++
 2 files changed, 85 insertions(+)

diff --git a/sys-libs/libosinfo/files/libosinfo-1.12.0-libxml2-2.14.patch 
b/sys-libs/libosinfo/files/libosinfo-1.12.0-libxml2-2.14.patch
new file mode 100644
index ..6506a178643d
--- /dev/null
+++ b/sys-libs/libosinfo/files/libosinfo-1.12.0-libxml2-2.14.patch
@@ -0,0 +1,81 @@
+https://bugs.gentoo.org/955816
+https://gitlab.com/libosinfo/libosinfo/-/issues/58
+https://gitlab.com/libosinfo/libosinfo/-/merge_requests/162
+
+From 0adf38535637ec668e658d43f04f60f11f51574f Mon Sep 17 00:00:00 2001
+From: Roman Bogorodskiy 
+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 
+--- 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
+

diff --git a/sys-libs/libosinfo/libosinfo-1.12.0-r1.ebuild 
b/sys-libs/libosinfo/libosinfo-1.12.0-r1.ebuild
index 22371841e5a5..fe5507571c41 100644
--- a/sys-libs/libosinfo/libosinfo-1.12.0-r1.ebuild
+++ b/sys-libs/libosinfo/libosinfo-1.12.0-r1.ebuild
@@ -42,6 +42,10 @@ BDEPEND="
vala? ( $(vala_depend) )
 "
 
+PATCHES=(
+   "${FILESDIR}"/libosinfo-1.12.0-libxml2-2.14.patch
+)
+
 src_prepare() {
default
use vala && vala_setup



[gentoo-commits] repo/gentoo:master commit in: sys-libs/libosinfo/, sys-libs/libosinfo/files/

2023-12-02 Thread Sam James
commit: 14aefc3644d467b43a76bf4f5f9d3ea23f2ade45
Author: Michal Privoznik  gmail  com>
AuthorDate: Tue Nov 28 08:53:00 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sun Dec  3 06:22:13 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14aefc36

sys-libs/libosinfo: Fix build with >=dev-libs/libxml2-2.12.0

As of its 2.12.0 release, libxml2 cleaned up header files which
rendered libosinfo unable to compile. Backport the fix from
upstream repo.

Signed-off-by: Michal Privoznik  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 ...-xmlError-struct-constant-in-propagate_li.patch | 32 ++
 sys-libs/libosinfo/libosinfo-1.10.0-r1.ebuild  |  1 +
 2 files changed, 33 insertions(+)

diff --git 
a/sys-libs/libosinfo/files/1.11.0-osinfo-Make-xmlError-struct-constant-in-propagate_li.patch
 
b/sys-libs/libosinfo/files/1.11.0-osinfo-Make-xmlError-struct-constant-in-propagate_li.patch
new file mode 100644
index ..ea05c46a03b0
--- /dev/null
+++ 
b/sys-libs/libosinfo/files/1.11.0-osinfo-Make-xmlError-struct-constant-in-propagate_li.patch
@@ -0,0 +1,32 @@
+From 5bbdd06503456784c5ffa22409e8bab50470d673 Mon Sep 17 00:00:00 2001
+Message-ID: 
<5bbdd06503456784c5ffa22409e8bab50470d673.1701161424.git.mpriv...@redhat.com>
+From: Michal Privoznik 
+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.
+
+Signed-off-by: Michal Privoznik 
+---
+ 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.41.0
+

diff --git a/sys-libs/libosinfo/libosinfo-1.10.0-r1.ebuild 
b/sys-libs/libosinfo/libosinfo-1.10.0-r1.ebuild
index 4fa2dfb2d4b2..cd1d05bea494 100644
--- a/sys-libs/libosinfo/libosinfo-1.10.0-r1.ebuild
+++ b/sys-libs/libosinfo/libosinfo-1.10.0-r1.ebuild
@@ -45,6 +45,7 @@ BDEPEND="
 
 PATCHES=(
"${FILESDIR}"/${PV}-build-Add-option-to-disable-libsoup3.patch
+   
"${FILESDIR}"/1.11.0-osinfo-Make-xmlError-struct-constant-in-propagate_li.patch
 )
 
 src_prepare() {