Skip to content

Commit

Permalink
textproc/itstool: Update to 2.0.6, Add patch to fix some libxml issue…
Browse files Browse the repository at this point in the history
…s [1]

FreeBSD Doc translations are working fine with this patch.
More details on itstool/itstool#38

PR:		244325
Approved by:	maintainer timeout (kwm, > 3 weeks)
Obtained from:	itstool/itstool#18 [1]


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@528414 35697150-7ecd-e111-bb59-0022644237b5
  • Loading branch information
dbaio committed Mar 14, 2020
1 parent c27bb64 commit ebf1e63
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 5 deletions.
5 changes: 3 additions & 2 deletions textproc/itstool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# $MCom: ports/trunk/textproc/itstool/Makefile 19804 2014-08-13 14:55:11Z kwm $

PORTNAME= itstool
PORTVERSION= 2.0.5
PORTREVISION= 2
PORTVERSION= 2.0.6
CATEGORIES= textproc
MASTER_SITES= http://files.itstool.org/itstool/

Expand All @@ -21,6 +20,8 @@ GNU_CONFIGURE= yes

CONFLICTS_INSTALL= itstool22

NO_ARCH= yes

post-patch:
@${REINPLACE_CMD} -e 's|@PYTHON@|${PYTHON_CMD}|g' \
${WRKSRC}/itstool.in
Expand Down
6 changes: 3 additions & 3 deletions textproc/itstool/distinfo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
TIMESTAMP = 1547069695
SHA256 (itstool-2.0.5.tar.bz2) = 100506f8df62cca6225ec3e631a8237e9c04650c77495af4919ac6a100d4b308
SIZE (itstool-2.0.5.tar.bz2) = 102751
TIMESTAMP = 1582405002
SHA256 (itstool-2.0.6.tar.bz2) = 6233cc22726a9a5a83664bf67d1af79549a298c23185d926c3677afa917b92a9
SIZE (itstool-2.0.6.tar.bz2) = 103067
88 changes: 88 additions & 0 deletions textproc/itstool/files/patch-PR18
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# https://github.com/itstool/itstool/pull/18
# https://github.com/itstool/itstool/issues/17

From 98d04cdabf1721cb541ecd234c975f13fde4fa41 Mon Sep 17 00:00:00 2001
From: Guido Trentalancia <guido@trentalancia.com>
Date: Wed, 1 Nov 2017 18:20:36 +0100
Subject: [PATCH 1/2] Revert "Be more careful about libxml2 memory management"

This reverts commit 9b84c007a73e8275ca45762f1bfa3ab7c3a852e2.
---
itstool.in | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)

diff --git itstool.in itstool.in
index a16eba9..c1d0585 100755
--- itstool.in
+++ itstool.in
@@ -477,7 +477,6 @@ class Document (object):
if load_dtd:
ctxt.loadSubset(1)
if keep_entities:
- ctxt.loadSubset(1)
ctxt.ctxtUseOptions(libxml2.XML_PARSE_DTDLOAD)
ctxt.replaceEntities(0)
else:
@@ -1044,7 +1043,6 @@ class Document (object):
if self._load_dtd:
ctxt.loadSubset(1)
if self._keep_entities:
- ctxt.loadSubset(1)
ctxt.ctxtUseOptions(libxml2.XML_PARSE_DTDLOAD)
ctxt.replaceEntities(0)
else:
@@ -1071,9 +1069,7 @@ class Document (object):
ph_node = msg.get_placeholder(child.name).node
if self.has_child_elements(ph_node):
self.merge_translations(translations, None, ph_node, strict=strict)
- newnode = ph_node.copyNode(1)
- newnode.setTreeDoc(self._doc)
- child.replaceNode(newnode)
+ child.replaceNode(ph_node)
else:
repl = self.get_translated(ph_node, translations, strict=strict, lang=lang)
child.replaceNode(repl)
@@ -1088,15 +1084,10 @@ class Document (object):
(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):
- newnode = child.copyNode(1)
- newnode.setTreeDoc(self._doc)
- retnode.addChild(newnode)
-
+ retnode.addChild(child.copyNode(1))
ctxt.doc().freeDoc()
return retnode


From 1549b6d12eb2f35e5c7f1b1856c21768e92ba794 Mon Sep 17 00:00:00 2001
From: Guido Trentalancia <guido@trentalancia.com>
Date: Wed, 1 Nov 2017 18:23:44 +0100
Subject: [PATCH 2/2] Fix a segmentation fault bug introduced with version
2.0.4.

https://github.com/itstool/itstool/issues/17

This fix seems a lot easier than the previous reverted commit.
---
itstool.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git itstool.in itstool.in
index c1d0585..e492e95 100755
--- itstool.in
+++ itstool.in
@@ -1048,7 +1048,7 @@ class Document (object):
else:
ctxt.replaceEntities(1)
ctxt.parseDocument()
- trnode = ctxt.doc().getRootElement()
+ trnode = ctxt.doc().getRootElement().copyNode(1)
try:
self._check_errors()
except libxml2.parserError:

0 comments on commit ebf1e63

Please sign in to comment.