Compare commits

...

No commits in common. "c8" and "c10s" have entirely different histories.
c8 ... c10s

8 changed files with 342 additions and 114 deletions

10
.gitignore vendored
View File

@ -1 +1,9 @@
SOURCES/itstool-2.0.6.tar.bz2
/itstool-1.1.0.tar.bz2
/itstool-1.1.1.tar.bz2
/itstool-1.1.2.tar.bz2
/itstool-1.2.0.tar.bz2
/itstool-2.0.2.tar.bz2
/itstool-2.0.4.tar.bz2
/itstool-2.0.5.tar.bz2
/itstool-2.0.6.tar.bz2
/itstool-2.0.7.tar.bz2

View File

@ -1 +0,0 @@
9a7a3cd6e33763f6f369a907e79da98cc47b86e7 SOURCES/itstool-2.0.6.tar.bz2

View File

@ -0,0 +1,76 @@
From 32c7d07664dc37765100285d1202d488cd6a27e8 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@tiptoe.de>
Date: Mon, 9 Oct 2023 14:26:43 +0200
Subject: [PATCH] Fix insufficiently quoted regular expressions
These went under the radar until Python 3.12 started warning about them.
Signed-off-by: Nils Philippsen <nils@tiptoe.de>
---
itstool.in | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/itstool.in b/itstool.in
index c21ad4b..4452616 100755
--- a/itstool.in
+++ b/itstool.in
@@ -220,7 +220,7 @@ class Message (object):
if not isinstance(text, ustr_type):
text = ustr(text, 'utf-8')
self._message[-1] += text.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
- if re.sub('\s+', ' ', text).strip() != '':
+ if re.sub(r'\s+', ' ', text).strip() != '':
self._empty = False
def add_entity_ref (self, name):
@@ -318,7 +318,7 @@ class Message (object):
message += '<_:%s-%i/>' % (msg.name, placeholder)
placeholder += 1
if not self._preserve:
- message = re.sub('\s+', ' ', message).strip()
+ message = re.sub(r'\s+', ' ', message).strip()
return message
def get_preserve_space (self):
@@ -456,9 +456,9 @@ class LocNote (object):
if self._preserve_space:
return self.locnote
else:
- return re.sub('\s+', ' ', self.locnote).strip()
+ return re.sub(r'\s+', ' ', self.locnote).strip()
elif self.locnoteref is not None:
- return '(itstool) link: ' + re.sub('\s+', ' ', self.locnoteref).strip()
+ return '(itstool) link: ' + re.sub(r'\s+', ' ', self.locnoteref).strip()
return ''
@@ -889,7 +889,7 @@ class Document (object):
trans = translations.ugettext('_\x04translator-credits')
if trans is None or trans == 'translator-credits':
return
- regex = re.compile('(.*) \<(.*)\>, (.*)')
+ regex = re.compile(r'(.*) \<(.*)\>, (.*)')
for credit in trans.split('\n'):
match = regex.match(credit)
if not match:
@@ -924,7 +924,7 @@ class Document (object):
prevnode = None
if node.prev is not None and node.prev.type == 'text':
prevtext = node.prev.content
- if re.sub('\s+', '', prevtext) == '':
+ if re.sub(r'\s+', '', prevtext) == '':
prevnode = node.prev
for lang in sorted(list(translations.keys()), reverse=True):
locale = self.get_its_locale_filter(node)
@@ -1468,7 +1468,7 @@ def match_locale(extrange, locale):
localei += 1
return True
-_locale_pattern = re.compile('([a-zA-Z0-9-]+)(_[A-Za-z0-9]+)?(@[A-Za-z0-9]+)?(\.[A-Za-z0-9]+)?')
+_locale_pattern = re.compile(r'([a-zA-Z0-9-]+)(_[A-Za-z0-9]+)?(@[A-Za-z0-9]+)?(\.[A-Za-z0-9]+)?')
def convert_locale (locale):
# Automatically convert POSIX-style locales to BCP47
match = _locale_pattern.match(locale)
--
2.41.0

