Merge branch 'master' into core-updates-frozen
[jackhill/guix/guix.git] / gnu / packages / xml.scm
index 8c87760..3b0ab90 100644 (file)
@@ -5,7 +5,7 @@
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2015, 2016, 2017, 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2015, 2016, 2017, 2018, 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2015, 2016, 2017, 2018, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2015 Raimon Grau <raimonster@gmail.com>
 ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
 ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
@@ -121,8 +121,7 @@ the entire document.")
 (define-public expat
   (package
     (name "expat")
-    (version "2.2.9")
-    (replacement expat-2.4.1)
+    (version "2.4.1")
     (source (let ((dot->underscore (lambda (c) (if (char=? #\. c) #\_ c))))
               (origin
                 (method url-fetch)
@@ -134,10 +133,22 @@ the entire document.")
                             "/expat-" version ".tar.xz")))
                 (sha256
                  (base32
-                  "1960mmgbb4cm64n1p0nz3hrs1pw03hkrfcw8prmnn4622mdrd9hy")))))
+                  "0spvyb9d3hijs4ys3x64cfmilsynl8kv6clfahv8d4lvp86js0yg")))))
     (build-system gnu-build-system)
     (arguments
-     '(#:configure-flags '("--disable-static")))
+     '(#:phases (modify-phases %standard-phases
+                  (add-after 'install 'move-static-library
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out    (assoc-ref outputs "out"))
+                            (static (assoc-ref outputs "static")))
+                        (mkdir-p (string-append static "/lib"))
+                        (link (string-append out "/lib/libexpat.a")
+                              (string-append static "/lib/libexpat.a"))
+                        (delete-file (string-append out "/lib/libexpat.a"))
+                        (substitute* (string-append out "/lib/libexpat.la")
+                          (("old_library=.*")
+                           "old_library=''"))))))))
+    (outputs '("out" "static"))
     (home-page "https://libexpat.github.io/")
     (synopsis "Stream-oriented XML parser library written in C")
     (description
@@ -146,24 +157,6 @@ stream-oriented parser in which an application registers handlers for
 things the parser might find in the XML document (like start tags).")
     (license license:expat)))
 
