diff --git a/rpmlint-1.9-py3_b2s.patch b/rpmlint-1.9-py3_b2s.patch new file mode 100644 index 0000000..ec27f0b --- /dev/null +++ b/rpmlint-1.9-py3_b2s.patch @@ -0,0 +1,45 @@ +From 4875475c43098e37a4d5d4e2ee2f9dfea643cc78 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= +Date: Fri, 7 Apr 2017 09:26:35 +0300 +Subject: [PATCH] Pkg.b2s: Pass through str as-is on Python 3 + +Things change, and we may start getting str where we previously got +bytes, such as what has apparently now happened with some versions of +the return value of magic.descriptor(fd) in Fedora Rawhide. + +https://bugzilla.redhat.com/show_bug.cgi?id=1439941 +--- + Pkg.py | 4 ++-- + test/test.Pkg.py | 4 ++++ + 2 files changed, 6 insertions(+), 2 deletions(-) + +Index: rpmlint-rpmlint-1.9/Pkg.py +=================================================================== +--- rpmlint-rpmlint-1.9.orig/Pkg.py ++++ rpmlint-rpmlint-1.9/Pkg.py +@@ -41,8 +41,8 @@ if sys.version_info[0] > 2: + unicode = str + + def b2s(b): +- if b is None: +- return None ++ if b is None or isinstance(b, str): ++ return b + if isinstance(b, (list, tuple)): + return [b2s(x) for x in b] + return b.decode(errors='replace') +Index: rpmlint-rpmlint-1.9/test/test.Pkg.py +=================================================================== +--- rpmlint-rpmlint-1.9.orig/test/test.Pkg.py ++++ rpmlint-rpmlint-1.9/test/test.Pkg.py +@@ -30,5 +30,10 @@ class TestPkg(unittest.TestCase): + ): + self.assertFalse(Pkg.rangeCompare(req, prov)) + ++ def test_b2s(self): ++ for thing in ("foo", ["foo"]): ++ self.assertEqual(thing, Pkg.b2s(thing)) ++ ++ + if __name__ == '__main__': + unittest.main() diff --git a/rpmlint-1.9-py3_test_b2s.patch b/rpmlint-1.9-py3_test_b2s.patch new file mode 100644 index 0000000..d83317b --- /dev/null +++ b/rpmlint-1.9-py3_test_b2s.patch @@ -0,0 +1,25 @@ +From 73d62d4421a06a3282c1a71625b070e3ca58b624 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= +Date: Fri, 7 Apr 2017 09:55:15 +0300 +Subject: [PATCH] Pkg.b2s: Add some more test cases + +--- + test/test.Pkg.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +Index: rpmlint-rpmlint-1.9/test/test.Pkg.py +=================================================================== +--- rpmlint-rpmlint-1.9.orig/test/test.Pkg.py ++++ rpmlint-rpmlint-1.9/test/test.Pkg.py +@@ -31,8 +31,10 @@ class TestPkg(unittest.TestCase): + self.assertFalse(Pkg.rangeCompare(req, prov)) + + def test_b2s(self): +- for thing in ("foo", ["foo"]): ++ for thing in ("foo", ["foo"], None, []): + self.assertEqual(thing, Pkg.b2s(thing)) ++ self.assertEqual("foo", Pkg.b2s(b"foo")) ++ self.assertEqual(["foo"], Pkg.b2s([b"foo"])) + + + if __name__ == '__main__': diff --git a/rpmlint.spec b/rpmlint.spec index ab9191e..254dd46 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -16,7 +16,7 @@ Name: rpmlint Version: 1.9 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Tool for checking common errors in RPM packages Group: Development/Tools License: GPLv2 @@ -42,6 +42,12 @@ Patch2: rpmlint-1.9-fix-uep.patch # Python 3.5.3 bytecode magic value update # https://github.com/rpm-software-management/rpmlint/commit/beb32c4cfbff4aa979141941f534d2c6b7a18639 (hand-rediffed) Patch3: rpmlint-1.9-py35magic.patch +# rpmlint fails: str object has no attribute decode +# https://github.com/rpm-software-management/rpmlint/commit/4875475c43098e37a4d5d4e2ee2f9dfea643cc78 (hand-rediffed) +# https://github.com/rpm-software-management/rpmlint/commit/73d62d4421a06a3282c1a71625b070e3ca58b624 (hand-rediffed) +# https://bugzilla.redhat.com/show_bug.cgi?id=1439941 +Patch4: rpmlint-1.9-py3_b2s.patch +Patch5: rpmlint-1.9-py3_test_b2s.patch BuildArch: noarch %if %{with python3} BuildRequires: python3-devel @@ -96,6 +102,8 @@ and source packages as well as spec files can be checked. %patch1 -p1 -b .py36magic %patch2 -p1 -b .fixuep %patch3 -p1 -b .py35magic +%patch4 -p1 -b .py3b2s +%patch5 -p1 -b .py35b2s_test sed -i -e /MenuCheck/d Config.py cp -p config config.example install -pm 644 %{SOURCE3} config @@ -145,6 +153,9 @@ make check PYTHON=%{python} PYTEST=%{pytest} FLAKE8=%{flake8} %{_mandir}/man1/rpmlint.1* %changelog +* Fri Apr 07 2017 Björn Esser - 1.9-9 +- Upstream fix for str object has no attribute decode (bz1439941) + * Thu Mar 9 2017 Charalampos Stratakis - 1.9-8 - Update Python 3.5.3 magic bytecode value