From 6b2de62510834acaf27eb4d1505c1e5bfd6bf867876040c17067a204fcfb9ca3 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 22 Feb 2016 08:21:14 +0000 Subject: [PATCH] - add 0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch (bsc#967556) - fix requires OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=372 --- ...ing-with-the-error-encoding-Fixes-61.patch | 75 +++++++++++++++++++ rpmlint.changes | 6 ++ rpmlint.spec | 2 + 3 files changed, 83 insertions(+) create mode 100644 0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch diff --git a/0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch b/0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch new file mode 100644 index 0000000..39df001 --- /dev/null +++ b/0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch @@ -0,0 +1,75 @@ +From 6d0278d1fb39426467f79ec5bd1637b2d95cca3b Mon Sep 17 00:00:00 2001 +From: Dirk Mueller +Date: Mon, 22 Feb 2016 09:12:39 +0100 +Subject: [PATCH] Avoid messing with the error encoding (Fixes #61) + +Rather than doing something different in the tty/non-tty case, +just call print() directly, which does the right thing without +throwing exceptions. +--- + Filter.py | 24 ++++-------------------- + 1 file changed, 4 insertions(+), 20 deletions(-) + +Index: rpmlint-rpmlint-1.8/Filter.py +=================================================================== +--- rpmlint-rpmlint-1.8.orig/Filter.py ++++ rpmlint-rpmlint-1.8/Filter.py +@@ -9,7 +9,6 @@ + + from __future__ import print_function + import locale +-import sys + import textwrap + + import Config +@@ -24,21 +23,6 @@ _diagnostic = list() + _badness_score = 0 + printed_messages = {"I": 0, "W": 0, "E": 0} + +-if sys.stdout.isatty(): +- def __print(s): +- print(s) +-else: +- __stdout = sys.stdout +- if not __stdout.encoding: # Python < 3 only? +- import codecs +- if hasattr(__stdout, "buffer"): +- __stdout = __stdout.buffer +- __stdout = codecs.getwriter( +- locale.getpreferredencoding())(__stdout, "replace") +- +- def __print(s): +- print(s, file=__stdout) +- + + def printInfo(pkg, reason, *details): + _print("I", pkg, reason, details) +@@ -90,7 +74,7 @@ def _print(msgtype, pkg, reason, details + if threshold >= 0: + _diagnostic.append(s + "\n") + else: +- __print(s) ++ print(s) + if Config.info: + printDescriptions(reason) + return True +@@ -102,8 +86,8 @@ def printDescriptions(reason): + try: + d = _details[reason] + if d and d != '' and d != "\n": +- __print(textwrap.fill(d, 78)) +- __print("") ++ print(textwrap.fill(d, 78)) ++ print("") + except KeyError: + pass + +@@ -128,7 +112,7 @@ def printAllReasons(): + if len(last_reason): + printDescriptions(last_reason) + last_reason = reason +- __print(diag[:-1]) ++ print(diag[:-1]) + if Config.info and len(last_reason): + printDescriptions(last_reason) + _diagnostic = list() diff --git a/rpmlint.changes b/rpmlint.changes index 71002f8..4e87e65 100644 --- a/rpmlint.changes +++ b/rpmlint.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Feb 22 08:16:34 UTC 2016 - dmueller@suse.com + +- add 0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch (bsc#967556) +- fix requires + ------------------------------------------------------------------- Fri Feb 12 14:43:00 UTC 2016 - sleep_walker@opensuse.org diff --git a/rpmlint.spec b/rpmlint.spec index 54fd963..509d69f 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -47,6 +47,7 @@ Requires: desktop-file-utils Requires: file Requires: findutils Requires: python-magic +Requires: python-xml Requires: rpm-python # Requirement for ErlangCheck.py (pull-request #2). Requires: python-pybeam @@ -110,6 +111,7 @@ Patch50: fix-shared-library-matching.diff Patch51: postin-speedup.diff # https://github.com/rpm-software-management/rpmlint/commit/37fe9d4f237c2cb29fcb3b60d1ece189e578eeaf.patch and followup regression fixes Patch52: binaryinfo-speedup.diff +Patch53: 0001-Avoid-messing-with-the-error-encoding-Fixes-61.patch # PATCHLIST END # BuildArch must at the end. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766 BuildArch: noarch