commit 22f61995384df82658c6e0a4399e10fb7f22aa06 Author: MSVSphere Packaging Team Date: Fri Mar 29 16:28:10 2024 +0300 import rpmlint-1.10-15.el8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d6d759 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +SOURCES/__future__.cpython-36.pyc +SOURCES/__future__.cpython-37.pyc +SOURCES/rpmlint-1.10.tar.gz diff --git a/.rpmlint.metadata b/.rpmlint.metadata new file mode 100644 index 0000000..1831c82 --- /dev/null +++ b/.rpmlint.metadata @@ -0,0 +1,3 @@ +89bf03279e0b25e46ec063d9b56951a72002c474 SOURCES/__future__.cpython-36.pyc +77ad4efceec29a989bf6eaddc22607628493a62b SOURCES/__future__.cpython-37.pyc +d77b498d42d6d7ef044df14a0f37cf88e520cebd SOURCES/rpmlint-1.10.tar.gz diff --git a/SOURCES/rpmlint-1.10-fix_test.patch b/SOURCES/rpmlint-1.10-fix_test.patch new file mode 100644 index 0000000..aded1ed --- /dev/null +++ b/SOURCES/rpmlint-1.10-fix_test.patch @@ -0,0 +1,25 @@ +diff -up rpmlint-rpmlint-1.10/test.sh.fix_test rpmlint-rpmlint-1.10/test.sh +--- rpmlint-rpmlint-1.10/test.sh.fix_test 2017-09-05 08:40:05.000000000 +0200 ++++ rpmlint-rpmlint-1.10/test.sh 2019-06-13 12:05:03.663871888 +0200 +@@ -2,7 +2,7 @@ + + export PYTHONPATH=$(pwd)/tools:$(pwd) + export TESTPATH="$(pwd)/test/" +-: ${PYTHON:=python} ${PYTEST:=py.test} ${FLAKE8:=flake8} ++: ${PYTHON:=/usr/libexec/platform-python} ${PYTEST:=py.test-3} ${FLAKE8:=flake8} + : ${PYTHONWARNINGS:=all} + export PYTHONWARNINGS + +@@ -40,9 +40,9 @@ $PYTEST -v || exit $? + + unset PYTHONWARNINGS + +-echo "$FLAKE8 tests" +-$FLAKE8 --version +-$FLAKE8 . ./rpmdiff ./rpmlint || exit $? ++#echo "$FLAKE8 tests" ++#$FLAKE8 --version ++#$FLAKE8 . ./rpmdiff ./rpmlint || exit $? + + echo "man page tests" + if man --help 2>&1 | grep -q -- --warnings; then diff --git a/SOURCES/rpmlint-1.10-flake-cleanups.patch b/SOURCES/rpmlint-1.10-flake-cleanups.patch new file mode 100644 index 0000000..255cf5a --- /dev/null +++ b/SOURCES/rpmlint-1.10-flake-cleanups.patch @@ -0,0 +1,358 @@ +diff -up rpmlint-rpmlint-1.10/AbstractCheck.py.flake rpmlint-rpmlint-1.10/AbstractCheck.py +--- rpmlint-rpmlint-1.10/AbstractCheck.py.flake 2017-09-05 02:40:05.000000000 -0400 ++++ rpmlint-rpmlint-1.10/AbstractCheck.py 2018-04-17 12:22:20.681609697 -0400 +@@ -11,7 +11,7 @@ import contextlib + import re + try: + import urllib2 +-except: ++except ImportError: + import urllib.request as urllib2 + + import Config +diff -up rpmlint-rpmlint-1.10/BinariesCheck.py.flake rpmlint-rpmlint-1.10/BinariesCheck.py +--- rpmlint-rpmlint-1.10/BinariesCheck.py.flake 2017-09-05 02:40:05.000000000 -0400 ++++ rpmlint-rpmlint-1.10/BinariesCheck.py 2018-04-17 12:22:52.688880629 -0400 +@@ -101,32 +101,32 @@ class BinaryInfo(object): + ('readelf', '-W', '-S', '-l', '-d', '-s', path)) + if not res[0]: + lines = res[1].splitlines() +- for l in lines: +- r = BinaryInfo.needed_regex.search(l) ++ for line in lines: ++ r = BinaryInfo.needed_regex.search(line) + if r: + self.needed.append(r.group(1)) + continue + +- r = BinaryInfo.rpath_regex.search(l) ++ r = BinaryInfo.rpath_regex.search(line) + if r: + for p in r.group(1).split(':'): + self.rpath.append(p) + continue + +- if BinaryInfo.comment_regex.search(l): ++ if BinaryInfo.comment_regex.search(line): + self.comment = True + continue + +- if BinaryInfo.pic_regex.search(l): ++ if BinaryInfo.pic_regex.search(line): + self.non_pic = False + continue + +- r = BinaryInfo.soname_regex.search(l) ++ r = BinaryInfo.soname_regex.search(line) + if r: + self.soname = r.group(1) + continue + +- r = BinaryInfo.stack_regex.search(l) ++ r = BinaryInfo.stack_regex.search(line) + if r: + self.stack = True + flags = r.group(1) +@@ -134,45 +134,45 @@ class BinaryInfo(object): + self.exec_stack = True + continue + +- if l.startswith("Symbol table"): ++ if line.startswith("Symbol table"): + break + +- for l in lines: +- r = BinaryInfo.call_regex.search(l) ++ for line in lines: ++ r = BinaryInfo.call_regex.search(line) + if not r: + continue +- l = r.group(1) ++ line = r.group(1) + +- if BinaryInfo.mktemp_call_regex.search(l): ++ if BinaryInfo.mktemp_call_regex.search(line): + self.mktemp = True + +- if BinaryInfo.setgid_call_regex.search(l): ++ if BinaryInfo.setgid_call_regex.search(line): + self.setgid = True + +- if BinaryInfo.setuid_call_regex.search(l): ++ if BinaryInfo.setuid_call_regex.search(line): + self.setuid = True + +- if BinaryInfo.setgroups_call_regex.search(l): ++ if BinaryInfo.setgroups_call_regex.search(line): + self.setgroups = True + +- if BinaryInfo.chdir_call_regex.search(l): ++ if BinaryInfo.chdir_call_regex.search(line): + self.chdir = True + +- if BinaryInfo.chroot_call_regex.search(l): ++ if BinaryInfo.chroot_call_regex.search(line): + self.chroot = True + + if BinaryInfo.forbidden_functions: + for r_name, func in BinaryInfo.forbidden_functions.items(): +- ret = func['f_regex'].search(l) ++ ret = func['f_regex'].search(line) + if ret: + self.forbidden_calls.append(r_name) + + if is_shlib: +- r = BinaryInfo.exit_call_regex.search(l) ++ r = BinaryInfo.exit_call_regex.search(line) + if r: + self.exit_calls.append(r.group(1)) + continue +- r = BinaryInfo.fork_call_regex.search(l) ++ r = BinaryInfo.fork_call_regex.search(line) + if r: + fork_called = True + continue +@@ -182,14 +182,14 @@ class BinaryInfo(object): + if self.forbidden_calls: + res = Pkg.getstatusoutput(('strings', path)) + if not res[0]: +- for l in res[1].splitlines(): ++ for line in res[1].splitlines(): + # as we need to remove elements, iterate backwards + for i in range(len(self.forbidden_calls) - 1, -1, -1): + func = self.forbidden_calls[i] + f = BinaryInfo.forbidden_functions[func] + if 'waiver_regex' not in f: + continue +- r = f['waiver_regex'].search(l) ++ r = f['waiver_regex'].search(line) + if r: + del self.forbidden_calls[i] + +@@ -254,8 +254,8 @@ class BinaryInfo(object): + # We could do this with objdump, but it's _much_ simpler with ldd. + res = Pkg.getstatusoutput(('ldd', '-d', '-r', path)) + if not res[0]: +- for l in res[1].splitlines(): +- undef = BinaryInfo.undef_regex.search(l) ++ for line in res[1].splitlines(): ++ undef = BinaryInfo.undef_regex.search(line) + if undef: + self.undef.append(undef.group(1)) + if self.undef: +@@ -263,7 +263,7 @@ class BinaryInfo(object): + res = Pkg.getstatusoutput(['c++filt'] + self.undef) + if not res[0]: + self.undef = res[1].splitlines() +- except: ++ except OSError: + pass + else: + printWarning(pkg, 'ldd-failed', file) +@@ -272,13 +272,13 @@ class BinaryInfo(object): + # Either ldd doesn't grok -u (added in glibc 2.3.4) or we have + # unused direct dependencies + in_unused = False +- for l in res[1].splitlines(): +- if not l.rstrip(): ++ for line in res[1].splitlines(): ++ if not line.rstrip(): + pass +- elif l.startswith('Unused direct dependencies'): ++ elif line.startswith('Unused direct dependencies'): + in_unused = True + elif in_unused: +- unused = BinaryInfo.unused_regex.search(l) ++ unused = BinaryInfo.unused_regex.search(line) + if unused: + self.unused.append(unused.group(1)) + else: +diff -up rpmlint-rpmlint-1.10/Config.py.flake rpmlint-rpmlint-1.10/Config.py +--- rpmlint-rpmlint-1.10/Config.py.flake 2017-09-05 02:40:05.000000000 -0400 ++++ rpmlint-rpmlint-1.10/Config.py 2018-04-17 12:22:20.684609629 -0400 +@@ -42,11 +41,11 @@ USEUTF8_DEFAULT = False + try: + if locale.getpreferredencoding() == 'UTF-8': + USEUTF8_DEFAULT = True +-except: ++except UnicodeError: + try: + if re.match('utf', locale.getdefaultlocale()[1], re.I): + USEUTF8_DEFAULT = True +- except: ++ except UnicodeError: + pass + + info = False +@@ -105,10 +105,7 @@ def setOption(name, value): + + + def getOption(name, default=""): +- try: +- return _options[name] +- except: +- return default ++ return _options.get(name, default) + + + # List of filters +@@ -128,7 +125,7 @@ def removeFilter(s): + + try: + _filters.remove(s) +- except: ++ except ValueError: + pass + else: + _filters_re = None +diff -up rpmlint-rpmlint-1.10/MenuXDGCheck.py.flake rpmlint-rpmlint-1.10/MenuXDGCheck.py +--- rpmlint-rpmlint-1.10/MenuXDGCheck.py.flake 2017-09-05 02:40:05.000000000 -0400 ++++ rpmlint-rpmlint-1.10/MenuXDGCheck.py 2018-04-17 12:22:20.681609697 -0400 +@@ -9,7 +9,7 @@ + import os + try: + from ConfigParser import RawConfigParser +-except: ++except ImportError: + from configparser import RawConfigParser + + import AbstractCheck +diff -up rpmlint-rpmlint-1.10/Pkg.py.flake rpmlint-rpmlint-1.10/Pkg.py +--- rpmlint-rpmlint-1.10/Pkg.py.flake 2017-09-05 02:40:05.000000000 -0400 ++++ rpmlint-rpmlint-1.10/Pkg.py 2018-04-17 12:22:20.681609697 -0400 +@@ -18,7 +18,7 @@ import sys + import tempfile + try: + from urlparse import urljoin +-except: ++except ImportError: + from urllib.parse import urljoin + + try: +@@ -27,7 +27,7 @@ try: + _magic = magic.open(magic.MAGIC_NONE) + _ = _magic.descriptor # magic >= 5.05 needed + _magic.load() +-except: ++except ImportError: + _magic = None + import rpm + +@@ -52,7 +52,7 @@ else: + + try: + from shlex import quote as shquote +-except: ++except ImportError: + def shquote(s): + return '"%s"' % s + +@@ -166,7 +166,7 @@ def is_utf8(fname): + def is_utf8_bytestr(s): + try: + s.decode('UTF-8') +- except: ++ except UnicodeError: + return False + return True + +@@ -227,7 +227,7 @@ def get_default_valid_rpmgroups(filename + groupsfiles = [x for x in p.files() if x.endswith('/GROUPS')] + if groupsfiles: + filename = groupsfiles[0] +- except: # the rpm package might not be installed ++ except KeyError: # the rpm package might not be installed + pass + if filename and os.path.exists(filename): + with open(filename) as fobj: +@@ -532,7 +532,7 @@ class Pkg(AbstractPkg): + def __getitem__(self, key): + try: + val = self.header[key] +- except: ++ except KeyError: + val = [] + if val == []: + return None +@@ -680,7 +680,7 @@ class Pkg(AbstractPkg): + magics = [b2s(x) for x in self.header[rpm.RPMTAG_FILECLASS]] + try: # rpm >= 4.7.0 + filecaps = self.header[rpm.RPMTAG_FILECAPS] +- except: ++ except AttributeError: + filecaps = None + + # rpm-python < 4.6 does not return a list for this (or FILEDEVICES, +@@ -915,9 +915,11 @@ class Pkg(AbstractPkg): + Depending on rpm-python version, the string may or may not include + interpreter arguments, if any. + """ ++ if which is None: ++ return '' + prog = self[which] + if prog is None: +- prog = "" ++ prog = '' + elif isinstance(prog, (list, tuple)): + # http://rpm.org/ticket/847#comment:2 + prog = "".join(prog) +diff -up rpmlint-rpmlint-1.10/rpmlint.flake rpmlint-rpmlint-1.10/rpmlint +--- rpmlint-rpmlint-1.10/rpmlint.flake 2017-09-05 02:40:05.000000000 -0400 ++++ rpmlint-rpmlint-1.10/rpmlint 2018-04-17 12:22:20.682609674 -0400 +@@ -20,7 +20,7 @@ import tempfile + + try: + import importlib +-except: # Python < 2.7 ++except ImportError: # Python < 2.7 + importlib = None + import imp + +diff -up rpmlint-rpmlint-1.10/SCLCheck.py.flake rpmlint-rpmlint-1.10/SCLCheck.py +--- rpmlint-rpmlint-1.10/SCLCheck.py.flake 2017-09-05 02:40:05.000000000 -0400 ++++ rpmlint-rpmlint-1.10/SCLCheck.py 2018-04-17 12:22:20.682609674 -0400 +@@ -50,7 +50,7 @@ def index_or_sub(source, word, sub=0): + """ + try: + return source.index(word) +- except: ++ except ValueError: + return sub + + +diff -up rpmlint-rpmlint-1.10/SpecCheck.py.flake rpmlint-rpmlint-1.10/SpecCheck.py +--- rpmlint-rpmlint-1.10/SpecCheck.py.flake 2017-09-05 02:40:05.000000000 -0400 ++++ rpmlint-rpmlint-1.10/SpecCheck.py 2018-04-17 12:22:20.682609674 -0400 +@@ -571,7 +571,7 @@ class SpecCheck(AbstractCheck.AbstractCh + try: + ts = rpm.TransactionSet() + spec_obj = ts.parseSpec(self._spec_file) +- except: ++ except rpm.error: + # errors logged above already + pass + if spec_obj: +diff -up rpmlint-rpmlint-1.10/ZipCheck.py.flake rpmlint-rpmlint-1.10/ZipCheck.py +--- rpmlint-rpmlint-1.10/ZipCheck.py.flake 2017-09-05 02:40:05.000000000 -0400 ++++ rpmlint-rpmlint-1.10/ZipCheck.py 2018-04-17 12:22:20.682609674 -0400 +@@ -43,6 +43,10 @@ class ZipCheck(AbstractCheck.AbstractChe + badcrc = z.testzip() + if badcrc: + printError(pkg, 'bad-crc-in-zip', badcrc, fname) ++ except zipfile.error: ++ printWarning(pkg, 'unable-to-read-zip', '%s: %s' % ++ (fname, sys.exc_info()[1])) ++ else: + compressed = False + for zinfo in z.infolist(): + if zinfo.compress_type != zipfile.ZIP_STORED: +@@ -70,9 +74,6 @@ class ZipCheck(AbstractCheck.AbstractChe + if want_indexed_jars: + printWarning(pkg, 'jar-not-indexed', fname) + pass +- except: +- printWarning(pkg, 'unable-to-read-zip', '%s: %s' % +- (fname, sys.exc_info()[1])) + + z and z.close() + diff --git a/SOURCES/rpmlint-1.10-ignore-debuginfo-useless-provides.patch b/SOURCES/rpmlint-1.10-ignore-debuginfo-useless-provides.patch new file mode 100644 index 0000000..8a97bdc --- /dev/null +++ b/SOURCES/rpmlint-1.10-ignore-debuginfo-useless-provides.patch @@ -0,0 +1,36 @@ +From 7f86c79068be1c83303da30f5f4f030080e6326a Mon Sep 17 00:00:00 2001 +From: Dirk Mueller +Date: Sat, 4 Nov 2017 02:24:30 +0100 +Subject: [PATCH] Ignore useless-provides on debuginfo provides (#112) + +Also flip to set's rather than lists as the main operation +here is lookup, so set()s should be faster. +--- + TagsCheck.py | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/TagsCheck.py b/TagsCheck.py +index a8d87aa..dc890b1 100644 +--- a/TagsCheck.py ++++ b/TagsCheck.py +@@ -823,11 +823,13 @@ class TagsCheck(AbstractCheck.AbstractCheck): + + # TODO: should take versions, <, <=, =, >=, > into account here + # https://bugzilla.redhat.com/460872 +- useless_provides = [] ++ useless_provides = set() + for p in prov_names: +- if prov_names.count(p) != 1 and p not in useless_provides: +- useless_provides.append(p) +- for p in useless_provides: ++ if (prov_names.count(p) != 1 and ++ not p.startswith('debuginfo(') and ++ p not in useless_provides): ++ useless_provides.add(p) ++ for p in sorted(useless_provides): + printError(pkg, 'useless-provides', p) + + for p in pkg.provides(): +-- +2.17.0 + diff --git a/SOURCES/rpmlint-1.10-no_python2.patch b/SOURCES/rpmlint-1.10-no_python2.patch new file mode 100644 index 0000000..81cabff --- /dev/null +++ b/SOURCES/rpmlint-1.10-no_python2.patch @@ -0,0 +1,12 @@ +diff -up rpmlint-rpmlint-1.10/TagsCheck.py.no_python2 rpmlint-rpmlint-1.10/TagsCheck.py +--- rpmlint-rpmlint-1.10/TagsCheck.py.no_python2 2019-06-13 11:13:28.506567431 +0200 ++++ rpmlint-rpmlint-1.10/TagsCheck.py 2019-06-13 11:47:12.230644658 +0200 +@@ -433,7 +433,7 @@ oldest_changelog_timestamp = calendar.ti + + private_so_paths = set() + for path in ('%perl_archlib', '%perl_vendorarch', '%perl_sitearch', +- '%python_sitearch', '%python2_sitearch', '%python3_sitearch', ++ '%python3_sitearch', + '%ruby_sitearch', '%php_extdir'): + epath = rpm.expandMacro(path) + if epath and epath != path: diff --git a/SOURCES/rpmlint-1.10-python3.7-pyc-mtime.patch b/SOURCES/rpmlint-1.10-python3.7-pyc-mtime.patch new file mode 100644 index 0000000..a3ccfad --- /dev/null +++ b/SOURCES/rpmlint-1.10-python3.7-pyc-mtime.patch @@ -0,0 +1,196 @@ +From 2bf599d7ed9d4b557b3806fa29439e740cae7f95 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Thu, 1 Mar 2018 17:39:10 +0100 +Subject: [PATCH 1/2] Fix getting pyc mtime on Python 3.7 + +Fixes https://github.com/rpm-software-management/rpmlint/issues/128 +--- + FilesCheck.py | 28 +++++++++++++++++++++++++--- + test/pyc/.gitignore | 1 + + test/pyc/__future__.cpython-36.pyc | Bin 0 -> 4169 bytes + test/pyc/__future__.cpython-37.pyc | Bin 0 -> 4116 bytes + test/test_files.py | 19 +++++++++++++++++++ + tools/Testing.py | 8 ++++++-- + 6 files changed, 51 insertions(+), 5 deletions(-) + create mode 100644 test/pyc/.gitignore + create mode 100644 test/pyc/__future__.cpython-36.pyc + create mode 100644 test/pyc/__future__.cpython-37.pyc + +diff --git a/FilesCheck.py b/FilesCheck.py +index 232a91888..c8666b966 100644 +--- a/FilesCheck.py ++++ b/FilesCheck.py +@@ -379,6 +379,27 @@ def py_demarshal_long(b): + return (b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24)) + + ++def pyc_magic_from_chunk(chunk): ++ """From given chunk (beginning of the file), return Python magic number""" ++ return py_demarshal_long(chunk[:4]) & 0xffff ++ ++ ++def pyc_mtime_from_chunk(chunk): ++ """From given chunk (beginning of the file), return mtime or None ++ ++ From Python 3.7, mtime is not always present. ++ ++ See https://www.python.org/dev/peps/pep-0552/#specification ++ """ ++ magic = pyc_magic_from_chunk(chunk) ++ second = py_demarshal_long(chunk[4:8]) ++ if magic >= _python_magic_values['3.7'][0]: ++ if second == 0: ++ return py_demarshal_long(chunk[8:12]) ++ return None # No mtime saved, TODO check hashes instead ++ return second ++ ++ + def python_bytecode_to_script(path): + """ + Given a python bytecode path, give the path of the .py file +@@ -731,7 +752,7 @@ def check(self, pkg): + if chunk: + # Verify that the magic ABI value embedded in the + # .pyc header is correct +- found_magic = py_demarshal_long(chunk[:4]) & 0xffff ++ found_magic = pyc_magic_from_chunk(chunk) + exp_magic, exp_version = get_expected_pyc_magic(f) + if exp_magic and found_magic not in exp_magic: + found_version = 'unknown' +@@ -754,13 +775,14 @@ def check(self, pkg): + + # Verify that the timestamp embedded in the .pyc + # header matches the mtime of the .py file: +- pyc_timestamp = py_demarshal_long(chunk[4:8]) ++ pyc_timestamp = pyc_mtime_from_chunk(chunk) + # If it's a symlink, check target file mtime. + srcfile = pkg.readlink(files[source_file]) + if not srcfile: + printWarning( + pkg, 'python-bytecode-without-source', f) +- elif pyc_timestamp != srcfile.mtime: ++ elif (pyc_timestamp is not None and ++ pyc_timestamp != srcfile.mtime): + cts = datetime.fromtimestamp( + pyc_timestamp).isoformat() + sts = datetime.fromtimestamp( +diff --git a/test/pyc/.gitignore b/test/pyc/.gitignore +new file mode 100644 +index 000000000..0cc313a69 +--- /dev/null ++++ b/test/pyc/.gitignore +@@ -0,0 +1 @@ ++!*.pyc +diff --git a/test/test_files.py b/test/test_files.py +index 0192c13a5..a209a83a2 100644 +--- a/test/test_files.py ++++ b/test/test_files.py +@@ -1,8 +1,10 @@ + import os ++import pytest + + import FilesCheck + from FilesCheck import python_bytecode_to_script as pbts + from FilesCheck import script_interpreter as se ++from FilesCheck import pyc_magic_from_chunk, pyc_mtime_from_chunk + import Testing + + +@@ -33,6 +35,23 @@ def test_python_bytecode_magic(self): + out = self._rpm_test_output(os.path.join("binary", package)) + assert "python-bytecode-wrong-magic-value" not in "\n".join(out) + ++ @pytest.mark.parametrize('version, magic', ((36, 3379), (37, 3393))) ++ def test_pyc_magic_from_chunk(self, version, magic): ++ path = Testing.getTestedPath("pyc/__future__.cpython-{}.pyc".format(version)) ++ with open(path, 'rb') as f: ++ chunk = f.read(16) ++ assert pyc_magic_from_chunk(chunk) == magic ++ ++ ++class TestPythonBytecodeMtime(object): ++ ++ @pytest.mark.parametrize('version, mtime', ((36, 1513659236), (37, 1519778958))) ++ def test_pyc_mtime_from_chunk(self, version, mtime): ++ path = Testing.getTestedPath("pyc/__future__.cpython-{}.pyc".format(version)) ++ with open(path, 'rb') as f: ++ chunk = f.read(16) ++ assert pyc_mtime_from_chunk(chunk) == mtime ++ + + class TestDevelFiles(Testing.OutputTest): + +diff --git a/tools/Testing.py b/tools/Testing.py +index 34b707931..2b9012701 100644 +--- a/tools/Testing.py ++++ b/tools/Testing.py +@@ -43,13 +43,17 @@ def getOutput(): + return output + + ++def getTestedPath(path): ++ return os.path.join(_testpath(), path) ++ ++ + def getTestedPackage(name): +- pkg_path = glob.glob(os.path.join(_testpath(), name) + "-*.rpm")[0] ++ pkg_path = glob.glob(getTestedPath(name) + "-*.rpm")[0] + return Pkg.Pkg(pkg_path, tempfile.gettempdir()) + + + def getTestedSpecPackage(name): +- pkg_path = glob.glob(os.path.join(_testpath(), name) + ".spec")[0] ++ pkg_path = glob.glob(getTestedPath(name) + ".spec")[0] + return Pkg.FakePkg(pkg_path) + + + +From aba676f98dc3852cf39b459bd6d86bad0450746a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Fri, 2 Mar 2018 10:46:30 +0100 +Subject: [PATCH 2/2] pyc related tests: DRY + +--- + test/test_files.py | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/test/test_files.py b/test/test_files.py +index a209a83a2..c6a162c5d 100644 +--- a/test/test_files.py ++++ b/test/test_files.py +@@ -24,6 +24,13 @@ def test_pep0488(self): + assert pbts("/usr/lib/python3.5/site-packages/__pycache__/pytest.cpython-35.pyc") == "/usr/lib/python3.5/site-packages/pytest.py" + + ++def chunk_from_pyc(version, size=16): ++ """Helper to get start of an example pyc file as bytes""" ++ path = Testing.getTestedPath("pyc/__future__.cpython-{}.pyc".format(version)) ++ with open(path, 'rb') as f: ++ return f.read(size) ++ ++ + class TestPythonBytecodeMagic(Testing.OutputTest): + + @classmethod +@@ -37,9 +44,7 @@ def test_python_bytecode_magic(self): + + @pytest.mark.parametrize('version, magic', ((36, 3379), (37, 3393))) + def test_pyc_magic_from_chunk(self, version, magic): +- path = Testing.getTestedPath("pyc/__future__.cpython-{}.pyc".format(version)) +- with open(path, 'rb') as f: +- chunk = f.read(16) ++ chunk = chunk_from_pyc(version) + assert pyc_magic_from_chunk(chunk) == magic + + +@@ -47,9 +52,7 @@ class TestPythonBytecodeMtime(object): + + @pytest.mark.parametrize('version, mtime', ((36, 1513659236), (37, 1519778958))) + def test_pyc_mtime_from_chunk(self, version, mtime): +- path = Testing.getTestedPath("pyc/__future__.cpython-{}.pyc".format(version)) +- with open(path, 'rb') as f: +- chunk = f.read(16) ++ chunk = chunk_from_pyc(version) + assert pyc_mtime_from_chunk(chunk) == mtime + + diff --git a/SOURCES/rpmlint-1.10-rpm_surrogate_escaped_utf8.patch b/SOURCES/rpmlint-1.10-rpm_surrogate_escaped_utf8.patch new file mode 100644 index 0000000..6fe388f --- /dev/null +++ b/SOURCES/rpmlint-1.10-rpm_surrogate_escaped_utf8.patch @@ -0,0 +1,30 @@ +diff -up rpmlint-rpmlint-1.10/Pkg.py.rpm_surrogate_escaped_utf8 rpmlint-rpmlint-1.10/Pkg.py +--- rpmlint-rpmlint-1.10/Pkg.py.rpm_surrogate_escaped_utf8 2019-06-13 12:17:33.339937352 +0200 ++++ rpmlint-rpmlint-1.10/Pkg.py 2019-06-13 13:37:37.076702548 +0200 +@@ -164,12 +164,20 @@ def is_utf8(fname): + + + def is_utf8_bytestr(s): +- try: +- s.decode('UTF-8') +- except UnicodeError: +- return False +- return True +- ++ if isinstance(s, str): ++ try: ++ s.encode("utf8") ++ except UnicodeEncodeError: ++ return False ++ else: ++ return True ++ else: ++ try: ++ s.decode('UTF-8') ++ except UnicodeError: ++ return False ++ else: ++ return True + + def to_unicode(string): + if string is None: diff --git a/SOURCES/rpmlint-1.10-update-crypto-example.patch b/SOURCES/rpmlint-1.10-update-crypto-example.patch new file mode 100644 index 0000000..e8c20b1 --- /dev/null +++ b/SOURCES/rpmlint-1.10-update-crypto-example.patch @@ -0,0 +1,20 @@ +diff -up rpmlint-rpmlint-1.10/config.orig rpmlint-rpmlint-1.10/config +--- rpmlint-rpmlint-1.10/config.orig 2017-09-05 08:40:05.000000000 +0200 ++++ rpmlint-rpmlint-1.10/config 2020-06-04 15:43:14.135492613 +0200 +@@ -230,7 +230,7 @@ from Config import * + #'''This application package calls a function to explicitly set crypto ciphers + #for SSL/TLS. That may cause the application not to use the system-wide set + #cryptographic policy and should be modified in accordance to: +-#https://fedoraproject.org/wiki/Packaging:CryptoPolicies''' ++#https://docs.fedoraproject.org/en-US/packaging-guidelines/CryptoPolicies/''' + # + #call_blacklist = {'crypto-policy-non-compliance-openssl' : + # {'f_name' : 'SSL_CTX_set_cipher_list', +@@ -242,6 +242,7 @@ from Config import * + # 'description' : bad_crypto_warning}, + # 'crypto-policy-non-compliance-gnutls-2' : + # {'f_name' : 'gnutls_priority_init', ++# 'good_param' : '^@SYSTEM$', + # 'description' : bad_crypto_warning} + # } + #setOption("WarnOnFunction", call_blacklist) diff --git a/SOURCES/rpmlint-etc.config b/SOURCES/rpmlint-etc.config new file mode 100644 index 0000000..5f670ac --- /dev/null +++ b/SOURCES/rpmlint-etc.config @@ -0,0 +1,2 @@ +# Add local system wide rpmlint configuration here or in other *config files +# in this directory. diff --git a/SOURCES/rpmlint.config b/SOURCES/rpmlint.config new file mode 100644 index 0000000..485019b --- /dev/null +++ b/SOURCES/rpmlint.config @@ -0,0 +1,478 @@ +# -*- python -*- + +# System wide rpmlint default configuration. Do not modify, override/add +# options in /etc/rpmlint/config and/or ~/.rpmlintrc as needed. + +import os.path +import re +import sys + +from Config import * +import Pkg + + +setOption("CompressExtension", "gz") +setOption("DefaultPythonVersion", sys.version[:3]) +setOption("KernelModuleRPMsOK", False) +setOption("MaxLineLength", 80) +setOption("NetworkEnabled", True) +setOption("ReleaseExtension", r'\.(fc|rhe?l|el)\d+(?=\.|$)') +setOption("UseDebugSource", True) +setOption("UseDefaultRunlevels", False) +setOption("UseEpoch", False) +setOption("UseUTF8", True) +setOption("UseVersionInChangeLog", True) +setOption("ValidSrcPerms", (int("664",8), int("644",8), )) + +setOption("ValidShells", ( + "", + "/bin/sh", + "/bin/bash", + "/sbin/ldconfig", + "/usr/bin/perl", + "/usr/bin/python3", + "/usr/libexec/platform-python", +)) + +setOption("DanglingSymlinkExceptions", ( + ['consolehelper$', 'usermode'], + ['consolehelper-gtk$', 'usermode-gtk'], +)) + +setOption("ValidLicenses", ( + # These are the short names for all of the Fedora approved licenses. + # The master list is kept here: http://fedoraproject.org/wiki/Licensing + # Last synced with revision "2.36, 18 April 2017" of that page. + 'AAL', + 'Abstyles', + 'Adobe', + 'ADSL', + 'AFL', + 'Afmparse', + 'AGPLv1', + 'AGPLv3', + 'AGPLv3+', + 'AGPLv3 with exceptions', + 'AMDPLPA', + 'AML', + 'AMPAS BSD', + 'APAFML', + 'App-s2p', + 'APSL 2.0', + 'APSL 2.0+', + 'ARL', + 'Artistic 2.0', + 'Artistic clarified', + 'ASL 1.0', + 'ASL 1.0+', + 'ASL 1.1', + 'ASL 1.1+', + 'ASL 2.0', + 'ASL 2.0+', + 'Bahyph', + 'Barr', + 'Beerware', + 'BeOpen', + 'Bibtex', + 'BitTorrent', + 'Boost', + 'Borceux', + 'BSD', + 'BSD Protection', + 'BSD with advertising', + 'BSD with attribution', + 'CATOSL', + 'CC0', + 'CeCILL', + 'CeCILL-B', + 'CeCILL-C', + 'CDDL', + 'CNRI', + 'Condor', + 'Copyright only', + 'CPAL', + 'CPL', + 'CRC32', + 'Crossword', + 'Crystal Stacker', + 'Cube', + 'diffmark', + 'DMIT', + 'DOC', + 'Dotseqn', + 'DSDP', + 'dvipdfm', + 'DWPL', + 'ECL 1.0', + 'ECL 2.0', + 'eCos', + 'EFL 2.0', + 'EFL 2.0+', + 'eGenix', + 'Entessa', + 'EPICS', + 'EPL', + 'ERPL', + 'EU Datagrid', + 'EUPL 1.1', + 'Eurosym', + 'Fair', + 'FSFUL', + 'FSFULLR', + 'FTL', + 'Giftware', + 'GL2PS', + 'Glide', + 'Glulxe', + 'gnuplot', + 'GPL+', + 'GPL+ or Artistic', + 'GPL+ with exceptions', + 'GPLv1', + 'GPLv2 or Artistic', + 'GPLv2+ or Artistic', + 'GPLv2', + 'GPLv2 with exceptions', + 'GPLv2+', + 'GPLv2+ with exceptions', + 'GPLv3', + 'GPLv3 with exceptions', + 'GPLv3+', + 'GPLv3+ with exceptions', + 'HaskellReport', + 'HSRL', + 'IBM', + 'IJG', + 'ImageMagick', + 'iMatix', + 'Imlib2', + 'Intel ACPI', + 'Interbase', + 'ISC', + 'Jabber', + 'JasPer', + 'JPython', + 'Julius', + 'Knuth', + 'Latex2e', + 'LBNL BSD', + 'Leptonica', + 'LGPLv2', + 'LGPLv2 with exceptions', + 'LGPLv2+', + 'LGPLv2+ or Artistic', + 'LGPLv2+ with exceptions', + 'LGPLv3', + 'LGPLv3 with exceptions', + 'LGPLv3+', + 'LGPLv3+ with exceptions', + 'Lhcyr', + 'libtiff', + 'LLGPL', + 'Logica', + 'LOSLA', + 'LPL', + 'LPPL', + 'MakeIndex', + 'mecab-ipadic', + 'midnight', + 'MirOS', + 'MIT', + 'MITNFA', + 'MIT with advertising', + 'mod_macro', + 'Motosoto', + 'MPLv1.0', + 'MPLv1.0+', + 'MPLv1.1', + 'MPLv1.1+', + 'MPLv2.0', + 'MS-PL', + 'MS-RL', + 'MTLL', + 'Mup', + 'Naumen', + 'NCSA', + 'NetCDF', + 'Netscape', + 'Newmat', + 'Newsletr', + 'NGPL', + 'NLPL', + 'Nmap', + 'Nokia', + 'NOSL', + 'Noweb', + 'OGL', + 'OML', + 'OpenLDAP', + 'OpenPBS', + 'OpenSSL', + 'OReilly', + 'OSL 1.0', + 'OSL 1.0+', + 'OSL 1.1', + 'OSL 1.1+', + 'OSL 2.0', + 'OSL 2.0+', + 'OSL 2.1', + 'OSL 2.1+', + 'OSL 3.0', + 'OSL 3.0+', + 'Par', + 'Phorum', + 'PHP', + 'PlainTeX', + 'Plexus', + 'PostgreSQL', + 'psfrag', + 'psutils', + 'Public Domain', + 'Python', + 'Qhull', + 'QPL', + 'Rdisc', + 'REX', + 'RiceBSD', + 'Romio', + 'RPSL', + 'Rsfs', + 'Ruby', + 'Saxpath', + 'SCEA', + 'SCRIP', + 'Sendmail', + 'Sleepycat', + 'SISSL', + 'SLIB', + 'SNIA', + 'softSurfer', + 'SPL', + 'STMPL', + 'SWL', + 'TCGL', + 'TCL', + 'Teeworlds', + 'TGPPL', + 'TGPPL with exceptions', + 'Threeparttable', + 'TMate', + 'Tolua', + 'TORQUEv1.1', + 'TOSL', + 'TPDL', + 'TPL', + 'TTWL', + 'UCAR', + 'UCD', + 'Unicode', + 'Unlicense', + 'Vim', + 'VNLSL', + 'VOSTROM', + 'VSL', + 'W3C', + 'Webmin', + 'Wsuipa', + 'WTFPL', + 'wxWidgets', + 'Xerox', + 'xinetd', + 'xpp', + 'XSkat', + 'YPLv1.1', + 'Zed', + 'Zend', + 'zlib', + 'zlib with acknowledgement', + 'ZPLv1.0', + 'ZPLv1.0+', + 'ZPLv2.0', + 'ZPLv2.0+', + 'ZPLv2.1', + 'ZPLv2.1+', + # Documentation licenses + 'CDL', + 'FBSDDL', + 'GFDL', + 'IEEE', + 'LDPL', + 'OFSFDL', + 'Open Publication', + 'Public Use', + 'Verbatim', + # Content licenses + 'CC-BY', + 'CC-BY-ND', + 'CC-BY-SA', + 'DMTF', + 'DSL', + 'EFML', + 'Free Art', + 'GeoGratis', + 'Green OpenMusic', + 'OAL', + # Font licenses + 'AMS', + 'Arphic', + 'Baekmuk', + 'Bitstream Vera', + 'DoubleStroke', + 'Hershey', + 'IPA', + 'Liberation', + 'Lucida', + 'MgOpen', + 'mplus', + 'OFL', + 'PTFL', + 'STIX', + 'Utopia', + 'Wadalab', + 'XANO', + # Others + 'Redistributable, no modification permitted', + 'Freely redistributable without restriction', +)) + +setOption('SystemLibPaths', ('/lib', '/lib64', '/usr/lib', '/usr/lib64')) + +# Add systemd dir to ignored path for UsrLibBinaryException +setOption('UsrLibBinaryException', r'^/usr/lib(64)?/(perl|python|ruby|menu|pkgconfig|ocaml|systemd|lib[^/]+\.(so|l?a)$|\.build-id)') + +# Get standard users and groups from the setup package's uidgid file +setOption('StandardUsers', []) +setOption('StandardGroups', []) +setup_pkg = None +try: + setup_pkg = Pkg.InstalledPkg('setup') +except: + pass +if setup_pkg: + users = set() + groups = set() + uidgid_regex = re.compile(r'^\s*(\S+)\s+(-|\d+)\s+(-|\d+|\(\d+\))\s') + for uidgid_file in [x for x in setup_pkg.files() if x.endswith('/uidgid')]: + if os.path.exists(uidgid_file): + fobj = open(uidgid_file) + try: + for line in fobj.read().strip().splitlines(): + res = uidgid_regex.search(line) + if res: + name = res.group(1) + if res.group(2) != '-': + users.add(name) + if res.group(3) != '-' and not '(' in res.group(3): + groups.add(name) + del res + del line + finally: + fobj.close() + del fobj + setOption('StandardUsers', sorted(users)) + setOption('StandardGroups', sorted(groups)) + del uidgid_regex, uidgid_file, users, groups +del setup_pkg + +# Output filters +addFilter("source-or-patch-not-compressed") +addFilter("%mklibname") +addFilter("no-dependency-on (perl|python)-base") +addFilter("no-dependency-on locales-") +addFilter("(python|perl5)-naming-policy-not-applied") +addFilter("no-(packager-tag|signature)") +addFilter("incoherent-version-in-name") +addFilter("invalid-build-requires") +addFilter("ghost-files-without-postin") +addFilter("postin-without-ghost-file-creation") +addFilter("no-major-in-name") +addFilter("no-provides") +addFilter("executable-in-library-package") +addFilter("non-versioned-file-in-library-package") +addFilter("requires-on-release") +addFilter("jar-not-indexed") +addFilter("outside-libdir-files") +addFilter("-debuginfo.* no-documentation") +addFilter("-debuginfo.* /usr/lib/debug/") +addFilter("non-standard-dir-in-usr libexec") +addFilter("^gpg-pubkey:") +addFilter(" doc-file-dependency .* /bin/sh$") +addFilter("hardcoded-library-path .*/lib/udev(/|$)") +addFilter("not-standard-release-extension") +addFilter("explicit-lib-dependency (liberation-fonts|libertas-.*-firmware|libvirt$|.*-(java|python)$)") +addFilter("explicit-lib-dependency (python-.*lib.*|python2-.*lib.*|python3-.*lib.*)$") +addFilter("filename-too-long-for-joliet") +addFilter("symlink-should-be-") +addFilter(r"dangling-\S*symlink /usr/share/doc/HTML/\S+/common .+/common$") +addFilter(r"hidden-file-or-dir .*/man5/\.k5login\.5[^/]+$") +addFilter(r"blender.+ (wrong-script-interpreter|non-executable-script) .+/blender/.+\.py.*BPY.*") +# Fedora 12 and newer no longer need a buildroot defined, to have the buildroot cleaned at the beginning +# of %install, and do not need to define a %clean section unless the default is invalid. +addFilter("no-cleaning-of-buildroot") +addFilter("no-buildroot-tag") +addFilter("no-%clean-section") +# Only EL4 needs the files-attr-not-set check, because rpm 4.4 and newer no longer need a %defattr line +# (it automatically provides one). +addFilter("files-attr-not-set") +# Don't bother with the non-ghost-in-var-(lock|run) checks on Fedora 15 or newer +# since they have tmpfs /var/lock and /var/run. +addFilter("non-ghost-in-var-lock") +addFilter("non-ghost-in-var-run") +# Someone thought it was a good idea to make .desktop files executable. They were wrong. +# Nevertheless, I do not yet control the universe, so we squelch the error here. +addFilter(r"script-without-shebang .*\.desktop$") +# Some files in /etc/ are not meant to be modified by the sysadmin +addFilter("non-conffile-in-etc /etc/rpm/.*$") +addFilter("non-conffile-in-etc /etc/rc.d/init.d/.*$") +# Fixed in rpm >= 4.7.1 +addFilter("broken-syntax-in-scriptlet-requires") +# Files that are intentionally not supposed to be readable +# Contains passwords +addFilter("non-readable /etc/ovirt-engine/isouploader.conf") +# Ignore webservers which are just broken. +addFilter(r"invalid-url .*\.googlecode\.com/.*HTTP Error 404") +addFilter(r"invalid-url .*\.jboss\.org/.*HTTP Error 403") +addFilter(r"invalid-url .*bitbucket\.org/.*HTTP Error 403") +addFilter(r"invalid-url .*github\.com/.*HTTP Error 403") +# Don't care about long descriptions on debuginfo packages +# They automatically include the package name and are always +# quite long. +addFilter("-debuginfo.* description-line-too-long") +# ignore "common" jargon words +# https://bugzilla.redhat.com/show_bug.cgi?id=1424684#c9 +addFilter(r"spelling-error.* \b(runtime|Runtime|metadata|cryptographic|multi|linux|filesystem|filesystems|backend|backends|userspace|addon|wayland|Wayland|util|utils|lossless|virtualization|toolkits|libvirtd|crypto|glyphs|GStreamer|http|extensibility|codec|codecs|truetype|scalable|pluggable|pixbuf|Kerberos|customizable|bitstream|tcp|libXss|libs|libc|encodings|GLib|udev|posix|libpng|glapi|gbm|freedesktop|spi|realtime|preprocessor|libaudit|hypervisor|embeddable|distributable|devel|config|cairo|bootloader|adaptors|pragma|passphrase|malloc|libvirt|libmagic|io|datetime|boolean|argparse|py|pinentry|namespace|middleware|lowlevel|libxcb|libudev|libsoup|libgcrypt|libcom|iSCSI|initramfs|GObject|executables|dialogs|checkpolicy|bitmapped|assistive)\b") +# Fedora no longer uses explicit ldconfig %post/%postun as of Fedora 28 +addFilter("library-without-ldconfig-postin") +addFilter("library-without-ldconfig-postun") + + +bad_crypto_warning = \ +'''This application package calls a function to explicitly set crypto ciphers +for SSL/TLS. That may cause the application not to use the system-wide set +cryptographic policy and should be modified in accordance to: +https://docs.fedoraproject.org/en-US/packaging-guidelines/CryptoPolicies/''' + +call_blacklist = {'crypto-policy-non-compliance-openssl' : + {'f_name' : 'SSL_CTX_set_cipher_list', + 'good_param' : '^PROFILE=SYSTEM$', + 'description' : bad_crypto_warning}, + 'crypto-policy-non-compliance-gnutls-1' : + {'f_name' : 'gnutls_priority_set_direct', + 'good_param' : '^@SYSTEM$', + 'description' : bad_crypto_warning}, + 'crypto-policy-non-compliance-gnutls-2' : + {'f_name' : 'gnutls_priority_init', + 'good_param' : '^@SYSTEM$', + 'description' : bad_crypto_warning} + } +setOption("WarnOnFunction", call_blacklist) + +# https://bugzilla.redhat.com/496737, https://bugzilla.redhat.com/646455 +for pkg, exe in (("coreutils", "/bin/su"), + ("krb5-workstation", "/usr/kerberos/bin/ksu"), + ("passwd", "/usr/bin/passwd"), + ("sudo", "/usr/bin/sudo(edit)?"), + ("upstart", "/sbin/initctl"), + ("usermode", "/usr/sbin/userhelper")): + addFilter("%s.* (setuid-binary|non-standard-executable-perm) %s (root )?04" + % (pkg, exe)) diff --git a/SOURCES/rpmlint.config.el4 b/SOURCES/rpmlint.config.el4 new file mode 100644 index 0000000..8c647d7 --- /dev/null +++ b/SOURCES/rpmlint.config.el4 @@ -0,0 +1,28 @@ +# -*- python -*- + +# System wide rpmlint default configuration. Do not modify, override/add +# options in /etc/rpmlint/config and/or ~/.rpmlintrc as needed. + +import os.path +import re +import sys + +from Config import * +import Pkg + +# Inherit the base config and build from there. +exec(open("/usr/share/rpmlint/config","rb").read()) + +# Fedora 12 and newer no longer need a buildroot defined, to have the buildroot cleaned at the beginning +# of %install, and do not need to define a %clean section unless the default is invalid. +# However, EL-4 and EL-5 still need these checks. +removeFilter("no-cleaning-of-buildroot") +removeFilter("no-buildroot-tag") +removeFilter("no-%clean-section") + +# Only EL4 needs the files-attr-not-set check, because rpm 4.4 and newer no longer need a %defattr line +# (it automatically provides one). +removeFilter("files-attr-not-set") + +# Fixed in rpm >= 4.7.1 +removeFilter("broken-syntax-in-scriptlet-requires") diff --git a/SOURCES/rpmlint.config.el5 b/SOURCES/rpmlint.config.el5 new file mode 100644 index 0000000..ae22617 --- /dev/null +++ b/SOURCES/rpmlint.config.el5 @@ -0,0 +1,24 @@ +# -*- python -*- + +# System wide rpmlint default configuration. Do not modify, override/add +# options in /etc/rpmlint/config and/or ~/.rpmlintrc as needed. + +import os.path +import re +import sys + +from Config import * +import Pkg + +# Inherit the base config and build from there. +exec(open("/usr/share/rpmlint/config","rb").read()) + +# Fedora 12 and newer no longer need a buildroot defined, to have the buildroot cleaned at the beginning +# of %install, and do not need to define a %clean section unless the default is invalid. +# However, EL-4 and EL-5 still need these checks. +removeFilter("no-cleaning-of-buildroot") +removeFilter("no-buildroot-tag") +removeFilter("no-%clean-section") + +# Fixed in rpm >= 4.7.1 +removeFilter("broken-syntax-in-scriptlet-requires") diff --git a/SPECS/rpmlint.spec b/SPECS/rpmlint.spec new file mode 100644 index 0000000..0001389 --- /dev/null +++ b/SPECS/rpmlint.spec @@ -0,0 +1,518 @@ +%if 0%{?fedora} || 0%{?rhel} > 7 +%bcond_without python3 +%else +%bcond_with python3 +%endif + +%if %{with python3} +%global python %{__python3} +%global pytest %(ls -1 %{_bindir}/py.test-3* | tail -n 1) +# The flake8 packages will be removed from non-modular RHEL +#global flake8 python3-flake8 +%global flake8 true +%else +%global python %{__python} +%global pytest py.test +%global flake8 flake8 +%endif + +Name: rpmlint +Version: 1.10 +Release: 15%{?dist} +Summary: Tool for checking common errors in RPM packages +Group: Development/Tools +License: GPLv2 +URL: https://github.com/rpm-software-management/rpmlint +Source0: https://github.com/rpm-software-management/rpmlint/archive/rpmlint-%{version}.tar.gz +Source1: %{name}.config +Source3: %{name}-etc.config +# EL-4 specific config +Source4: %{name}.config.el4 +# EL-5 specific config +Source5: %{name}.config.el5 +# https://github.com/rpm-software-management/rpmlint/commit/e739876 +Patch0: rpmlint-1.10-ignore-debuginfo-useless-provides.patch +# https://github.com/rpm-software-management/rpmlint/commit/b748e6fadb8e68df2aa679ccf62822ad56577b80 +# https://github.com/rpm-software-management/rpmlint/commit/c1945e37e2989364c5caedc05aa429a5c2d39f4d +# https://github.com/rpm-software-management/rpmlint/commit/f267bf1c60d067436b360c68d8e956876758b268 +Patch1: rpmlint-1.10-flake-cleanups.patch +Patch2: rpmlint-1.10-no_python2.patch +Patch3: rpmlint-1.10-fix_test.patch +Patch4: rpmlint-1.10-rpm_surrogate_escaped_utf8.patch +Patch5: rpmlint-1.10-update-crypto-example.patch +# https://github.com/rpm-software-management/rpmlint/commit/e52dcc73bab5c4310e9bb773e6aedea020e340ff +Patch6: rpmlint-1.10-python3.7-pyc-mtime.patch +# binary files from the above +Source61: __future__.cpython-36.pyc +Source62: __future__.cpython-37.pyc +BuildArch: noarch +%if %{with python3} +%if 0%{?rhel} > 7 +BuildRequires: python3-devel +BuildRequires: rpm-python3 >= 4.4.2.2 +%else +BuildRequires: python3-devel +BuildRequires: rpm-python3 >= 4.4.2.2 +%endif +BuildRequires: python3-pytest +#BuildRequires: python3-flake8-import-order +%{?__python3:Requires: %{__python3}} +Requires: rpm-python3 >= 4.4.2.2 +%else +BuildRequires: python >= 2.6 +BuildRequires: rpm-python >= 4.4.2.2 +BuildRequires: pytest +#BuildRequires: python2-flake8-import-order +Requires: python >= 2.6 +Requires: rpm-python >= 4.4.2.2 +%endif +BuildRequires: sed >= 3.95 +BuildRequires: bash-completion +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. +%if %{with python3} +Requires: python3-magic +Requires: python3-enchant +%else +Requires: python-magic +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 + +%description +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} +%patch0 -p1 -b .debuginfo-useless-provides +%patch1 -p1 -b .flake +%patch2 -p1 -b .no_python2 +%patch3 -p1 -b .fix_test +%patch4 -p1 -b .rpm_surrogate_escaped_utf8 +%patch5 -p1 -b .update_crypto_example +%patch6 -p1 -b .python3.7-pyc-mtime +cp -p %{SOURCE61} %{SOURCE62} test/pyc/ +sed -i -e /MenuCheck/d Config.py +cp -p config config.example +install -pm 644 %{SOURCE3} config + + +%build +make COMPILE_PYC=1 PYTHON=%{python} + + +%install +touch rpmlint.pyc rpmlint.pyo # just for the %%exclude to work everywhere +make install DESTDIR=$RPM_BUILD_ROOT ETCDIR=%{_sysconfdir} MANDIR=%{_mandir} \ + LIBDIR=%{_datadir}/rpmlint BINDIR=%{_bindir} PYTHON=%{python} +install -pm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/rpmlint/config + +install -pm 644 %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}/rpmlint/config.el4 +install -pm 644 %{SOURCE5} $RPM_BUILD_ROOT%{_datadir}/rpmlint/config.el5 +pushd $RPM_BUILD_ROOT%{_bindir} +ln -s rpmlint el4-rpmlint +ln -s rpmlint el5-rpmlint +popd +rm -rf %{buildroot}%{_sysconfdir}/bash_completion.d/ + + +%check +make check PYTHON=%{python} PYTEST=%{pytest} FLAKE8=%{flake8} + + +%files +%license COPYING +%doc README.md config.example +%config(noreplace) %{_sysconfdir}/rpmlint/ +%{_datadir}/bash-completion/completions/ +%{_bindir}/rpmdiff +%{_bindir}/el*-rpmlint +%{_bindir}/rpmlint +%{_datadir}/rpmlint/ +%{_mandir}/man1/rpmdiff.1* +%{_mandir}/man1/rpmlint.1* + +%changelog +* Fri Jan 05 2024 Miro Hrončok - 1.10-15 +- Correctly load .pyc mtime for Python 3.7+ bytecode cache + (RHEL-20900) + +* Thu Jun 04 2020 Michal Domonkos - 1.10-14 +- Update crypto warnings in config file to reflect current Fedora policy + (RHBZ#1797545) + +* Fri Jun 14 2019 Thomas Woerner - 1.10.13.2 +- Handle rpm change to return surrogate-escaped utf-8 python strings + (RHBZ#1693712) + +* Thu Jun 13 2019 Thomas Woerner - 1.10.13.1 +- Fix unit test: use platform-python, py.test-3, no flake8 (RHBZ#1576803) +- Update of ValidShells (RHBZ#1633698) +- Remove Python2 paths from TagsCheck.py (RHBZ#1633698) +- Enable bash-competion scripts (RHBZ#1577890) + +* Thu Sep 20 2018 Tomas Orsava - 1.10-13 +- Require the Python interpreter directly instead of using the package name +- Related: rhbz#1619153 + +* Mon Jun 25 2018 Petr Viktorin - 1.10-12 +- Remove the flake8 build dependency + +* Tue Apr 17 2018 Tom Callaway - 1.10-11 +- disable library-without-ldconfig-postin/postun checks (F28+) + +* Tue Apr 17 2018 Tom Callaway - 1.10-10 +- fix flake errors (merge upstream changes) + +* Mon Apr 16 2018 Todd Zullinger - 1.10-9 +- Update UsrLibBinaryException config to include .build-id +- Ignore useless-provides on debuginfo provides (bz1489096) + +* Sun Mar 04 2018 Till Maas - 1.10-8 +- Update URL (RH #1547150) + +* Fri Feb 09 2018 Fedora Release Engineering - 1.10-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Mon Jan 15 2018 Karsten Hopp - 1.10-6 +- fix python3 conditional + +* Sun Oct 29 2017 Tom Callaway - 1.10-5 +- ignore common jargon words in spellcheck + +* Sun Oct 29 2017 Tom Callaway - 1.10-4 +- fix SSL_CTX_set_cipher_list waiver +- use raw strings in config file to silence python3 deprecation warnings + +* Mon Sep 11 2017 Tom Callaway - 1.10-3 +- use correct config file option for debugsource + +* Fri Sep 8 2017 Tom Callaway - 1.10-2 +- update config file to reflect new licenses and to ignore devel files in debugsource packages + +* Tue Sep 5 2017 Tom Callaway - 1.10-1 +- update to 1.10 + +* Thu Jul 27 2017 Fedora Release Engineering - 1.9-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon Jul 17 2017 Tom Callaway - 1.9-11 +- apply upstream fix for buildid + +* Thu Jul 13 2017 Petr Pisar - 1.9-10 +- perl dependency renamed to perl-interpreter + + +* 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 + +* Wed Feb 8 2017 Tom Callaway - 1.9-7 +- apply upstream fix to not demand versioned filename Provides/Obsoletes + +* Thu Dec 29 2016 Adam Williamson - 1.9-6 +- Update Python 3.6 magic bytecode value (github PR #7) + +* Tue Dec 13 2016 Charalampos Stratakis - 1.9-5 +- Rebuild for Python 3.6 + +* Mon Oct 24 2016 Orion Poplawski - 1.9-4 +- Use %%license +- BR python-flake8-import-order for tests + +* Fri Aug 26 2016 Tom Callaway - 1.9-3 +- ignore long description lines for debuginfo packages + +* Mon Jul 25 2016 Tom Callaway - 1.9-2 +- fix 403 ignore rule for github to be more complete (bz1359582) + +* Wed Jul 6 2016 Tom Callaway - 1.9-1 +- update to 1.9 + +* Tue Jun 14 2016 Tom Callaway - 1.8-7 +- ignore explicit-lib-dependency on python subpackages with "lib" +- update license list + +* Mon Apr 18 2016 Tom Callaway - 1.8-6 +- update license list +- add github.com to the filter ignore list for 403 errors (bz1326855) + +* Thu Feb 04 2016 Fedora Release Engineering - 1.8-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Nov 10 2015 Fedora Release Engineering - 1.8-3 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Mon Sep 28 2015 Tom Callaway - 1.8-2 +- fix issue in config regex causing bitbucket URLs to slip through invalid-url filter + +* Fri Sep 25 2015 Tom Callaway - 1.8-1 +- 1.8 +- add bad crypto warning to config file +- update license list + +* Fri Jul 10 2015 Tom Callaway - 1.7-1 +- 1.7 +- add python conditionals + +* Thu Jun 18 2015 Fedora Release Engineering - 1.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Fri May 29 2015 Tom Callaway - 1.6-3 +- filter out failure from broken webservers +- add new licenses + +* Tue Dec 9 2014 Tom Callaway - 1.6-2 +- update license list in config file + +* Thu Sep 4 2014 Tom Callaway - 1.6-1 +- update to 1.6 + +* Wed Jun 25 2014 Tom Callaway - 1.5-12 +- add systemd to UsrLibBinaryException + +* Sun Jun 08 2014 Fedora Release Engineering - 1.5-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Thu May 29 2014 Tom Callaway - 1.5-10 +- fix python 3.4 magic number (#1102846) + +* Mon May 12 2014 Tom Callaway - 1.5-9 +- update config to ignore non-readable /etc/ovirt-engine/isouploader.conf + +* Mon Feb 10 2014 Tom Callaway - 1.5-8 +- filter out broken-syntax-in-scriptlet-requires (except on el4/5) +- update license list + +* Sun Feb 9 2014 Ville Skyttä - 1.5-7 +- Make default config Python 3 compatible. + +* Thu Dec 12 2013 Tom Callaway - 1.5-6 +- fix unicode naming bug (bz 1036310) + +* Mon Nov 11 2013 Tom Callaway - 1.5-5 +- do not modify sys.argv[0] (bz 1026333) +- fix unbound var in MenuXDGCheck.py (bz 1026328) + +* Wed Oct 9 2013 Tom Callaway - 1.5-4 +- Fix handling of Exec= with an absolute path (bz991278) +- Update license list, add AGPLv3+ (bz894187) + +* Tue Aug 6 2013 Thomas Woerner - 1.5-3 +- Fixed URL and Source0, now using sourceforge.net + +* Sun Aug 04 2013 Fedora Release Engineering - 1.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Fri May 17 2013 Tom Callaway - 1.5-1 +- update to 1.5 + +* Mon Apr 1 2013 Tom Callaway - 1.4-14 +- explicitly Require: perl (bz919865) +- fix lua binary detection (bz919869) + +* Wed Mar 6 2013 Tom Callaway - 1.4-13 +- update license list +- exclude non-config files that live in /etc + +* Thu Feb 14 2013 Fedora Release Engineering - 1.4-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Tue Nov 6 2012 Tom Callaway - 1.4-11 +- add Requires: %%{_bindir}/groff for man page checks (bz 873448) + +* Thu Sep 6 2012 Tom Callaway - 1.4-10 +- fix handling of ruby RI files as text files (they are binary files) +- apply upstream fix for macro regexp + +* Tue Sep 4 2012 Thomas Woerner - 1.4-9 +- fix build for RHEL: no bash-completion + +* Tue Aug 14 2012 Tom Callaway - 1.4-8 +- add magic number fix for python 3 (bz845972) +- update license list + +* Sat Jul 21 2012 Fedora Release Engineering - 1.4-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jan 23 2012 Toshio Kuratomi - 1.4-6 +- Patch to fix messages that contain unicode summaries + https://bugzilla.redhat.com/show_bug.cgi?id=783912 + +* Sat Jan 14 2012 Fedora Release Engineering - 1.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Dec 15 2011 Tom Callaway - 1.4-4 +- Do not throw an error on .desktop files set +x. (bz 767978) + +* Mon Dec 5 2011 Tom Callaway - 1.4-3 +- own %%{_datadir}/bash-completion/ (thanks Ville Skyttä) + +* Mon Dec 5 2011 Tom Callaway - 1.4-2 +- add BR: bash-completion for the pc file + +* Mon Dec 5 2011 Tom Callaway - 1.4-1 +- update to 1.4 + +* Wed Oct 12 2011 Tom Callaway - 1.3-2 +- apply upstream fix for false error on checking ghosted man pages for + encoding (bz745446) +- update config to reflect new licenses (bz741298) + +* Tue Jul 12 2011 Tom Callaway - 1.3-1 +- update to 1.3 + +* Sun Apr 24 2011 Tom Callaway - 1.2-1 +- update to 1.2 +- filter away files-attr-not-set for all targets except EL-4 (bz694579) + +* Thu Mar 3 2011 Tom Callaway - 1.1-3 +- apply upstream fix for source url aborts (bz 680781) + +* Wed Feb 09 2011 Fedora Release Engineering - 1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Fri Feb 4 2011 Tom Callaway - 1.1-1 +- update to 1.1 + +* Tue Dec 7 2010 Tom "spot" Callaway - 1.0-3 +- fix typo in changelog +- %% comment out item in changelog +- simplify el4/el5 config files (thanks to Ville Skyttä) + +* Mon Dec 6 2010 Tom "spot" Callaway - 1.0-2 +- add support for el4-rpmlint, el5-rpmlint +- disable no-cleaning-of-buildroot checks for Fedora +- disable no-buildroot-tag check for Fedora +- disable no-%%clean-section check for Fedora + +* Mon Nov 1 2010 Ville Skyttä - 1.0-1 +- Update to 1.0; fixes #637956, and #639823. +- Sync Fedora license list with Wiki revision 1.85. +- Whitelist more expectedly setuid executables; fixes #646455. + +* Thu Aug 19 2010 Ville Skyttä - 0.99-1 +- Update to 0.99; fixes #623607, helps work around #537430. +- Sync Fedora license list with Wiki revision 1.80. + +* Wed Aug 11 2010 David Malcolm - 0.98-2 +- recompiling .py files against Python 2.7 (rhbz#623355) + +* Wed Jun 23 2010 Ville Skyttä - 0.98-1 +- Update to 0.98; fixes #599427 and #599516. +- Filter out all lib*-java and lib*-python explicit-lib-dependency messages. +- Sync Fedora license list with Wiki revision 1.75; fixes #600317. + +* Tue May 18 2010 Ville Skyttä - 0.97-1 +- Update to 0.97; fixes #459452, #589432. +- Filter out explicit-lib-dep messages for libvirt(-python) (Dan Kenigsberg). +- Sync Fedora license list with Wiki revision 1.73. + +* Thu Apr 22 2010 Ville Skyttä - 0.96-1 +- Update to 0.96; fixes #487974, #571375, #571386, #572090, #572097, #578390. +- Sync Fedora license list with Wiki revision 1.71. + +* Sat Mar 6 2010 Ville Skyttä - 0.95-2 +- Patch to fix non-coherent-filename regression for source packages. + +* Wed Mar 3 2010 Ville Skyttä - 0.95-1 +- Update to 0.95; fixes #564585, #567285, #568498, and #570086. + +* Mon Feb 1 2010 Ville Skyttä - 0.94-1 +- Update to 0.94; rpm >= 4.8.0 spec file check fix included upstream. +- Sync Fedora license list with Wiki revision 1.65 (#559156). + +* Tue Jan 26 2010 Ville Skyttä - 0.93-2 +- Apply upstream patch to fix spec file check with rpm >= 4.8.0. + +* Mon Jan 25 2010 Ville Skyttä - 0.93-1 +- Update to 0.93; fixes #531102 and #555284. +- Enable checks requiring network access in default config. +- Disallow kernel module packages in default config. +- Remove old X11R6 dirs from paths treated as system ones in default config. +- Sync Fedora license list with Wiki revision 1.64. +- Omit python-enchant and python-magic dependencies when built on EL. + +* Mon Nov 2 2009 Ville Skyttä - 0.92-1 +- Update to 0.92; fixes #528535, and #531102 (partially). +- Python byte compile patch applied/superseded upstream. +- Add to list of valid scriptlet shells. +- Sync Fedora license list with Wiki revision 1.53. + +* Mon Sep 14 2009 Ville Skyttä - 0.91-1 +- Update to 0.91; fixes #513811, #515185, #516492, #519694, and #521630. +- Add dependencies on gzip, bzip2, and xz. +- Sync Fedora license list with Wiki revision 1.49. +- Move pre-2008 %%changelog entries to CHANGES.package.old. + +* Sun Jul 26 2009 Fedora Release Engineering - 0.90-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jun 29 2009 Ville Skyttä - 0.90-1 +- 0.90; fixes #508683. + +* Sun Jun 21 2009 Ville Skyttä - 0.89-1 +- Update to 0.89; fixes #461610, #496735, #496737 (partially), #498107, + #491188, and #506957. +- Sync Fedora license list with Wiki revision 1.44. +- Parse list of standard users and groups from the setup package's uidgid file. + +* Thu Mar 19 2009 Ville Skyttä - 0.87-1 +- 0.87; fixes #480664, #483196, #483199, #486748, #488146, #488930, #489118. +- Sync Fedora license list with Wiki revision 1.38. +- Configs patch included upstream. + +* Wed Feb 25 2009 Fedora Release Engineering - 0.85-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Jan 20 2009 Ville Skyttä +- Sync Fedora license list with Wiki revision 1.34. +- Filter out filename-too-long-for-joliet and symlink-should-be-* warnings in + default config. + +* Mon Dec 01 2008 Ignacio Vazquez-Abrams - 0.85-3 +- Rebuild for Python 2.6 + +* Thu Oct 30 2008 Ville Skyttä - 0.85-2 +- Apply upstream patch to load all *config from /etc/rpmlint. + +* Thu Oct 23 2008 Ville Skyttä - 0.85-1 +- 0.85, fixes #355861, #450011, #455371, #456843, #461421, #461423, #461434. +- Mute some explicit-lib-dependency false positives (#458290). +- Sync Fedora license list with Wiki revision 1.19. +- Dist regex patch applied/superseded upstream. + +* Fri Sep 12 2008 Tom "spot" Callaway - 0.84-3 +- Sync Fedora license list with Wiki revision 1.09 + +* Sat Jul 26 2008 Ville Skyttä - 0.84-2 +- 0.84, fixes #355861, #456304. +- Sync Fedora license list with Wiki revision "16:08, 18 July 2008". +- Rediff patches. + +* Tue May 27 2008 Ville Skyttä - 0.83-1 +- 0.83, fixes #237204, #428096, #430206, #433783, #434694, #444441. +- Fedora licensing patch applied upstream. +- Move pre-2007 changelog entries to CHANGES.package.old. +- Sync Fedora license list with Revision 0.88. + +* Tue May 20 2008 Todd Zullinger +- Sync Fedora license list with Revision 0.83 (Wiki rev 131). + +* Mon Mar 3 2008 Ville Skyttä - 0.82-3 +- Sync Fedora license list with Revision 0.69 (Wiki rev 110) (#434690).