guix_mirror_bot pushed a commit to branch mesa-updates
in repository guix.

commit 63e393e4ac57177c786fdbad4493d8fc5584d8c5
Author: John Kehayias <j...@guixotic.coop>
AuthorDate: Mon Sep 22 00:46:58 2025 -0400

    gnu: libosinfo: Fix build with newer libxml2.
    
    * gnu/packages/virtualization.scm (libosinfo)[source]: Add patch.
    * gnu/packages/patches/libosinfo-libxml2-fix.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register it.
    
    Change-Id: I31377cf36b92562d9a87e6434cf30a01f5d3dcb2
---
 gnu/local.mk                                     |  1 +
 gnu/packages/patches/libosinfo-libxml2-fix.patch | 83 ++++++++++++++++++++++++
 gnu/packages/virtualization.scm                  |  3 +-
 3 files changed, 86 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 306c21e0ec..349843567b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1749,6 +1749,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/libofa-ftbfs-1.diff             \
   %D%/packages/patches/libofa-curl.diff                \
   %D%/packages/patches/libofa-ftbfs-2.diff             \
+  %D%/packages/patches/libosinfo-libxml2-fix.patch             \
   %D%/packages/patches/libotr-test-auth-fix.patch              \
   %D%/packages/patches/libksieve-Fix-missing-link-libraries.patch \
   %D%/packages/patches/libmad-armv7-thumb-pt1.patch            \
diff --git a/gnu/packages/patches/libosinfo-libxml2-fix.patch 
b/gnu/packages/patches/libosinfo-libxml2-fix.patch
new file mode 100644
index 0000000000..71d620532c
--- /dev/null
+++ b/gnu/packages/patches/libosinfo-libxml2-fix.patch
@@ -0,0 +1,83 @@
+From 0adf38535637ec668e658d43f04f60f11f51574f Mon Sep 17 00:00:00 2001
+From: Roman Bogorodskiy <bogorods...@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 <bogorods...@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
+
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 2f19b50d78..dc0a1bcc33 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -1516,7 +1516,8 @@ using simplestreams index files as the publishing 
mechanism
                            version ".tar.xz"))
        (sha256
         (base32
-         "1dn6pzv0gzkxrjvi60cdzdmyxqlcsvinbrbds91xm4v7wbn5g1dd"))))
+         "1dn6pzv0gzkxrjvi60cdzdmyxqlcsvinbrbds91xm4v7wbn5g1dd"))
+       (patches (search-patches "libosinfo-libxml2-fix.patch"))))
     (build-system meson-build-system)
     (arguments
      (list

Reply via email to