From 4c11232b6033571d1c96b016bec7678f6e3de06a Mon Sep 17 00:00:00 2001 From: Michal Luscon Date: Wed, 30 Sep 2015 15:40:06 +0200 Subject: [PATCH] Update dnf to 1.1.2-4 --- dnf-1.1.2-3-to-dnf-1.1.2-4.patch | 173 +++++++++++++++++++++++++++++++ dnf.spec | 8 +- 2 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 dnf-1.1.2-3-to-dnf-1.1.2-4.patch diff --git a/dnf-1.1.2-3-to-dnf-1.1.2-4.patch b/dnf-1.1.2-3-to-dnf-1.1.2-4.patch new file mode 100644 index 0000000..1f97c33 --- /dev/null +++ b/dnf-1.1.2-3-to-dnf-1.1.2-4.patch @@ -0,0 +1,173 @@ +--- + dnf/i18n.py | 21 ++++++++------------- + tests/test_i18n.py | 13 ------------- + 2 files changed, 8 insertions(+), 26 deletions(-) + +diff --git a/dnf/i18n.py b/dnf/i18n.py +index 318a877..e6d3b4e 100644 +--- a/dnf/i18n.py ++++ b/dnf/i18n.py +@@ -20,13 +20,12 @@ + from __future__ import print_function + from __future__ import unicode_literals + from dnf.pycomp import (PY3, is_py3bytes, unicode, setlocale, gettext, +- gettext_setup) ++ gettext_setup, raw_input) + import locale + import os + import signal + import sys + import unicodedata +-import readline # workaround of raw_input() bug (RhBug:1258364) + + """ + Centralize i18n stuff here. Must be unittested. +@@ -98,20 +97,16 @@ def setup_stdout(): + return False + return True + ++ + def ucd_input(ucstring): +- """ Take input from user. ++ """ It uses print instead of passing the prompt to raw_input. + +- What the raw_input() built-in does, but encode the prompt first +- (raw_input() won't check sys.stdout.encoding as e.g. print does, see +- test_i18n.TestInput.test_assumption()). ++ raw_input doesn't encode the passed string and the output ++ goes into stderr + """ +- if not isinstance(ucstring, unicode): +- raise TypeError("input() accepts Unicode strings") +- if PY3: +- return input(ucstring) +- enc = sys.stdout.encoding if sys.stdout.encoding else 'utf8' +- s = ucstring.encode(enc, 'strict') +- return raw_input(s) ++ print(ucstring, end='') ++ return raw_input() ++ + + def ucd(obj): + """ Like the builtin unicode() but tries to use a reasonable encoding. """ +diff --git a/tests/test_i18n.py b/tests/test_i18n.py +index e11dfe8..2160ec7 100644 +--- a/tests/test_i18n.py ++++ b/tests/test_i18n.py +@@ -78,19 +78,6 @@ class TestInput(TestCase): + # way, for instance when nosetests is run without the -s switch). + self.assertRaises(UnicodeEncodeError, raw_input, UC_TEXT) + +- @unittest.skipIf(PY3, "in python3 there's no conversion in dnf.i18n.input") +- @mock.patch('sys.stdout') +- @mock.patch('__builtin__.raw_input', lambda x: x) +- def test_input(self, stdout): +- stdout.encoding = None +- s = dnf.i18n.ucd_input(UC_TEXT) +- self.assertEqual(s, UC_TEXT.encode('utf8')) +- +- stdout.encoding = 'iso-8859-2' +- s = dnf.i18n.ucd_input(UC_TEXT) +- self.assertEqual(s, UC_TEXT.encode('iso-8859-2')) +- +- self.assertRaises(TypeError, dnf.i18n.ucd_input, b"string") + + class TestConversion(TestCase): + @mock.patch('dnf.i18n._guess_encoding', return_value='utf-8') +-- +2.4.3 + +--- + dnf/i18n.py | 29 +++++++++++++++-------------- + 1 file changed, 15 insertions(+), 14 deletions(-) + +diff --git a/dnf/i18n.py b/dnf/i18n.py +index e6d3b4e..97ef800 100644 +--- a/dnf/i18n.py ++++ b/dnf/i18n.py +@@ -19,8 +19,9 @@ + + from __future__ import print_function + from __future__ import unicode_literals +-from dnf.pycomp import (PY3, is_py3bytes, unicode, setlocale, gettext, +- gettext_setup, raw_input) ++from dnf.pycomp import unicode ++ ++import dnf + import locale + import os + import signal +@@ -38,7 +39,7 @@ class UnicodeStream(object): + + def write(self, s): + if not isinstance(s, str): +- s = (s.decode(self.encoding, 'replace') if PY3 else ++ s = (s.decode(self.encoding, 'replace') if dnf.pycomp.PY3 else + s.encode(self.encoding, 'replace')) + self.stream.write(s) + +@@ -69,14 +70,14 @@ def _guess_encoding(): + + def setup_locale(): + try: +- setlocale(locale.LC_ALL, '') ++ dnf.pycomp.setlocale(locale.LC_ALL, '') + # set time to C so that we output sane things in the logs (#433091) +- setlocale(locale.LC_TIME, 'C') ++ dnf.pycomp.setlocale(locale.LC_TIME, 'C') + except locale.Error as e: + # default to C locale if we get a failure. + print('Failed to set locale, defaulting to C', file=sys.stderr) + os.environ['LC_ALL'] = 'C' +- setlocale(locale.LC_ALL, 'C') ++ dnf.pycomp.setlocale(locale.LC_ALL, 'C') + + def setup_stdout(): + """ Check that stdout is of suitable encoding and handle the situation if +@@ -105,29 +106,29 @@ def ucd_input(ucstring): + goes into stderr + """ + print(ucstring, end='') +- return raw_input() ++ return dnf.pycomp.raw_input() + + + def ucd(obj): + """ Like the builtin unicode() but tries to use a reasonable encoding. """ +- if PY3: +- if is_py3bytes(obj): ++ if dnf.pycomp.PY3: ++ if dnf.pycomp.is_py3bytes(obj): + return str(obj, _guess_encoding(), errors='ignore') + elif isinstance(obj, str): + return obj + return str(obj) + else: +- if isinstance(obj, unicode): ++ if isinstance(obj, dnf.pycomp.unicode): + return obj + if hasattr(obj, '__unicode__'): + # see the doc for the unicode() built-in. The logic here is: if obj + # implements __unicode__, let it take a crack at it, but handle the + # situation if it fails: + try: +- return unicode(obj) ++ return dnf.pycomp.unicode(obj) + except UnicodeError: + pass +- return unicode(str(obj), _guess_encoding(), errors='ignore') ++ return dnf.pycomp.unicode(str(obj), _guess_encoding(), errors='ignore') + + + # functions for formating output according to terminal width, +@@ -277,6 +278,6 @@ def textwrap_fill(text, width=70, initial_indent='', subsequent_indent=''): + return '\n'.join(ret) + + # setup translation +-t = gettext.translation('dnf', fallback=True) +-_, P_ = gettext_setup(t) ++t = dnf.pycomp.gettext.translation('dnf', fallback=True) ++_, P_ = dnf.pycomp.gettext_setup(t) + +-- +2.4.3 diff --git a/dnf.spec b/dnf.spec index be82363..3c1352e 100644 --- a/dnf.spec +++ b/dnf.spec @@ -11,7 +11,7 @@ Name: dnf Version: 1.1.2 -Release: 3%{?snapshot}%{?dist} +Release: 4%{?snapshot}%{?dist} Summary: Package manager forked from Yum, using libsolv as a dependency resolver # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPLv2+ and GPLv2 and GPL @@ -19,6 +19,7 @@ URL: https://github.com/rpm-software-management/dnf Source0: https://github.com/rpm-software-management/dnf/archive/%{name}-%{version}.tar.gz Patch0: dnf-1.1.2-1-to-dnf-1.1.2-2.patch Patch1: dnf-1.1.2-2-to-dnf-1.1.2-3.patch +Patch2: dnf-1.1.2-3-to-dnf-1.1.2-4.patch BuildArch: noarch BuildRequires: cmake BuildRequires: gettext @@ -141,6 +142,7 @@ Alternative CLI to "dnf upgrade" suitable for automatic, regular execution. %setup -q -n dnf-%{version} %patch0 -p1 %patch1 -p1 +%patch2 -p1 rm -rf py3 mkdir ../py3 cp -a . ../py3/ @@ -272,6 +274,10 @@ exit 0 %systemd_postun_with_restart dnf-automatic.timer %changelog +* Tue Sep 30 2015 Michal Luscon 1.1.2-4 +- don't import readline as it causes crashes in Anaconda + (related:RhBug:1258364) + * Tue Sep 22 2015 Michal Luscon 1.1.2-3 - Revert "completion_helper: don't get IndexError (RhBug:1250038)"