-;; Replacement package to fix CVE-2013-0340.
-(define expat-2.4.1
-  (package
-    (inherit expat)
-    (version "2.4.1")
-    (source (let ((dot->underscore (lambda (c) (if (char=? #\. c) #\_ c))))
-              (origin
-                (method url-fetch)
-                (uri (list (string-append "mirror://sourceforge/expat/expat/"
-                                          version "/expat-" version ".tar.xz")
-                           (string-append
-                            "https://github.com/libexpat/libexpat/releases/download/R_"
-                            (string-map dot->underscore version)
-                            "/expat-" version ".tar.xz")))
-                (sha256
-                 (base32
-                  "0spvyb9d3hijs4ys3x64cfmilsynl8kv6clfahv8d4lvp86js0yg")))))))
-
 (define-public libebml
   (package
     (name "libebml")
@@ -191,35 +184,43 @@ hierarchical form with variable field lengths.")
 (define-public libxml2
   (package
     (name "libxml2")
-    (version "2.9.10")
+    (version "2.9.12")
     (source (origin
              (method url-fetch)
              (uri (string-append "ftp://xmlsoft.org/libxml2/libxml2-"
                                  version ".tar.gz"))
              (sha256
               (base32
-               "07xynh8hcxb2yb1fs051xrgszjvj37wnxvxgsj10rzmqzy9y3zma"))))
+               "14hxwzmf5xqppx77z7i0ni9lpzg1a84dqpf8j8l1fvy570g6imn8"))
+             (patches (search-patches "libxml2-parent-pointers.patch"
+                                      "libxml2-terminating-newline.patch"
+                                      "libxml2-xpath-recursion-limit.patch"))))
     (build-system gnu-build-system)
-    (outputs '("out" "static"))
+    (outputs '("out" "static" "doc"))
     (arguments
      `(#:phases (modify-phases %standard-phases
-                  (add-after 'install 'move-static-libs
+                  (add-after 'install 'use-other-outputs
                     (lambda* (#:key outputs #:allow-other-keys)
-                      (let ((src (string-append (assoc-ref outputs "out") "/lib"))
+                      (let ((src (assoc-ref outputs "out"))
+                            (doc (string-append (assoc-ref outputs "doc") "/share"))
                             (dst (string-append (assoc-ref outputs "static")
                                                 "/lib")))
+                        (mkdir-p doc)
                         (mkdir-p dst)
+                        (for-each (lambda (dir)
+                                    (rename-file (string-append src "/share/" dir)
+                                                 (string-append doc "/" dir)))
+                                  '("doc" "gtk-doc"))
                         (for-each (lambda (ar)
                                     (rename-file ar (string-append dst "/"
                                                                    (basename ar))))
-                                  (find-files src "\\.a$"))
+                                  (find-files (string-append src "/lib") "\\.a$"))
 
                         ;; Remove reference to the static library from the .la
                         ;; file such that Libtool does the right thing when both
                         ;; the shared and static variants are available.
-                        (substitute* (string-append src "/libxml2.la")
-                          (("^old_library='libxml2.a'") "old_library=''"))
-                        #t))))))
+                        (substitute* (string-append src "/lib/libxml2.la")
+                          (("^old_library='libxml2.a'") "old_library=''"))))))))
     (home-page "http://www.xmlsoft.org/")
     (synopsis "C parser for XML")
     (inputs `(("xz" ,xz)))
@@ -299,8 +300,9 @@ formulas and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.")
     (name "python-libxml2")
     (source (origin
               (inherit (package-source libxml2))
-              (patches (cons (search-patch "python-libxml2-utf8.patch")
-                             (origin-patches (package-source libxml2))))))
+              (patches
+                (append (search-patches "python-libxml2-utf8.patch")
+                        (origin-patches (package-source libxml2))))))
     (build-system python-build-system)
     (outputs '("out"))
     (arguments
@@ -321,8 +323,7 @@ formulas and hyperlinks to multiple worksheets in an Excel 2007+ XLSX file.")
                  (format #f "ROOT = r'~a'" libxml2))
                 ;; For 'iconv.h'.
                 (("/opt/include")
-                 (string-append glibc "/include"))))
-            #t)))))
+                 (string-append glibc "/include")))))))))
     (inputs `(("libxml2" ,libxml2)))
     (synopsis "Python bindings for the libxml2 library")))
 
@@ -2495,15 +2496,18 @@ The central program included in this package is @code{onsgmls}, which replaces
 (define-public python-elementpath
   (package
     (name "python-elementpath")
-    (version "1.4.0")
+    (version "2.0.3")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "elementpath" version))
        (sha256
         (base32
-         "15h7d41v48q31hzjay7qzixdv531hnga3h35hksk7x52pgqcrkz7"))))
+         "1kxx573ywqfh6j6aih2i6hhsya6kz79qq4bgz6yskwk6b18jyr8z"))))
     (build-system python-build-system)
+    ;; The test suite is not run, to avoid a dependency cycle with
+    ;; python-xmlschema.
+    (arguments `(#:tests? #f))
     (home-page
      "https://github.com/sissaschool/elementpath")
     (synopsis
@@ -2520,13 +2524,20 @@ because lxml.etree already has its own implementation of XPath 1.0.")
 (define-public python-lxml
   (package
     (name "python-lxml")
-    (version "4.4.2")
+    (version "4.6.3")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "lxml" version))
        (sha256
-        (base32 "01nvb5j8vs9nk4z5s3250b1m22b4d08kffa36if3g1mdygdrvxpg"))))
+        (base32 "0s14r1w2x9sdlcsw8mxiqgw4rz5zs5lpqpxrfyn4a1mkndqqbdrr"))
+       ;; Adapt a test to libxml2 2.9.12, taken from this commit:
+       ;; https://github.com/lxml/lxml/commit/852ed1092bd80b6b9a51db24371047e
+       (modules '((guix build utils)))
+       (snippet
+        '(substitute* "src/lxml/tests/test_etree.py"
+             (("self\\.assertEqual\\(\\{'hha': None\\}, el\\.nsmap\\)")
+              "self.assertEqual({}, el.nsmap)")))))
     (build-system python-build-system)
     (arguments
      `(#:phases (modify-phases %standard-phases
@@ -2549,7 +2560,7 @@ libxml2 and libxslt.")
 (define-public python-xmlschema
   (package
     (name "python-xmlschema")
-    (version "1.1.2")
+    (version "1.2.5")
     (source (origin
               ;; Unit tests are not distributed with the PyPI archive.
               (method git-fetch)
@@ -2559,21 +2570,20 @@ libxml2 and libxslt.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "03bz5mp45y4shmlc1gxq1h69vjx60z1acg9cy4kq7fczgx8qg9jw"))))
+                "0rsa75x86gdjalvy4riq7613szb616hff80crx006chyppzdkxmq"))))
     (build-system python-build-system)
     (arguments
      '(#:phases
        (modify-phases %standard-phases
          (replace 'check
-           (lambda* (#:key (tests? #t) #:allow-other-keys)
+           (lambda* (#:key tests? #:allow-other-keys)
              (if tests?
-                 (begin
-                   (setenv "PYTHONPATH"
-                           (string-append "./build/lib:"
-                                          (getenv "PYTHONPATH")))
-                   (invoke "python" "-m" "unittest" "-v"))
-                 (format #t "test suite not run~%"))
-             #t)))))
+                 ;; Disable test_export_remote__issue_187, which is known to
+                 ;; fail (see:
+                 ;; https://github.com/sissaschool/xmlschema/issues/206).
+                 (invoke "python" "-m" "unittest" "-v"
+                         "-k" "not test_export_remote__issue_187")
+                 (format #t "test suite not run~%")))))))
     (native-inputs
      `(("python-lxml" ,python-lxml)))   ;for tests
     (propagated-inputs