itstool: use proposed patch to port to python-lxml (#5681)
So we can get rid of libxml2-python, which is deprecated upstream. It's not clear when upstream will integrate it so use the porposed patch for now. Remove patches which conflict with the above, with the hope that moving to lxml might have made the obsolete, or the issues are no longer there. If there are any regressions, please speak up and we'll have a look.
This commit is contained in:
parent
1e0954a432
commit
bf0cde41de
1493
itstool/57.patch
Normal file
1493
itstool/57.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,24 +2,27 @@
|
||||
|
||||
pkgname=itstool
|
||||
pkgver=2.0.7
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="XML to PO and back again"
|
||||
arch=('i686' 'x86_64')
|
||||
url="https://itstool.org/"
|
||||
license=("GPL3")
|
||||
depends=("python" "libxml2" "libxml2-python")
|
||||
msys2_repository_url="https://github.com/itstool/itstool"
|
||||
license=("spdx:GPL-3.0-or-later")
|
||||
depends=("python" "python-lxml")
|
||||
makedepends=('autotools' 'gcc')
|
||||
source=(https://files.itstool.org/itstool/${pkgname}-${pkgver}.tar.bz2
|
||||
fix-segfault.patch
|
||||
itstool-2.0.5-fix-crash-wrong-encoding.patch)
|
||||
https://github.com/itstool/itstool/commit/32c7d07664dc37765100285d1202d488cd6a27e8.patch
|
||||
57.patch)
|
||||
sha256sums=('6b9a7cd29a12bb95598f5750e8763cee78836a1a207f85b74d8b3275b27e87ca'
|
||||
'ccdf85ae9bdfd0259728a79b6b9806d8b9bcb27ed1f974ac49c551587cb4e6c6'
|
||||
'cb57e3694ab3d7c62b063629b2e9edc6327260c0797d0f33c8dc97fe37c40ebb')
|
||||
'4e64a2e884f9d4cbc493732fcbde9f1d5bed534f9a66330bbcc1cbeb54808c1e'
|
||||
'ad89a36fd36b985daeec87003c9cc8c98abee3f2de84644aa10241b2d22098cf')
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
patch -p1 -i ${srcdir}/itstool-2.0.5-fix-crash-wrong-encoding.patch
|
||||
patch -p1 -i ${srcdir}/fix-segfault.patch
|
||||
patch -p1 -i ${srcdir}/32c7d07664dc37765100285d1202d488cd6a27e8.patch
|
||||
|
||||
# https://github.com/itstool/itstool/pull/57 - squashed without tests
|
||||
patch -p1 -i ${srcdir}/57.patch
|
||||
|
||||
autoreconf -fi
|
||||
}
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
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] 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 a/itstool.in b/itstool.in
|
||||
index c1d0585..e492e95 100755
|
||||
--- a/itstool.in
|
||||
+++ b/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:
|
||||
@ -1,68 +0,0 @@
|
||||
Description: Fix the crash from #912099
|
||||
ITS Tool 2.0.4 crashes when building some documentation, as reported in
|
||||
#912099. This comes from translations with invalid XML markup, which ITS Tool
|
||||
fails to merge (which is not abnormal), and to report these issues, needlessly
|
||||
encodes the original msgstr from unicode to bytes, causing it to be recoded
|
||||
using the default ascii codec, which fails when the msgstr contains anything
|
||||
out of ascii.
|
||||
.
|
||||
This patch removes the useless decoding, avoiding the failing subsequent
|
||||
recoding. It also explicitly encodes the output strings to be able to print
|
||||
them in all cases, even when the output encoding cannot be detected.
|
||||
Bug: https://github.com/itstool/itstool/issues/25
|
||||
Bug-Debian: https://bugs.debian.org/912099
|
||||
Forwarded: https://github.com/itstool/itstool/issues/25
|
||||
Author: Tanguy Ortolo <tanguy+debian@ortolo.eu>
|
||||
Last-Update: 2018-12-071
|
||||
|
||||
Index: itstool/itstool.in
|
||||
===================================================================
|
||||
--- itstool.orig/itstool.in 2018-12-10 18:31:23.762143539 +0100
|
||||
+++ itstool/itstool.in 2018-12-10 18:38:03.496777117 +0100
|
||||
@@ -44,9 +44,22 @@
|
||||
else:
|
||||
return str(s)
|
||||
ustr_type = str
|
||||
+ def pr_str(s):
|
||||
+ """Return a string that can be safely print()ed"""
|
||||
+ # Since print works on both bytes and unicode, just return the argument
|
||||
+ return s
|
||||
else:
|
||||
string_types = basestring,
|
||||
ustr = ustr_type = unicode
|
||||
+ def pr_str(s):
|
||||
+ """Return a string that can be safely print()ed"""
|
||||
+ if isinstance(s, str):
|
||||
+ # Since print works on str, just return the argument
|
||||
+ return s
|
||||
+ else:
|
||||
+ # print may not work on unicode if the output encoding cannot be
|
||||
+ # detected, so just encode with UTF-8
|
||||
+ return unicode.encode(s, 'utf-8')
|
||||
|
||||
NS_ITS = 'http://www.w3.org/2005/11/its'
|
||||
NS_ITST = 'http://itstool.org/extensions/'
|
||||
@@ -1060,9 +1073,9 @@
|
||||
if strict:
|
||||
raise
|
||||
else:
|
||||
- sys.stderr.write('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
|
||||
+ sys.stderr.write(pr_str('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
|
||||
(lang + ' ') if lang is not None else '',
|
||||
- msgstr.encode('utf-8')))
|
||||
+ msgstr)))
|
||||
self._xml_err = ''
|
||||
return node
|
||||
def scan_node(node):
|
||||
@@ -1087,9 +1100,9 @@
|
||||
if strict:
|
||||
raise
|
||||
else:
|
||||
- sys.stderr.write('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
|
||||
+ sys.stderr.write(pr_str('Warning: Could not merge %stranslation for msgid:\n%s\n' % (
|
||||
(lang + ' ') if lang is not None else '',
|
||||
- msgstr.encode('utf-8')))
|
||||
+ msgstr)))
|
||||
self._xml_err = ''
|
||||
ctxt.doc().freeDoc()
|
||||
return node
|
||||
Loading…
x
Reference in New Issue
Block a user