commit:     249f43326f022ee32c7f1eaa2508e9ea43cdb465
Author:     Michal Privoznik <michal.privoznik <AT> gmail <DOT> com>
AuthorDate: Tue Nov 28 08:28:03 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec  3 06:22:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=249f4332

sys-apps/osinfo-db-tools: Fix build with >=dev-libs/libxml2-2.12.0

As of its 2.12.0 release, libxml2 cleaned up header files which
rendered osinfo-db-tools unable to compile. Backport fixes from
upstream repo.

Bug: https://bugs.gentoo.org/917513
Signed-off-by: Michal Privoznik <michal.privoznik <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...ols-1.11.0-Make-xmlError-structs-constant.patch | 53 ++++++++++++++++++++++
 ...info-db-validate-Add-more-libxml-includes.patch | 35 ++++++++++++++
 .../osinfo-db-tools-1.10.0-r2.ebuild               |  2 +
 3 files changed, 90 insertions(+)

diff --git 
a/sys-apps/osinfo-db-tools/files/osinfo-db-tools-1.11.0-Make-xmlError-structs-constant.patch
 
b/sys-apps/osinfo-db-tools/files/osinfo-db-tools-1.11.0-Make-xmlError-structs-constant.patch
new file mode 100644
index 000000000000..964b2c10b6ec
--- /dev/null
+++ 
b/sys-apps/osinfo-db-tools/files/osinfo-db-tools-1.11.0-Make-xmlError-structs-constant.patch
@@ -0,0 +1,53 @@
+From 34378a4ac257f2f5fcf364786d1634a8c36b304f Mon Sep 17 00:00:00 2001
+Message-ID: 
<34378a4ac257f2f5fcf364786d1634a8c36b304f.1701158114.git.mpriv...@redhat.com>
+From: Michal Privoznik <mpriv...@redhat.com>
+Date: Mon, 27 Nov 2023 15:04:43 +0100
+Subject: [PATCH 1/2] 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
+   (validate_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.
+
+Also, drop obviously incorrect @error annotation in
+validate_structured_error_nop; the variable is used.
+
+Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
+---
+ tools/osinfo-db-validate.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c
+index a721b4d..b1434a6 100644
+--- a/tools/osinfo-db-validate.c
++++ b/tools/osinfo-db-validate.c
+@@ -35,7 +35,7 @@ static void validate_generic_error_nop(void *userData 
G_GNUC_UNUSED,
+ }
+ 
+ static void validate_structured_error_nop(void *userData G_GNUC_UNUSED,
+-                                          xmlErrorPtr error G_GNUC_UNUSED)
++                                          const xmlError *error)
+ {
+     if (error->file)
+         g_printerr("%s:%d %s", error->file, error->line, error->message);
+@@ -173,7 +173,8 @@ static gboolean validate_files(GFile *schema, gsize 
nfiles, GFile **files, GErro
+     g_autofree gchar *schemapath = NULL;
+ 
+     xmlSetGenericErrorFunc(NULL, validate_generic_error_nop);
+-    xmlSetStructuredErrorFunc(NULL, validate_structured_error_nop);
++    /* Drop this typecast when >=libxml2-2.12.0 is required */
++    xmlSetStructuredErrorFunc(NULL, (xmlStructuredErrorFunc) 
validate_structured_error_nop);
+ 
+     schemapath = g_file_get_path(schema);
+     rngParser = xmlRelaxNGNewParserCtxt(schemapath);
+-- 
+2.41.0
+

diff --git 
a/sys-apps/osinfo-db-tools/files/osinfo-db-tools-1.11.0-osinfo-db-validate-Add-more-libxml-includes.patch
 
b/sys-apps/osinfo-db-tools/files/osinfo-db-tools-1.11.0-osinfo-db-validate-Add-more-libxml-includes.patch
new file mode 100644
index 000000000000..c823465fe227
--- /dev/null
+++ 
b/sys-apps/osinfo-db-tools/files/osinfo-db-tools-1.11.0-osinfo-db-validate-Add-more-libxml-includes.patch
@@ -0,0 +1,35 @@
+From 019487cbc79925e49988789bf533c78dab7e1842 Mon Sep 17 00:00:00 2001
+Message-ID: 
<019487cbc79925e49988789bf533c78dab7e1842.1701158114.git.mpriv...@redhat.com>
+In-Reply-To: 
<34378a4ac257f2f5fcf364786d1634a8c36b304f.1701158114.git.mpriv...@redhat.com>
+References: 
<34378a4ac257f2f5fcf364786d1634a8c36b304f.1701158114.git.mpriv...@redhat.com>
+From: Michal Privoznik <mpriv...@redhat.com>
+Date: Mon, 27 Nov 2023 15:06:04 +0100
+Subject: [PATCH 2/2] osinfo-db-validate: Add more libxml/ includes
+
+In its 2.12.0 release, libxml reworked their header files (some
+might even call it cleaning up, I call it API incompatible
+change) and now  we don't get all declarations we need by just
+including one file. Add missing includes.
+
+Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
+---
+ tools/osinfo-db-validate.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c
+index b1434a6..f3275db 100644
+--- a/tools/osinfo-db-validate.c
++++ b/tools/osinfo-db-validate.c
+@@ -20,7 +20,9 @@
+  *   Daniel P. Berrange <berra...@redhat.com>
+  */
+ 
++#include <libxml/parser.h>
+ #include <libxml/relaxng.h>
++#include <libxml/tree.h>
+ #include <locale.h>
+ #include <glib/gi18n.h>
+ 
+-- 
+2.41.0
+

diff --git a/sys-apps/osinfo-db-tools/osinfo-db-tools-1.10.0-r2.ebuild 
b/sys-apps/osinfo-db-tools/osinfo-db-tools-1.10.0-r2.ebuild
index 220ff049a956..49f4ca477a35 100644
--- a/sys-apps/osinfo-db-tools/osinfo-db-tools-1.10.0-r2.ebuild
+++ b/sys-apps/osinfo-db-tools/osinfo-db-tools-1.10.0-r2.ebuild
@@ -40,6 +40,8 @@ BDEPEND="
 
 PATCHES=(
        "${FILESDIR}"/${PN}-1.10.0-no-clobber-fortify-source.patch
+       "${FILESDIR}"/${PN}-1.11.0-Make-xmlError-structs-constant.patch
+       
"${FILESDIR}"/${PN}-1.11.0-osinfo-db-validate-Add-more-libxml-includes.patch
 )
 
 python_check_deps() {

Reply via email to