From 0070702fc8e5732d4b0ecfcab8374655723ae8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 1 May 2019 00:51:37 +0200 Subject: [PATCH] Make it build --- rpmlint-1.10-force-python3.patch | 18 ------ rpmlint-1.11-rpm4.15.patch | 34 +++++++++++ rpmlint-1.9-buildid-fixes.patch | 33 ---------- rpmlint-1.9-fix-uep.patch | 55 ----------------- rpmlint-1.9-py35magic.patch | 13 ---- rpmlint-1.9-py36magic.patch | 11 ---- rpmlint-1.9-py3_b2s.patch | 45 -------------- rpmlint-1.9-py3_test_b2s.patch | 25 -------- rpmlint-1.9-unicodefix.patch | 102 ------------------------------- rpmlint.spec | 80 +++++++++++++++--------- 10 files changed, 84 insertions(+), 332 deletions(-) delete mode 100644 rpmlint-1.10-force-python3.patch create mode 100644 rpmlint-1.11-rpm4.15.patch delete mode 100644 rpmlint-1.9-buildid-fixes.patch delete mode 100644 rpmlint-1.9-fix-uep.patch delete mode 100644 rpmlint-1.9-py35magic.patch delete mode 100644 rpmlint-1.9-py36magic.patch delete mode 100644 rpmlint-1.9-py3_b2s.patch delete mode 100644 rpmlint-1.9-py3_test_b2s.patch delete mode 100644 rpmlint-1.9-unicodefix.patch diff --git a/rpmlint-1.10-force-python3.patch b/rpmlint-1.10-force-python3.patch deleted file mode 100644 index 1dd7248..0000000 --- a/rpmlint-1.10-force-python3.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -up rpmlint-rpmlint-1.10/rpmdiff.py3 rpmlint-rpmlint-1.10/rpmdiff ---- rpmlint-rpmlint-1.10/rpmdiff.py3 2018-10-05 15:30:14.361433625 -0400 -+++ rpmlint-rpmlint-1.10/rpmdiff 2018-10-05 15:31:01.096404906 -0400 -@@ -1,4 +1,4 @@ --#!/usr/bin/python -tt -+#!/usr/bin/python3 -tt - # -*- coding: utf-8 -*- - # - # Copyright (C) 2006 Mandriva; 2009 Red Hat, Inc.; 2009 Ville Skyttä -diff -up rpmlint-rpmlint-1.10/rpmlint.py3 rpmlint-rpmlint-1.10/rpmlint ---- rpmlint-rpmlint-1.10/rpmlint.py3 2018-10-05 15:31:13.647128639 -0400 -+++ rpmlint-rpmlint-1.10/rpmlint 2018-10-05 15:31:18.967011541 -0400 -@@ -1,4 +1,4 @@ --#!/usr/bin/python -ttOu -+#!/usr/bin/python3 -ttOu - # -*- coding: utf-8 -*- - ############################################################################# - # File : rpmlint diff --git a/rpmlint-1.11-rpm4.15.patch b/rpmlint-1.11-rpm4.15.patch new file mode 100644 index 0000000..812ef55 --- /dev/null +++ b/rpmlint-1.11-rpm4.15.patch @@ -0,0 +1,34 @@ +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, 10 insertions(+), 1 deletion(-) + +diff --git a/Pkg.py b/Pkg.py +index 8d01f301..1b257716 100644 +--- a/Pkg.py ++++ b/Pkg.py +@@ -143,8 +143,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 diff --git a/rpmlint-1.9-buildid-fixes.patch b/rpmlint-1.9-buildid-fixes.patch deleted file mode 100644 index 26eca19..0000000 --- a/rpmlint-1.9-buildid-fixes.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff -up rpmlint-rpmlint-1.9/BinariesCheck.py.buildid rpmlint-rpmlint-1.9/BinariesCheck.py ---- rpmlint-rpmlint-1.9/BinariesCheck.py.buildid 2017-07-17 09:45:17.415365410 -0400 -+++ rpmlint-rpmlint-1.9/BinariesCheck.py 2017-07-17 09:45:28.719085854 -0400 -@@ -294,7 +294,7 @@ usr_lib_regex = re.compile('^/usr/lib(64 - bin_regex = re.compile('^(/usr(/X11R6)?)?/s?bin/') - soversion_regex = re.compile('.*?([0-9][.0-9]*)\\.so|.*\\.so\\.([0-9][.0-9]*).*') - reference_regex = re.compile('\.la$|^/usr/lib(64)?/pkgconfig/') --usr_lib_exception_regex = re.compile(Config.getOption('UsrLibBinaryException', '^/usr/lib(64)?/(perl|python|ruby|menu|pkgconfig|ocaml|lib[^/]+\.(so|l?a)$|bonobo/servers/)')) -+usr_lib_exception_regex = re.compile(Config.getOption('UsrLibBinaryException', r'^/usr/lib(64)?/(perl|python|ruby|menu|pkgconfig|ocaml|lib[^/]+\.(so|l?a)$|bonobo/servers/|\.build-id)')) - srcname_regex = re.compile('(.*?)-[0-9]') - invalid_dir_ref_regex = re.compile('/(home|tmp)(\W|$)') - ocaml_mixed_regex = re.compile('^Caml1999X0\d\d$') -diff -up rpmlint-rpmlint-1.9/FilesCheck.py.buildid rpmlint-rpmlint-1.9/FilesCheck.py ---- rpmlint-rpmlint-1.9/FilesCheck.py.buildid 2017-07-17 09:45:37.733862908 -0400 -+++ rpmlint-rpmlint-1.9/FilesCheck.py 2017-07-17 09:46:33.053494782 -0400 -@@ -505,7 +505,7 @@ class FilesCheck(AbstractCheck.AbstractC - printError(pkg, 'version-control-internal-file', f) - elif f.endswith('/.htaccess'): - printError(pkg, 'htaccess-file', f) -- elif hidden_file_regex.search(f) and not f.startswith("/etc/skel/"): -+ elif hidden_file_regex.search(f) and not f.startswith("/etc/skel/") and not f.endswith("/.build-id"): - printWarning(pkg, 'hidden-file-or-dir', f) - elif manifest_perl_regex.search(f): - printWarning(pkg, 'manifest-in-perl-module', f) -@@ -879,7 +879,7 @@ class FilesCheck(AbstractCheck.AbstractC - printError(pkg, 'non-standard-dir-perm', f, "%o" % perm) - if pkg.name not in filesys_packages and f in STANDARD_DIRS: - printError(pkg, 'standard-dir-owned-by-package', f) -- if hidden_file_regex.search(f): -+ if hidden_file_regex.search(f) and not f.endswith("/.build-id"): - printWarning(pkg, 'hidden-file-or-dir', f) - - # symbolic link check diff --git a/rpmlint-1.9-fix-uep.patch b/rpmlint-1.9-fix-uep.patch deleted file mode 100644 index 4d70b1d..0000000 --- a/rpmlint-1.9-fix-uep.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff -up rpmlint-rpmlint-1.9/SpecCheck.py.fixuep rpmlint-rpmlint-1.9/SpecCheck.py ---- rpmlint-rpmlint-1.9/SpecCheck.py.fixuep 2017-02-08 16:54:24.055208215 -0500 -+++ rpmlint-rpmlint-1.9/SpecCheck.py 2017-02-08 16:56:05.012862286 -0500 -@@ -404,8 +404,9 @@ class SpecCheck(AbstractCheck.AbstractCh - if res: - provs = Pkg.parse_deps(res.group(1)) - for prov in unversioned(provs): -- printWarning(pkg, 'unversioned-explicit-provides', -- prov) -+ if not prov.startswith('/'): -+ printWarning(pkg, 'unversioned-explicit-provides', -+ prov) - if compop_regex.search(prov): - printWarning(pkg, - 'comparison-operator-in-deptoken', -@@ -415,8 +416,9 @@ class SpecCheck(AbstractCheck.AbstractCh - if res: - obses = Pkg.parse_deps(res.group(1)) - for obs in unversioned(obses): -- printWarning(pkg, 'unversioned-explicit-obsoletes', -- obs) -+ if not obs.startswith('/'): -+ printWarning(pkg, 'unversioned-explicit-obsoletes', -+ obs) - if compop_regex.search(obs): - printWarning(pkg, - 'comparison-operator-in-deptoken', -diff -up rpmlint-rpmlint-1.9/test/spec/SpecCheck.spec.fixuep rpmlint-rpmlint-1.9/test/spec/SpecCheck.spec ---- rpmlint-rpmlint-1.9/test/spec/SpecCheck.spec.fixuep 2017-02-08 16:56:28.492316699 -0500 -+++ rpmlint-rpmlint-1.9/test/spec/SpecCheck.spec 2017-02-08 16:56:57.105651818 -0500 -@@ -17,6 +17,8 @@ BuildRoot: %{_tmppath}/%{name}-%{ve - Provides: unversioned-provides, versioned-provides = 1.0 - Obsoletes: versioned-obsoletes < 2.0 - Obsoletes: unversioned-obsoletes -+Obsoletes: /usr/bin/unversioned-but-filename -+Provides: /sbin/another-unversioned-but-filename - - %description - SpecCheck test. -diff -up rpmlint-rpmlint-1.9/test/test.SpecCheck.py.fixuep rpmlint-rpmlint-1.9/test/test.SpecCheck.py ---- rpmlint-rpmlint-1.9/test/test.SpecCheck.py.fixuep 2017-02-08 16:57:15.938214210 -0500 -+++ rpmlint-rpmlint-1.9/test/test.SpecCheck.py 2017-02-08 16:57:54.448319360 -0500 -@@ -25,10 +25,12 @@ class TestSpecCheck(unittest.TestCase): - in out) - self.assertTrue("unversioned-explicit-provides versioned-provides" - not in out) -+ self.assertTrue("unversioned-explicit-provides /" not in out) - self.assertTrue("unversioned-explicit-obsoletes unversioned-obsoletes" - in out) - self.assertTrue("unversioned-explicit-obsoletes versioned-obsoletes" - not in out) -+ self.assertTrue("unversioned-explicit-obsoletes /" not in out) - self.assertTrue("setup-not-quiet" in out) - - if __name__ == '__main__': diff --git a/rpmlint-1.9-py35magic.patch b/rpmlint-1.9-py35magic.patch deleted file mode 100644 index 8644427..0000000 --- a/rpmlint-1.9-py35magic.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/FilesCheck.py b/FilesCheck.py -index 112a9ec..b3465ca 100644 ---- a/FilesCheck.py -+++ b/FilesCheck.py -@@ -323,7 +323,7 @@ _python_magic_values = { - '3.2': 3180, - '3.3': 3230, - '3.4': 3310, -- '3.5': 3350, -+ '3.5': 3351, # 3350 for < 3.5.2 - '3.6': 3379, - } - diff --git a/rpmlint-1.9-py36magic.patch b/rpmlint-1.9-py36magic.patch deleted file mode 100644 index bf23574..0000000 --- a/rpmlint-1.9-py36magic.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- rpmlint-rpmlint-1.9/FilesCheck.py 2016-12-29 22:16:24.738320169 -0800 -+++ rpmlint-rpmlint-1.9/FilesCheck.py.new 2016-12-29 22:16:51.109411602 -0800 -@@ -324,7 +324,7 @@ - '3.3': 3230, - '3.4': 3310, - '3.5': 3350, -- '3.6': 3361, -+ '3.6': 3379, - } - - diff --git a/rpmlint-1.9-py3_b2s.patch b/rpmlint-1.9-py3_b2s.patch deleted file mode 100644 index ec27f0b..0000000 --- a/rpmlint-1.9-py3_b2s.patch +++ /dev/null @@ -1,45 +0,0 @@ -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 deleted file mode 100644 index d83317b..0000000 --- a/rpmlint-1.9-py3_test_b2s.patch +++ /dev/null @@ -1,25 +0,0 @@ -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-1.9-unicodefix.patch b/rpmlint-1.9-unicodefix.patch deleted file mode 100644 index da1f3aa..0000000 --- a/rpmlint-1.9-unicodefix.patch +++ /dev/null @@ -1,102 +0,0 @@ -diff -up rpmlint-rpmlint-1.9/FilesCheck.py.unicodefix rpmlint-rpmlint-1.9/FilesCheck.py ---- rpmlint-rpmlint-1.9/FilesCheck.py.unicodefix 2016-07-08 10:45:32.988796231 -0400 -+++ rpmlint-rpmlint-1.9/FilesCheck.py 2016-07-08 10:47:07.520138612 -0400 -@@ -572,8 +572,14 @@ class FilesCheck(AbstractCheck.AbstractC - - chunk = None - istext = False -- if os.access(pkgfile.path, os.R_OK): -- (chunk, istext) = peek(pkgfile.path, pkg) -+ res = None -+ try: -+ res = os.access(pkgfile.path, os.R_OK) -+ except UnicodeError as e: # e.g. non-ASCII, C locale, python 3 -+ printWarning(pkg, 'inaccessible-filename', f, e) -+ else: -+ if res: -+ (chunk, istext) = peek(pkgfile.path, pkg) - - (interpreter, interpreter_args) = script_interpreter(chunk) - -@@ -1304,6 +1310,11 @@ it in the rpm header indicates that it i - but it actually is not in the filesystem. Because of this, some checks will - be skipped.''', - -+'inaccessible-filename', -+'''An error occurred while trying to access this file due to some characters -+in its name. Because of this, some checks will be skipped. Access could work -+with some other locale settings.''', -+ - 'executable-crontab-file', - '''This crontab file has executable bit set, which is refused by newer version - of cron''', -diff -up rpmlint-rpmlint-1.9/Filter.py.unicodefix rpmlint-rpmlint-1.9/Filter.py ---- rpmlint-rpmlint-1.9/Filter.py.unicodefix 2016-07-08 10:43:35.135616091 -0400 -+++ rpmlint-rpmlint-1.9/Filter.py 2016-07-08 10:45:25.885845645 -0400 -@@ -9,6 +9,7 @@ - - from __future__ import print_function - -+import codecs - import locale - import sys - import textwrap -@@ -25,17 +26,20 @@ _diagnostic = list() - _badness_score = 0 - printed_messages = {"I": 0, "W": 0, "E": 0} - --__stdout = sys.stdout - __preferred_encoding = locale.getpreferredencoding() - if sys.version_info[0] < 3: -- import codecs - __stdout = codecs.getwriter(__preferred_encoding)(sys.stdout, 'replace') - -+ def __print(s): -+ if isinstance(s, str): -+ s = s.decode(__preferred_encoding, 'replace') -+ print(s, file=__stdout) -+else: -+ __stdout = codecs.getwriter(__preferred_encoding)( -+ sys.stdout.buffer, 'replace') - --def __print(s): -- if isinstance(s, str) and hasattr(s, 'decode'): -- s = s.decode(__preferred_encoding, 'replace') -- print(s, file=__stdout) -+ def __print(s): -+ print(s, file=__stdout) - - - def printInfo(pkg, reason, *details): -diff -up rpmlint-rpmlint-1.9/Makefile.unicodefix rpmlint-rpmlint-1.9/Makefile ---- rpmlint-rpmlint-1.9/Makefile.unicodefix 2016-07-08 10:47:23.748025724 -0400 -+++ rpmlint-rpmlint-1.9/Makefile 2016-07-08 10:47:38.945919999 -0400 -@@ -22,10 +22,6 @@ PYTHON = /usr/bin/python - # update this variable to create a new release - VERSION := 1.9 - --# for the [A-Z]* part --LC_ALL:=C --export LC_ALL -- - all: __version__.py __isocodes__.py - - clean: -diff -up rpmlint-rpmlint-1.9/test.sh.unicodefix rpmlint-rpmlint-1.9/test.sh ---- rpmlint-rpmlint-1.9/test.sh.unicodefix 2016-07-08 10:47:52.116828374 -0400 -+++ rpmlint-rpmlint-1.9/test.sh 2016-07-08 10:48:34.045536691 -0400 -@@ -18,9 +18,14 @@ for i in $TESTPATH/test.*.py; do - done - - echo "Check that rpmlint executes with no unexpected errors" -+echo "...in default locale" - $PYTHON ./rpmlint -C $(pwd) test/*/*.rpm test/spec/*.spec >/dev/null - rc=$? - test $rc -eq 0 -o $rc -eq 64 || exit $rc -+echo "...in the C locale" -+LC_ALL=C $PYTHON ./rpmlint -C $(pwd) test/*/*.rpm test/spec/*.spec >/dev/null -+rc=$? -+test $rc -eq 0 -o $rc -eq 64 || exit $rc - - echo "$PYTEST tests" - $PYTEST -v || exit $? diff --git a/rpmlint.spec b/rpmlint.spec index cfcd306..6632858 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -9,42 +9,43 @@ %if %{with python3} %global python %{__python3} -%global pytest %(ls -1 %{_bindir}/py.test-3* | tail -n 1) -# for the time being, flake8 is broken -# https://bugzilla.redhat.com/show_bug.cgi?id=1582075 -# so we fake it -#global flake8 python3-flake8 -%global flake8 true +%global pytest pytest-3 %else -%global python %{__python} +%global python %{__python2} %global pytest py.test -%global flake8 flake8 %endif +# linitng is flaky, so we fake it +%global flake8 true + Name: rpmlint Version: 1.11 Release: 1%{?dist} Summary: Tool for checking common errors in RPM packages License: GPLv2 URL: https://github.com/rpm-software-management/rpmlint -Source0: https://github.com/rpm-software-management/rpmlint/archive/rpmlint-%{version}.tar.gz +Source0: %{url}/archive/rpmlint-%{version}.tar.gz Source1: %{name}.config Source3: %{name}-etc.config + +# https://github.com/rpm-software-management/rpmlint/pull/199 +Patch199: rpmlint-1.10-suppress-locale-error.patch +# https://github.com/rpm-software-management/rpmlint/pull/212 +Patch212: rpmlint-1.11-rpm4.15.patch + BuildArch: noarch %if %{with python3} BuildRequires: python3-devel -BuildRequires: rpm-python3 >= 4.4.2.2 +BuildRequires: python3-rpm >= 4.4.2.2 BuildRequires: python3-pytest #BuildRequires: python3-flake8-import-order Requires: python3 -Requires: rpm-python3 >= 4.4.2.2 -Patch5: rpmlint-1.10-force-python3.patch -Patch6: rpmlint-1.10-suppress-locale-error.patch +Requires: python3-rpm >= 4.4.2.2 %else BuildRequires: python >= 2.6 BuildRequires: rpm-python >= 4.4.2.2 BuildRequires: pytest -BuildRequires: python2-flake8-import-order +#BuildRequires: python2-flake8-import-order Requires: python >= 2.6 Requires: rpm-python >= 4.4.2.2 %endif @@ -53,38 +54,49 @@ BuildRequires: sed >= 3.95 # no bash-completion for RHEL BuildRequires: bash-completion %endif -Requires: perl-interpreter -%if ! 0%{?rhel} # python-magic and python-enchant are actually optional dependencies, but -# they bring quite desirable features. They're not available in RHEL/EPEL 5 -# as of 2010-06-23 though. +# they bring quite desirable features. %if %{with python3} Requires: python3-magic +BuildRequires: python3-magic Requires: python3-enchant %else -Requires: python-magic +%if 0%{?rhel} == 7 +# RHEL 6 has 5.04 +Requires: python-magic > 5.05 +BuildRequires: python-magic > 5.05 Requires: python-enchant %endif %endif -Requires: cpio -Requires: binutils -Requires: desktop-file-utils -Requires: gzip -Requires: bzip2 -Requires: xz -# Needed for man page check in FilesCheck.py -Requires: %{_bindir}/groff +Requires: /usr/bin/appstream-util +Requires: /usr/bin/cpio +Requires: /usr/bin/bzip2 +Requires: /usr/bin/desktop-file-validate +BuildRequires: /usr/bin/desktop-file-validate +Requires: /usr/bin/groff +Requires: /usr/bin/gtbl +Requires: /usr/bin/man +Requires: /usr/bin/perl +BuildRequires: /usr/bin/perl +Requires: /usr/bin/readelf +Requires: /usr/bin/xz %description -rpmlint is a tool for checking common errors in RPM packages. Binary +rpmlint is a tool for checking common errors in RPM packages. Binary and source packages as well as spec files can be checked. %prep %setup -q -n %{name}-%{name}-%{version} %if %{with python3} -%patch5 -p1 -%patch6 -p1 +%patch199 -p1 +%patch212 -p1 + +%if 0%{?fedora} >= 31 +# TODO, take upstream (RPM 4.15 related) +sed -i "s/'wb'/'w'/" PostCheck.py +%endif + %endif sed -i -e /MenuCheck/d Config.py cp -p config config.example @@ -107,6 +119,14 @@ rm -rf %{buildroot}%{_sysconfdir}/bash_completion.d/ %check +%if 0%{?rhel} == 6 +# EPEL6 pytest doesn't support -k, so we sed the test names to skip them +# TestPythonBytecodeMtime.test_pyc_mtime/magic_from_chunk has 2.6 incompatible code +sed -i 's/test_pyc_m/xxx_pyc_m/' test/test_files.py +# TestSourceCheck.test_inconsistent_file_extension only works with magic >= 5.05 +sed -i 's/test_inconsistent_file_extension/xxx_inconsistent_file_extension/' test/test_sources.py +%endif + make check PYTHON=%{python} PYTEST=%{pytest} FLAKE8=%{flake8}