From 67b5681dfe83507b8ade819504fce3c79cb70f95 Mon Sep 17 00:00:00 2001 From: si-gui <245140120@qq.com> Date: Wed, 4 Nov 2020 14:27:12 +0800 Subject: [PATCH] Ugly workaroud for RPM 4.14 vs 4.15 python3 bindings incompatibility --- ....15-python3-bindings-incompatibility.patch | 37 +++++++++++++++++++ rpmlint.spec | 6 ++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 rpmlint-1.10-ugly-workaroud-for-RPM-4.14-vs-4.15-python3-bindings-incompatibility.patch diff --git a/rpmlint-1.10-ugly-workaroud-for-RPM-4.14-vs-4.15-python3-bindings-incompatibility.patch b/rpmlint-1.10-ugly-workaroud-for-RPM-4.14-vs-4.15-python3-bindings-incompatibility.patch new file mode 100644 index 0000000..46a4a2e --- /dev/null +++ b/rpmlint-1.10-ugly-workaroud-for-RPM-4.14-vs-4.15-python3-bindings-incompatibility.patch @@ -0,0 +1,37 @@ +From 8fd904b53c028dded0b308ee95f1a5ff998584fd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Thu, 4 Jul 2019 00:31:49 +0200 +Subject: [PATCH] Ugly workaround for RPM 4.14 vs 4.15 python3 bindings + incompatibility + +Fixes https://github.com/rpm-software-management/rpmlint/issues/202 +--- + Pkg.py | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/Pkg.py b/Pkg.py +index 8cf701c..4c96098 100644 +--- a/Pkg.py ++++ b/Pkg.py +@@ -164,8 +164,17 @@ def is_utf8(fname): + + + def is_utf8_bytestr(s): ++ """Returns True whether the given text is UTF-8. ++ Due to changes in rpm, needs to handle both bytes and unicode.""" + try: +- s.decode('UTF-8') ++ if hasattr(s, 'decode'): ++ s.decode('utf-8') ++ elif hasattr(s, 'encode'): ++ s.encode('utf-8') ++ else: ++ unexpected = type(s).__name__ ++ raise TypeError( ++ 'Expected str/unicode/bytes, not {}'.format(unexpected)) + except UnicodeError: + return False + return True +-- +2.23.0 + diff --git a/rpmlint.spec b/rpmlint.spec index 785ef3d..ba9b63d 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -2,7 +2,7 @@ Name: rpmlint Version: 1.10 -Release: 18 +Release: 19 Summary: Check the RPM package of tools for common errors License: GPLv2 URL: https://github.com/rpm-software-management/rpmlint @@ -15,6 +15,7 @@ Patch0002: rpmlint-1.10-flake-cleanups.patch Patch0003: rpmlint-1.10-missing-files-exception.patch Patch0004: rpmlint-1.10-py37mtime.patch Patch0005: rpmlint-1.10-py37magic.patch +Patch0006: rpmlint-1.10-ugly-workaroud-for-RPM-4.14-vs-4.15-python3-bindings-incompatibility.patch BuildArch: noarch @@ -61,5 +62,8 @@ install -pm 644 %{SOURCE1} %{buildroot}%{_datadir}/rpmlint/config %{_mandir}/man1/* %changelog +* Wed Nov 4 2020 Guoshuai Sun - 1.10-19 +- Ugly workaroud for RPM 4.14 vs 4.15 python3 bindings incompatibility + * Tue Feb 18 2020 wanjiankang - 1.10-18 - Package init