From 5d08f10d184a661d0ee5ddf13cd894d9299a9e1b Mon Sep 17 00:00:00 2001 From: Kei Kebreau Date: Sun, 5 Nov 2017 15:20:50 -0500 Subject: [PATCH] gnu: itstool: Update to 2.0.4. * gnu/packages/glib.scm (itstool): Update to 2.0.4. [source]: Apply patch. [inputs]: Replace python and python-libxml2 with python-2 and python2-libxml2. * gnu/packages/patches/itstool-fix-segfault.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + gnu/packages/glib.scm | 10 +++-- gnu/packages/patches/itstool-fix-segfault.patch | 50 +++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 gnu/packages/patches/itstool-fix-segfault.patch diff --git a/gnu/local.mk b/gnu/local.mk index dbfe6829e..b45499153 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -744,6 +744,7 @@ dist_patch_DATA = \ %D%/packages/patches/ilmbase-fix-tests.patch \ %D%/packages/patches/intltool-perl-compatibility.patch \ %D%/packages/patches/isl-0.11.1-aarch64-support.patch \ + %D%/packages/patches/itstool-fix-segfault.patch \ %D%/packages/patches/jacal-fix-texinfo.patch \ %D%/packages/patches/java-powermock-fix-java-files.patch \ %D%/packages/patches/jbig2dec-ignore-testtest.patch \ diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm index bc8775004..71c21bd64 100644 --- a/gnu/packages/glib.scm +++ b/gnu/packages/glib.scm @@ -395,19 +395,21 @@ The intltool collection can be used to do these things: (define itstool (package (name "itstool") - (version "2.0.2") + (version "2.0.4") (source (origin (method url-fetch) (uri (string-append "http://files.itstool.org/itstool/itstool-" version ".tar.bz2")) (sha256 (base32 - "0fh34wi52i0qikgvlmrcpf1vx6gc1xqdad4539l4d9hikfsrz45z")))) + "0q7b4qrc758zfx3adsgvz0r93swdbxjr42w37rahngm33nshihlp")) + (patches + (search-patches "itstool-fix-segfault.patch")))) (build-system gnu-build-system) (inputs `(("libxml2" ,libxml2) - ("python2-libxml2" ,python2-libxml2) - ("python-2" ,python-2))) + ("python-libxml2" ,python-libxml2) + ("python" ,python))) (arguments '(#:phases (modify-phases %standard-phases diff --git a/gnu/packages/patches/itstool-fix-segfault.patch b/gnu/packages/patches/itstool-fix-segfault.patch new file mode 100644 index 000000000..ed34aa18b --- /dev/null +++ b/gnu/packages/patches/itstool-fix-segfault.patch @@ -0,0 +1,50 @@ +This patch comes from +https://github.com/itstool/itstool/commit/9b84c007a73e8275ca45762f1bfa3ab7c3a852e2#diff-d15c1935d231593da203d653eef729ff. + +diff -ur a/itstool.in b/itstool.in +--- a/itstool.in 2017-10-09 12:00:24.000000000 -0400 ++++ b/itstool.in 2017-11-05 15:10:45.057031963 -0500 +@@ -477,6 +477,7 @@ + if load_dtd: + ctxt.loadSubset(1) + if keep_entities: ++ ctxt.loadSubset(1) + ctxt.ctxtUseOptions(libxml2.XML_PARSE_DTDLOAD) + ctxt.replaceEntities(0) + else: +@@ -1043,6 +1044,7 @@ + if self._load_dtd: + ctxt.loadSubset(1) + if self._keep_entities: ++ ctxt.loadSubset(1) + ctxt.ctxtUseOptions(libxml2.XML_PARSE_DTDLOAD) + ctxt.replaceEntities(0) + else: +@@ -1069,7 +1071,9 @@ + ph_node = msg.get_placeholder(child.name).node + if self.has_child_elements(ph_node): + self.merge_translations(translations, None, ph_node, strict=strict) +- child.replaceNode(ph_node) ++ newnode = ph_node.copyNode(1) ++ newnode.setTreeDoc(self._doc) ++ child.replaceNode(newnode) + else: + repl = self.get_translated(ph_node, translations, strict=strict, lang=lang) + child.replaceNode(repl) +@@ -1084,10 +1088,15 @@ + (lang + ' ') if lang is not None else '', + msgstr.encode('utf-8'))) + self._xml_err = '' ++ ctxt.doc().freeDoc() + return node + retnode = node.copyNode(2) ++ retnode.setTreeDoc(self._doc) + for child in xml_child_iter(trnode): +- retnode.addChild(child.copyNode(1)) ++ newnode = child.copyNode(1) ++ newnode.setTreeDoc(self._doc) ++ retnode.addChild(newnode) ++ + ctxt.doc().freeDoc() + return retnode + -- 2.14.3