View File

@ -1,112 +0,0 @@
Name: itstool
Version: 2.0.6
Release: 2%{?dist}
Summary: ITS-based XML translation tool
Group: Development/Tools
License: GPLv3+
URL: http://itstool.org/
Source0: http://files.itstool.org/itstool/%{name}-%{version}.tar.bz2
BuildArch: noarch
BuildRequires: python3-libxml2
BuildRequires: python3-devel
Requires: python3-libxml2
%description
ITS Tool allows you to translate XML documents with PO files, using rules from
the W3C Internationalization Tag Set (ITS) to determine what to translate and
how to separate it into PO file messages.
%prep
%setup -q
%build
export PYTHON=%{__python3}
%configure
make %{?_smp_mflags}
%install
make install DESTDIR=$RPM_BUILD_ROOT
%files
%doc COPYING COPYING.GPL3 NEWS
%{_bindir}/itstool
%{_datadir}/itstool
%doc %{_mandir}/man1/itstool.1.gz
%changelog
* Fri Jun 05 2020 Sundeep Anand <suanand@redhat.com> - 2.0.6-2
- sync with Fedora package
* Tue May 19 2020 Sundeep Anand <suanand@redhat.com> - 2.0.6-1
- Update to 2.0.6 (rhbz#1836152)
- Remove fix-segfaults.patch, as it is a part of upstream now
* Sat May 09 2020 Sundeep Anand <suanand@redhat.com> - 2.0.4-3
- rebuild for s390x (rhbz#1800548)
* Mon Jul 16 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.0.4-2
- Fix libxml2 related segfaults
* Sun Jul 08 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.0.4-1
- Update to 2.0.4
- Change to python3
* Mon Feb 05 2018 Petr Viktorin <pviktori@redhat.com> - 2.0.2-8
- Be more explicit about Python build dependencies
(Require python2-devel, tell autotools that PYTHON is python2)
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Jan 18 2017 Merlin Mathesius <mmathesi@redhat.com> - 2.0.2-5
- Add BuildRequires: python to fix FTBFS (BZ#1414545).
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sat May 17 2014 Kalev Lember <kalevlember@gmail.com> - 2.0.2-1
- Update to 2.0.2
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon Jul 02 2012 Kalev Lember <kalevlember@gmail.com> 1.2.0-1
- Update to 1.2.0
* Wed Mar 21 2012 Kalev Lember <kalevlember@gmail.com> 1.1.2-1
- Update to itstool 1.1.2
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Mon Sep 19 2011 Shaun McCance <shaunm@gnome.org> 1.1.1-1
- Update to itstool 1.1.1
* Sun Aug 07 2011 Rahul Sundaram <sundaram@fedoraproject.org> 1.1.0-2
- Add requires on libxml2-python since itstool uses it
- Drop redundant defattr
- Add NEWS to doc
* Mon Jun 27 2011 Shaun McCance <shaunm@gnome.org> 1.1.0-1
- Update to itstool 1.1.0
* Sun May 8 2011 Shaun McCance <shaunm@gnome.org> 1.0.1-1
- Initial packaging

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: desktop-qe.desktop-ci.tier1-gating.functional}

View 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

182
itstool.spec Normal file
View File

@ -0,0 +1,182 @@
Name: itstool
Version: 2.0.7
Release: 10%{?dist}
Summary: ITS-based XML translation tool
License: GPL-3.0-or-later
URL: http://itstool.org/
Source0: http://files.itstool.org/itstool/%{name}-%{version}.tar.bz2
# See: https://github.com/itstool/itstool/issues/25
Patch0: https://sources.debian.org/data/main/i/itstool/2.0.5-2/debian/patches/fix_crash_912099.patch#/%{name}-2.0.5-fix-crash-wrong-encoding.patch
# Filed upstream at https://github.com/itstool/itstool/pull/51
Patch1: 0001-Fix-insufficiently-quoted-regular-expressions.patch
BuildArch: noarch
BuildRequires: python3-libxml2
BuildRequires: python3-devel
BuildRequires: make
Requires: python3-libxml2
%description
ITS Tool allows you to translate XML documents with PO files, using rules from
the W3C Internationalization Tag Set (ITS) to determine what to translate and
how to separate it into PO file messages.
%prep
%setup -q
%patch -P0 -p1 -b .encoding
%patch -P1 -p1 -b .py312-regex
%build
export PYTHON=%{__python3}
%configure
%make_build
%install
%make_install
%files
%license COPYING COPYING.GPL3
%doc NEWS
%{_bindir}/itstool
%{_datadir}/itstool
%{_mandir}/man1/itstool.1*
%changelog
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 2.0.7-10
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 2.0.7-9
- Bump release for June 2024 mass rebuild
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.7-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.7-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Mon Oct 09 2023 Nils Philippsen <nils@tiptoe.de> - 2.0.7-6
- Fix insufficiently quoted regular expressions which caused excessive warnings
with Python 3.12
* Mon Aug 21 2023 Parag Nemade <pnemade AT fedoraproject DOT org> - 2.0.7-5
- Migrate to SPDX license expression
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Wed Feb 16 2022 Shaun McCance <shaunm@redhat.com> - 2.0.7-1
- Update to 2.0.7
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Apr 07 2019 Kalev Lember <klember@redhat.com> - 2.0.6-1
- Update to 2.0.6
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sun Jan 06 2019 Björn Esser <besser82@fedoraproject.org> - 2.0.5-2
- Add a patch from Debian to fix wrong encoding of output message
* Tue Dec 04 2018 Kalev Lember <klember@redhat.com> - 2.0.5-1
- Update to 2.0.5
- Use make_build and make_install macros
* Mon Jul 16 2018 Charalampos Stratakis <cstratak@redhat.com> - 2.0.4-4
- Fix libxml2 related segfaults
* Mon Jul 16 2018 Miro Hrončok <mhroncok@redhat.com> - 2.0.4-3
- Switch to Python 3
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jul 10 2018 Kalev Lember <klember@redhat.com> - 2.0.4-1
- Update to 2.0.4
- Use license macro for COPYING
* Wed Feb 07 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.0.2-9
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Mon Feb 05 2018 Petr Viktorin <pviktori@redhat.com> - 2.0.2-8
- Be more explicit about Python build dependencies
(Require python2-devel, tell autotools that PYTHON is python2)
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Jan 18 2017 Merlin Mathesius <mmathesi@redhat.com> - 2.0.2-5
- Add BuildRequires: python to fix FTBFS (BZ#1414545).
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sat May 17 2014 Kalev Lember <kalevlember@gmail.com> - 2.0.2-1
- Update to 2.0.2
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon Jul 02 2012 Kalev Lember <kalevlember@gmail.com> 1.2.0-1
- Update to 1.2.0
* Wed Mar 21 2012 Kalev Lember <kalevlember@gmail.com> 1.1.2-1
- Update to itstool 1.1.2
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Mon Sep 19 2011 Shaun McCance <shaunm@gnome.org> 1.1.1-1
- Update to itstool 1.1.1
* Sun Aug 07 2011 Rahul Sundaram <sundaram@fedoraproject.org> 1.1.0-2
- Add requires on libxml2-python since itstool uses it
- Drop redundant defattr
- Add NEWS to doc
* Mon Jun 27 2011 Shaun McCance <shaunm@gnome.org> 1.1.0-1
- Update to itstool 1.1.0
* Sun May 8 2011 Shaun McCance <shaunm@gnome.org> 1.0.1-1
- Initial packaging

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (itstool-2.0.7.tar.bz2) = 710c188e518a7eccbf9d31df59692fd6acc79430589a93ef4333f33f74440c311c340614ca74cc43191830567a98024d0981325ccd83a8fd9b75410d9dd91992