[arch-commits] Commit in itstool/trunk (2 files)
Jan Steffens
heftig at archlinux.org
Mon Sep 16 17:32:13 UTC 2019
Date: Monday, September 16, 2019 @ 17:32:12
Author: heftig
Revision: 362960
2.0.6-1: try again, this time with an updated libxml2 and a patch from Fedora
Added:
itstool/trunk/itstool-2.0.5-fix-crash-wrong-encoding.patch
Modified:
itstool/trunk/PKGBUILD
----------------------------------------------+
PKGBUILD | 22 ++++----
itstool-2.0.5-fix-crash-wrong-encoding.patch | 68 +++++++++++++++++++++++++
2 files changed, 80 insertions(+), 10 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2019-09-16 17:30:42 UTC (rev 362959)
+++ PKGBUILD 2019-09-16 17:32:12 UTC (rev 362960)
@@ -2,7 +2,7 @@
# Contributor: Michael Pusterhofer <pusterhofer(at)student(dot)tugraz(dot)at>
pkgname=itstool
-pkgver=2.0.2+5+g676f3f7
+pkgver=2.0.6
pkgrel=1
epoch=1
pkgdesc="XML to PO and back again"
@@ -9,15 +9,14 @@
arch=(any)
url="http://itstool.org/"
license=(GPL3)
-depends=(python2 libxml2 docbook-xml)
+depends=(python libxml2 docbook-xml)
makedepends=(git)
-_commit=676f3f738b21ec4d77f300f83d31d2d0eceaddcc # tags/2.0.3~4
-source=("git+https://github.com/itstool/itstool#commit=$_commit")
-sha256sums=('SKIP')
+_commit=60f3a955ca047b1d62a1d952beec74afaff7cbbf # tags/2.0.6^0
+source=("git+https://github.com/itstool/itstool#commit=$_commit"
+ itstool-2.0.5-fix-crash-wrong-encoding.patch)
+sha256sums=('SKIP'
+ 'cb57e3694ab3d7c62b063629b2e9edc6327260c0797d0f33c8dc97fe37c40ebb')
-# itstool on python3 segfaults building gnome-getting-started-docs;
-# can probably blame that one on the libxml2 bindings
-
pkgver() {
cd $pkgname
git describe --tags | sed 's/-/+/g'
@@ -25,13 +24,16 @@
prepare() {
cd $pkgname
- sed -i 's/| python/&2/' configure.ac
+
+ # From https://src.fedoraproject.org/rpms/libxml2/tree/master
+ patch -Np1 -i ../itstool-2.0.5-fix-crash-wrong-encoding.patch
+
autoreconf -fvi
}
build() {
cd $pkgname
- ./configure --prefix=/usr PYTHON=/usr/bin/python2
+ ./configure --prefix=/usr
make
}
Added: itstool-2.0.5-fix-crash-wrong-encoding.patch
===================================================================
--- itstool-2.0.5-fix-crash-wrong-encoding.patch (rev 0)
+++ itstool-2.0.5-fix-crash-wrong-encoding.patch 2019-09-16 17:32:12 UTC (rev 362960)
@@ -0,0 +1,68 @@
+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 at 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
More information about the arch-commits
mailing list