Subject: [bug#64012] [PATCH] gnu: libxml2: Update to 2.11.4

From: Andy Tai <[email-masked]>
Date: Mon, 12 Jun 2023 01:03:47 -0700

* gnu/packages/xml.scm (libxml2): Update to 2.11.4
* gnu/packages/patches/python-libxml2-utf8.patch: Remove as
  patch no longer necessary; original issue fixed upstream
  (see https://gitlab.gnome.org/GNOME/libxml2/-/commit/76c6da420923f2721a2e16adfcef8707a2454a1b)
* gnu/local.mk: Remove reference to deleted patch
---
 gnu/local.mk                                  |  1 -
 .../patches/python-libxml2-utf8.patch         | 40 -------------------
 gnu/packages/xml.scm                          | 11 ++---
 3 files changed, 4 insertions(+), 48 deletions(-)
 delete mode 100644 gnu/packages/patches/python-libxml2-utf8.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ce16d37e2b..6f0fee2d34 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1803,7 +1803,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-pyfakefs-remove-bad-test.patch	\
   %D%/packages/patches/python-pyflakes-test-location.patch	\
   %D%/packages/patches/python-flint-includes.patch		\
-  %D%/packages/patches/python-libxml2-utf8.patch		\
   %D%/packages/patches/python-memcached-syntax-warnings.patch	\
   %D%/packages/patches/python-mox3-python3.6-compat.patch	\
   %D%/packages/patches/python-parso-unit-tests-in-3.10.patch    \
diff --git a/gnu/packages/patches/python-libxml2-utf8.patch b/gnu/packages/patches/python-libxml2-utf8.patch
deleted file mode 100644
index e39672faa1..0000000000
--- a/gnu/packages/patches/python-libxml2-utf8.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-This patch fixes a crash in the libxml2 bindings for Python 3.x
-that 'itstool' stumbles upon when processing UTF-8 data:
-
-  https://issues.guix.gnu.org/issue/37468
-
-Patch by Jan Matejek
-from <https://bugzilla.opensuse.org/show_bug.cgi?id=1065270>.
-
---- libxml2-2.9.5.orig/python/libxml.c
-+++ libxml2-2.9.5/python/libxml.c
-@@ -1620,6 +1620,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
-     PyObject *message;
-     PyObject *result;
-     char str[1000];
-+    unsigned char *ptr = (unsigned char *)str;
- 
- #ifdef DEBUG_ERROR
-     printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
-@@ -1636,12 +1637,20 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
- 	    str[999] = 0;
-         va_end(ap);
- 
-+#if PY_MAJOR_VERSION >= 3
-+        /* Ensure the error string doesn't start at UTF8 continuation. */
-+        while (*ptr && (*ptr & 0xc0) == 0x80)
-+            ptr++;
-+#endif
-+
-         list = PyTuple_New(2);
-         PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
-         Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
--        message = libxml_charPtrConstWrap(str);
-+        message = libxml_charPtrConstWrap(ptr);
-         PyTuple_SetItem(list, 1, message);
-         result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
-+        /* Forget any errors caused in the error handler. */
-+        PyErr_Clear();
-         Py_XDECREF(list);
-         Py_XDECREF(result);
-     }
diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index 8d9974b825..bbb91fbe6b 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -182,7 +182,7 @@ (define-public libebml
 (define-public libxml2
   (package
     (name "libxml2")
-    (version "2.9.14")
+    (version "2.11.4")
     (source (origin
              (method url-fetch)
              (uri (string-append "https://download.gnome.org/sources/libxml2/"
@@ -190,7 +190,7 @@ (define-public libxml2
                                  version ".tar.xz"))
              (sha256
               (base32
-               "1vnzk33wfms348lgz9pvkq9li7jm44pvm73lbr3w1khwgljlmmv0"))))
+               "1xspgyswllk26g7jg95pnkfk1gqpzna28fm1kir3kwdki9ziszkk"))))
     (build-system gnu-build-system)
     (outputs '("out" "static" "doc"))
     (arguments
@@ -221,7 +221,7 @@ (define-public libxml2
     (synopsis "C parser for XML")
     (inputs (list xz))
     (propagated-inputs (list zlib)) ; libxml2.la says '-lz'.
-    (native-inputs (list perl))
+    (native-inputs (list perl python-minimal-wrapper  pkg-config))
     ;; $XML_CATALOG_FILES lists 'catalog.xml' files found in under the 'xml'
     ;; sub-directory of any given package.
     (native-search-paths (list (search-path-specification
@@ -253,10 +253,7 @@ (define-public python-libxml2
   (package/inherit libxml2
     (name "python-libxml2")
     (source (origin
-              (inherit (package-source libxml2))
-              (patches
-                (append (search-patches "python-libxml2-utf8.patch")
-                        (origin-patches (package-source libxml2))))))
+              (inherit (package-source libxml2))))
     (build-system python-build-system)
     (outputs '("out"))
     (arguments

base-commit: 6fe9a004dba2d4ddf69ff6f1714af15ffaa7e62a
-- 
2.40.1