Bug#684020: unblock: germinate/2.10
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
germinate 2.10 fixes a failure when running in the C locale, which is a
regression from the Python 2-based version in squeeze. The fix is
unit-tested and confirmed to work in Ubuntu. The diff follows.
https://bugs.launchpad.net/ubuntu/+source/germinate/+bug/1025818
unblock germinate/2.10
diff -Nru germinate-2.9/debian/changelog germinate-2.10/debian/changelog
--- germinate-2.9/debian/changelog 2012-06-14 15:30:06.000000000 +0100
+++ germinate-2.10/debian/changelog 2012-07-23 11:33:46.000000000 +0100
@@ -1,3 +1,10 @@
+germinate (2.10) unstable; urgency=low
+
+ * Always open Packages files as UTF-8, regardless of the current locale.
+ LP: #1025818.
+
+ -- Steve Langasek <steve.langasek@ubuntu.com> Mon, 23 Jul 2012 11:33:43 +0100
+
germinate (2.9) unstable; urgency=low
* Support both Python 2 and 3 directly rather than using 2to3.
diff -Nru germinate-2.9/germinate/archive.py germinate-2.10/germinate/archive.py
--- germinate-2.9/germinate/archive.py 2012-06-14 15:15:41.000000000 +0100
+++ germinate-2.10/germinate/archive.py 2012-07-23 11:33:03.000000000 +0100
@@ -33,6 +33,8 @@
import tempfile
import shutil
import logging
+import codecs
+import io
import apt_pkg
@@ -168,7 +170,11 @@
except OSError:
pass
- return open(fullname, "r")
+ if sys.version_info[0] < 3:
+ return codecs.open(fullname, 'r', 'UTF-8', 'replace')
+ else:
+ return io.open(fullname, mode='r', encoding='UTF-8',
+ errors='replace')
tag_files = []
for mirror in mirrors:
diff -Nru germinate-2.9/germinate/tests/test_archive.py germinate-2.10/germinate/tests/test_archive.py
--- germinate-2.9/germinate/tests/test_archive.py 2012-01-16 13:56:58.000000000 +0000
+++ germinate-2.10/germinate/tests/test_archive.py 2012-07-23 11:33:03.000000000 +0100
@@ -57,12 +57,13 @@
os.makedirs(source_dir)
packages = gzip.GzipFile(os.path.join(binary_dir, "Packages.gz"), "w")
try:
- packages.write(textwrap.dedent("""\
+ packages.write(textwrap.dedent(b"""\
Package: test
Version: 1.0
Architecture: i386
+ Maintainer: \xc3\xba\xe1\xb8\x83\xc3\xba\xc3\xb1\xc5\xa7\xc5\xaf\x20\xc4\x91\xc9\x99\x76\xe1\xba\xbd\xc5\x82\xc3\xb5\xe1\xb9\x97\xc3\xa8\xc5\x97\xe1\xb9\xa1
- """).encode("UTF-8"))
+ """.decode("UTF-8")).encode("UTF-8"))
finally:
packages.close()
sources = gzip.GzipFile(os.path.join(source_dir, "Sources.gz"), "w")
Thanks,
--
Colin Watson [cjwatson@debian.org]
Reply to: