initial import
This commit is contained in:
59
itstool/PKGBUILD
Normal file
59
itstool/PKGBUILD
Normal file
@@ -0,0 +1,59 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
pkgname=itstool
|
||||
pkgver=2.0.6
|
||||
_debver=2.0.6
|
||||
_debrel=1
|
||||
pkgrel=1
|
||||
epoch=1
|
||||
pkgdesc="XML to PO and back again"
|
||||
arch=(any)
|
||||
url="http://itstool.org/"
|
||||
license=('custom:GPL-3+OpenSSL-Linking-Exception')
|
||||
depends=(python libxml2 docbook-xml)
|
||||
makedepends=(quilt)
|
||||
source=(http://files.itstool.org/itstool/itstool-$pkgver.tar.bz2
|
||||
https://deb.debian.org/debian/pool/main/i/itstool/itstool_$_debver-$_debrel.debian.tar.xz
|
||||
itstool-2.0.5-fix-crash-wrong-encoding.patch)
|
||||
sha512sums=('51058bdcb208f6fb84810f71f9bf67e42b00bf157a9756be45f060849c0aff36f695f4403404193720d4446818fa77de61fa94eed9e8789d26c07a2926072eb7'
|
||||
'e308520969453b5ab6ab58d5fe6b7362d2c74ca386b9c77e16b53239e89fcf4c8b1dba110750bcf3de5dfee78f10e234910430fee510fd4448e3495ccfe7d0e0'
|
||||
'91c6b822c61f60d904960fc0c1b4d3b67c05540fe46d8738d834235eb9ecf6f7832585e741d4ac46021901f11fdc8624dd3ef42d9bd2901de99ab2b07ccd2cbc')
|
||||
|
||||
prepare() {
|
||||
cd $pkgname-$pkgver
|
||||
|
||||
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
|
||||
# Debian patches
|
||||
export QUILT_PATCHES=debian/patches
|
||||
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
|
||||
export QUILT_DIFF_ARGS='--no-timestamps'
|
||||
|
||||
mv "$srcdir"/debian .
|
||||
|
||||
quilt push -av
|
||||
else
|
||||
# From https://src.fedoraproject.org/rpms/libxml2/tree/master
|
||||
patch -Np1 -i ../itstool-2.0.5-fix-crash-wrong-encoding.patch
|
||||
fi
|
||||
|
||||
autoreconf -fvi
|
||||
}
|
||||
|
||||
build() {
|
||||
cd $pkgname-$pkgver
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
}
|
||||
|
||||
check() {
|
||||
cd $pkgname-$pkgver
|
||||
make check
|
||||
}
|
||||
|
||||
package() {
|
||||
cd $pkgname-$pkgver
|
||||
make DESTDIR="$pkgdir" install
|
||||
for i in COPYING{,.GPL3}; do
|
||||
install -Dm644 $i $pkgdir/usr/share/licenses/$pkgname/$i
|
||||
done
|
||||
}
|
||||
68
itstool/itstool-2.0.5-fix-crash-wrong-encoding.patch
Normal file
68
itstool/itstool-2.0.5-fix-crash-wrong-encoding.patch
Normal file
@@ -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@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
|
||||
Reference in New Issue
Block a user