New upstream release.
Remove upstreamed patches Add ourselves to YumBase.run_with_package_names Add command line option to keep environment
This commit is contained in:
parent
d4c134e0ee
commit
af81843f24
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ PackageKit-0.6.7.tar.bz2
|
||||
/PackageKit-0.6.17.tar.xz
|
||||
/PackageKit-0.6.18.tar.xz
|
||||
/PackageKit-0.6.19.tar.xz
|
||||
/PackageKit-0.6.20.tar.xz
|
||||
|
||||
@ -1,110 +0,0 @@
|
||||
From a7d50f5f4a9f69e33075fbe05d4ae42158d1b9c9 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Wed, 26 Oct 2011 17:31:36 +0200
|
||||
Subject: [PATCH 1/2] python: implement and use utf8 stream writer for stdout,
|
||||
stderr
|
||||
|
||||
The C-side (glib) really wants stuff to be encoded in UTF-8.
|
||||
(cherry picked from commit b5a5011f31d6062cd00ee6b02ddf356d691e67e6)
|
||||
---
|
||||
lib/python/packagekit/backend.py | 45 ++++++++++++++++++++++++++++++++++++++
|
||||
1 files changed, 45 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/lib/python/packagekit/backend.py b/lib/python/packagekit/backend.py
|
||||
index ae7bbad..4c7fd2c 100644
|
||||
--- a/lib/python/packagekit/backend.py
|
||||
+++ b/lib/python/packagekit/backend.py
|
||||
@@ -37,8 +37,49 @@ def _to_unicode(txt, encoding='utf-8'):
|
||||
txt = unicode(txt, encoding, errors='replace')
|
||||
return txt
|
||||
|
||||
+def _to_utf8(txt, errors='replace'):
|
||||
+ '''convert practically anything to a utf-8-encoded byte string'''
|
||||
+
|
||||
+ # convert to unicode object
|
||||
+ if isinstance(txt, str):
|
||||
+ txt = txt.decode('utf-8', errors=errors)
|
||||
+ if not isinstance(txt, basestring):
|
||||
+ # try to convert non-string objects like exceptions
|
||||
+ try:
|
||||
+ # if txt.__unicode__() exists, or txt.__str__() returns ASCII
|
||||
+ txt = unicode(txt)
|
||||
+ except UnicodeDecodeError:
|
||||
+ # if txt.__str__() exists
|
||||
+ txt = str(txt).decode('utf-8', errors=errors)
|
||||
+ except:
|
||||
+ # no __str__(), __unicode__() methods, use representation
|
||||
+ txt = unicode(repr(txt))
|
||||
+
|
||||
+ # return encoded as UTF-8
|
||||
+ return txt.encode('utf-8', errors=errors)
|
||||
+
|
||||
# Classes
|
||||
|
||||
+class _UTF8Writer(codecs.StreamWriter):
|
||||
+
|
||||
+ encoding = 'utf-8'
|
||||
+
|
||||
+ def __init__(self, stream, errors='replace'):
|
||||
+ codecs.StreamWriter.__init__(self, stream, errors)
|
||||
+
|
||||
+ def encode(self, inp, errors='strict'):
|
||||
+ try:
|
||||
+ l = len(inp)
|
||||
+ except TypeError:
|
||||
+ try:
|
||||
+ l = len(unicode(inp))
|
||||
+ except:
|
||||
+ try:
|
||||
+ l = len(str(inp))
|
||||
+ except:
|
||||
+ l = 1
|
||||
+ return (_to_utf8(inp, errors=errors), l)
|
||||
+
|
||||
class PkError(Exception):
|
||||
def __init__(self, code, details):
|
||||
self.code = code
|
||||
@@ -49,6 +90,10 @@ class PkError(Exception):
|
||||
class PackageKitBaseBackend:
|
||||
|
||||
def __init__(self, cmds):
|
||||
+ # Make sys.stdout/stderr cope with UTF-8
|
||||
+ sys.stdout = _UTF8Writer(sys.stdout)
|
||||
+ sys.stderr = _UTF8Writer(sys.stderr)
|
||||
+
|
||||
# Setup a custom exception handler
|
||||
installExceptionHandler(self)
|
||||
self.cmds = cmds
|
||||
--
|
||||
1.7.6.4
|
||||
|
||||
|
||||
From 01226fbdfc6cd9f03183048c7531ed324d4b5412 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Philippsen <nils@redhat.com>
|
||||
Date: Wed, 26 Oct 2011 17:33:18 +0200
|
||||
Subject: [PATCH 2/2] yum: don't let yum.misc.setup_locale() override stdout
|
||||
codec
|
||||
|
||||
Use our own stdout/stderr wrappers, as what codecs.getwriter() supplies
|
||||
only works for unicode, but not for already encoded data.
|
||||
(cherry picked from commit 31b9a6942a65f8eeeb67c6ea376429e8c5eac43f)
|
||||
---
|
||||
backends/yum/yumBackend.py | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
|
||||
index 479ee2d..dfed1a2 100755
|
||||
--- a/backends/yum/yumBackend.py
|
||||
+++ b/backends/yum/yumBackend.py
|
||||
@@ -3482,7 +3482,7 @@ class PackageKitYumBase(yum.YumBase):
|
||||
raise PkError(ERROR_FAILED_CONFIG_PARSING, _to_unicode(e))
|
||||
|
||||
# setup to use LANG for descriptions
|
||||
- yum.misc.setup_locale(override_time=True)
|
||||
+ yum.misc.setup_locale(override_time=True, override_codecs=False)
|
||||
|
||||
self.missingGPGKey = None
|
||||
self.dsCallback = DepSolveCallback(backend)
|
||||
--
|
||||
1.7.6.4
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
Summary: Package management service
|
||||
Name: PackageKit
|
||||
Version: 0.6.19
|
||||
Release: 3%{?dist}
|
||||
Version: 0.6.20
|
||||
Release: 1%{?dist}
|
||||
License: GPLv2+ and LGPLv2+
|
||||
URL: http://www.packagekit.org
|
||||
Source0: http://www.packagekit.org/releases/%{name}-%{version}.tar.xz
|
||||
@ -14,9 +14,6 @@ Patch0: PackageKit-0.3.8-Fedora-Vendor.conf.patch
|
||||
# Fedora specific: the yum backend doesn't do time estimation correctly
|
||||
Patch1: PackageKit-0.4.4-Fedora-turn-off-time.conf.patch
|
||||
|
||||
# upstream fix
|
||||
Patch2: PackageKit-0.6.19-yum-encoding.patch
|
||||
|
||||
Requires: PackageKit-glib = %{version}-%{release}
|
||||
Requires: PackageKit-backend
|
||||
Requires: shared-mime-info
|
||||
@ -253,7 +250,6 @@ user to restart the computer or remove and re-insert the device.
|
||||
%setup -q
|
||||
%patch0 -p1 -b .fedora
|
||||
%patch1 -p1 -b .no-time
|
||||
%patch2 -p1 -b .yum-encoding
|
||||
|
||||
%build
|
||||
%configure \
|
||||
@ -467,6 +463,12 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
|
||||
%{_includedir}/PackageKit/backend/*.h
|
||||
|
||||
%changelog
|
||||
* Mon Nov 07 2011 Richard Hughes <rhughes@redhat.com> - 0.6.20-1
|
||||
- New upstream release.
|
||||
- Remove upstreamed patches
|
||||
- Add ourselves to YumBase.run_with_package_names
|
||||
- Add command line option to keep environment
|
||||
|
||||
* Thu Oct 27 2011 Nils Philippsen <nils@redhat.com> - 0.6.19-3
|
||||
- fix yum encoding issues seen with kpackagekit (#668282)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user