Compare commits

...

No commits in common. "c8" and "c9-beta" have entirely different histories.
c8 ... c9-beta

19 changed files with 360 additions and 854 deletions

4
.gitignore vendored
View File

@ -1,3 +1 @@
SOURCES/__future__.cpython-36.pyc
SOURCES/__future__.cpython-37.pyc
SOURCES/rpmlint-1.10.tar.gz
SOURCES/rpmlint-1.11.tar.gz

View File

@ -1,3 +1 @@
89bf03279e0b25e46ec063d9b56951a72002c474 SOURCES/__future__.cpython-36.pyc
77ad4efceec29a989bf6eaddc22607628493a62b SOURCES/__future__.cpython-37.pyc
d77b498d42d6d7ef044df14a0f37cf88e520cebd SOURCES/rpmlint-1.10.tar.gz
473ddaabbe28a2f5836116d4b19e4a9b641fd038 SOURCES/rpmlint-1.11.tar.gz

View File

@ -1,25 +0,0 @@
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

View File

@ -1,358 +0,0 @@
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()

View File

@ -1,36 +0,0 @@
From 7f86c79068be1c83303da30f5f4f030080e6326a Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
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

View File

@ -1,12 +0,0 @@
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:

View File

@ -1,196 +0,0 @@
From 2bf599d7ed9d4b557b3806fa29439e740cae7f95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
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?= <miro@hroncok.cz>
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

View File

@ -1,30 +0,0 @@
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:

View File

@ -0,0 +1,38 @@
From 30290f021b58d381ce2baaa393a4902fb69e624a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Sun, 10 Mar 2019 11:54:59 +0100
Subject: [PATCH] Suppress errors when setting LC_COLLATE, the problem is not
fatal
Fixes https://github.com/rpm-software-management/rpmlint/issues/198
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1668400
---
rpmlint | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/rpmlint b/rpmlint
index dd835ba..cc8f327 100755
--- a/rpmlint
+++ b/rpmlint
@@ -9,6 +9,7 @@
# the checks.
#############################################################################
+import contextlib
import getopt
import glob
import locale
@@ -89,7 +90,9 @@ def loadCheck(name):
#############################################################################
def main():
- locale.setlocale(locale.LC_COLLATE, '')
+ # we'll try to sort with locale settings, but we don't fail if not possible
+ with contextlib.suppress(locale.Error):
+ locale.setlocale(locale.LC_COLLATE, '')
# Add check dirs to the front of load path
sys.path[0:0] = Config.checkDirs()
--
2.20.1

View File

@ -1,20 +0,0 @@
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)

View File

@ -0,0 +1,23 @@
diff -up rpmlint-rpmlint-1.11/test.sh.orig rpmlint-rpmlint-1.11/test.sh
--- rpmlint-rpmlint-1.11/test.sh.orig 2022-01-12 17:23:52.565790275 +0100
+++ rpmlint-rpmlint-1.11/test.sh 2022-01-12 17:24:02.043920708 +0100
@@ -2,7 +2,7 @@
export PYTHONPATH=$(pwd)/tools:$(pwd)
export TESTPATH="$(pwd)/test/"
-: ${PYTHON:=python} ${PYTEST:=py.test} ${FLAKE8:=flake8}
+: ${PYTHON:=python} ${PYTEST:=py.test}
: ${PYTHONWARNINGS:=all}
export PYTHONWARNINGS
@@ -40,10 +40,6 @@ $PYTEST -v || exit $?
unset PYTHONWARNINGS
-echo "$FLAKE8 tests"
-$FLAKE8 --version
-$FLAKE8 . ./rpmdiff ./rpmlint || exit $?
-
echo "man page tests"
if man --help 2>&1 | grep -q -- --warnings; then
tmpfile=$(mktemp) || exit 1

View File

@ -0,0 +1,16 @@
diff -up rpmlint-rpmlint-1.11/BinariesCheck.py.libcwarn rpmlint-rpmlint-1.11/BinariesCheck.py
--- rpmlint-rpmlint-1.11/BinariesCheck.py.libcwarn 2020-06-16 10:51:01.531299081 -0400
+++ rpmlint-rpmlint-1.11/BinariesCheck.py 2020-06-16 10:51:18.978910827 -0400
@@ -557,10 +557,10 @@ class BinariesCheck(AbstractCheck.Abstra
if not found_libc:
if is_shobj:
- printError(pkg, 'library-not-linked-against-libc',
+ printWarning(pkg, 'library-not-linked-against-libc',
fname)
else:
- printError(pkg, 'program-not-linked-against-libc',
+ printWarning(pkg, 'program-not-linked-against-libc',
fname)
if bin_info.stack:

View File

@ -0,0 +1,13 @@
diff --git a/TagsCheck.py b/TagsCheck.py
index 4e32520..a30b485 100644
--- a/TagsCheck.py
+++ b/TagsCheck.py
@@ -437,7 +437,7 @@ oldest_changelog_timestamp = calendar.timegm(time.strptime("1995-01-01", "%Y-%m-
private_so_paths = set()
for path in ('%perl_archlib', '%perl_vendorarch', '%perl_sitearch',
- '%python_sitearch', '%python2_sitearch', '%python3_sitearch',
+ '%python2_sitearch', '%python3_sitearch',
'%ruby_sitearch', '%php_extdir'):
epath = rpm.expandMacro(path)
if epath and epath != path:

View File

@ -0,0 +1,34 @@
From 8fd904b53c028dded0b308ee95f1a5ff998584fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
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

View File

@ -0,0 +1,13 @@
diff -up rpmlint-rpmlint-1.11/TagsCheck.py.orig rpmlint-rpmlint-1.11/TagsCheck.py
--- rpmlint-rpmlint-1.11/TagsCheck.py.orig 2022-01-11 16:49:18.424026182 +0100
+++ rpmlint-rpmlint-1.11/TagsCheck.py 2022-01-11 16:50:05.774665734 +0100
@@ -463,7 +463,8 @@ def spell_check(pkg, str, fmt, lang, ign
lang, filters=[enchant.tokenize.EmailFilter,
enchant.tokenize.URLFilter,
enchant.tokenize.WikiWordFilter])
- except enchant.DictNotFoundError:
+ except (enchant.errors.DefaultLanguageNotFoundError,
+ enchant.DictNotFoundError):
printInfo(pkg, 'enchant-dictionary-not-found', lang)
pass
_enchant_checkers[lang] = checker

View File

@ -23,6 +23,7 @@ setOption("UseEpoch", False)
setOption("UseUTF8", True)
setOption("UseVersionInChangeLog", True)
setOption("ValidSrcPerms", (int("664",8), int("644",8), ))
setOption("ValidGroups", [])
setOption("ValidShells", (
"<lua>",
@ -30,8 +31,9 @@ setOption("ValidShells", (
"/bin/bash",
"/sbin/ldconfig",
"/usr/bin/perl",
"/usr/bin/python",
"/usr/bin/python2",
"/usr/bin/python3",
"/usr/libexec/platform-python",
))
setOption("DanglingSymlinkExceptions", (
@ -42,7 +44,7 @@ setOption("DanglingSymlinkExceptions", (
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.
# Last synced with revision "2.47, July 3, 2018" of that page.
'AAL',
'Abstyles',
'Adobe',
@ -56,19 +58,17 @@ setOption("ValidLicenses", (
'AMDPLPA',
'AML',
'AMPAS BSD',
'ANTLR-PD',
'APAFML',
'App-s2p',
'APSL 2.0',
'APSL 2.0+',
'ARL',
'Array',
'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',
@ -86,12 +86,14 @@ setOption("ValidLicenses", (
'CeCILL',
'CeCILL-B',
'CeCILL-C',
'CDDL',
'CDDL-1.0',
'CDDL-1.1',
'CNRI',
'Condor',
'Copyright only',
'CPAL',
'CPL',
'CPM',
'CRC32',
'Crossword',
'Crystal Stacker',
@ -107,16 +109,18 @@ setOption("ValidLicenses", (
'ECL 2.0',
'eCos',
'EFL 2.0',
'EFL 2.0+',
'eGenix',
'Entessa',
'EPICS',
'EPL',
'EPL-1.0',
'EPL-2.0',
'ERPL',
'EU Datagrid',
'EUPL 1.1',
'Eurosym',
'Fair',
'FDK-AAC',
'FSFAP',
'FSFUL',
'FSFULLR',
'FTL',
@ -146,6 +150,7 @@ setOption("ValidLicenses", (
'ImageMagick',
'iMatix',
'Imlib2',
'Inner-Net',
'Intel ACPI',
'Interbase',
'ISC',
@ -183,9 +188,7 @@ setOption("ValidLicenses", (
'mod_macro',
'Motosoto',
'MPLv1.0',
'MPLv1.0+',
'MPLv1.1',
'MPLv1.1+',
'MPLv2.0',
'MS-PL',
'MS-RL',
@ -198,6 +201,7 @@ setOption("ValidLicenses", (
'Newmat',
'Newsletr',
'NGPL',
'NISTSL',
'NLPL',
'Nmap',
'Nokia',
@ -210,15 +214,10 @@ setOption("ValidLicenses", (
'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',
@ -231,14 +230,17 @@ setOption("ValidLicenses", (
'Python',
'Qhull',
'QPL',
'radvd',
'Rdisc',
'REX',
'RiceBSD',
'Romio',
'RPSL',
'RSA',
'Rsfs',
'Ruby',
'Saxpath',
'Sequence',
'SCEA',
'SCRIP',
'Sendmail',
@ -263,6 +265,7 @@ setOption("ValidLicenses", (
'TPDL',
'TPL',
'TTWL',
'Tumbolia',
'UCAR',
'UCD',
'Unicode',
@ -276,6 +279,7 @@ setOption("ValidLicenses", (
'Wsuipa',
'WTFPL',
'wxWidgets',
'wxWindows',
'Xerox',
'xinetd',
'xpp',
@ -286,11 +290,8 @@ setOption("ValidLicenses", (
'zlib',
'zlib with acknowledgement',
'ZPLv1.0',
'ZPLv1.0+',
'ZPLv2.0',
'ZPLv2.0+',
'ZPLv2.1',
'ZPLv2.1+',
# Documentation licenses
'CDL',
'FBSDDL',
@ -312,13 +313,18 @@ setOption("ValidLicenses", (
'GeoGratis',
'Green OpenMusic',
'OAL',
'PDDL-1.0',
# Font licenses
'AMS',
'Arphic',
'Baekmuk',
'Bitstream Vera',
'Charter',
'DoubleStroke',
'ec',
'Elvish',
'Hershey',
'HOFL',
'IPA',
'Liberation',
'Lucida',
@ -326,6 +332,7 @@ setOption("ValidLicenses", (
'mplus',
'OFL',
'PTFL',
'Punknova',
'STIX',
'Utopia',
'Wadalab',
@ -392,15 +399,17 @@ addFilter("non-versioned-file-in-library-package")
addFilter("requires-on-release")
addFilter("jar-not-indexed")
addFilter("outside-libdir-files")
addFilter("-debuginfo.* no-documentation")
addFilter("-debug(info|source).* no-documentation")
addFilter("-debuginfo.* /usr/lib/debug/")
addFilter("-debugsource.* /usr/src/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 (liberation-fonts|libertas-.*-firmware|libvirt$|.*-(java|python|utils)$)")
addFilter("explicit-lib-dependency (python-.*lib.*|python2-.*lib.*|python3-.*lib.*)$")
addFilter("explicit-lib-dependency libreoffice.*$")
addFilter("filename-too-long-for-joliet")
addFilter("symlink-should-be-")
addFilter(r"dangling-\S*symlink /usr/share/doc/HTML/\S+/common .+/common$")
@ -414,10 +423,9 @@ 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")
# Don't bother with the non-ghost-in-run checks, /var/lock and /var/run are
# symlinks to /run/lock and /run respectively, and /run is a tmpfs
addFilter("non-ghost-in-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$")
@ -440,29 +448,38 @@ addFilter(r"invalid-url .*github\.com/.*HTTP Error 403")
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")
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|btrfs|crypttab|defrag|dracut|hostname|luks|mountpoints|netdev|rpmnew|rpmsave|storaged|tss|unlocker)\b")
# Fedora no longer uses explicit ldconfig %post/%postun as of Fedora 28
addFilter("library-without-ldconfig-postin")
addFilter("library-without-ldconfig-postun")
# Ignore 700 dir perms here
addFilter("non-standard-dir-perm /etc/.* 700")
addFilter("non-standard-dir-perm /var/lib/.* 700")
# Fedora no longer requires install-info scriptlets
addFilter("info-files-without-install-info-postin")
addFilter("info-files-without-install-info-postun")
addFilter("postin-without-install-info")
# pip 20.2 generates PEP 376 "REQUESTED" marker (empty)
addFilter(r"zero-length .+/site-packages/.+\.dist-info/REQUESTED\b")
# py.typed files are empty
addFilter(r"zero-length .+/site-packages/.+/py\.typed\b")
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/'''
https://fedoraproject.org/wiki/Packaging:CryptoPolicies'''
call_blacklist = {'crypto-policy-non-compliance-openssl' :
{'f_name' : 'SSL_CTX_set_cipher_list',
'good_param' : '^PROFILE=SYSTEM$',
'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$',
'good_param' : 'SYSTEM',
'description' : bad_crypto_warning}
}
setOption("WarnOnFunction", call_blacklist)

View File

@ -1,28 +0,0 @@
# -*- 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")

View File

@ -1,24 +0,0 @@
# -*- 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")

View File

@ -4,107 +4,115 @@
%bcond_with python3
%endif
# Disable automatic compilation of Python files in /usr/share/rpmlint
%global _python_bytecompile_extra 0
%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
%global pytest pytest-3
%else
%global python %{__python}
%global python %{__python2}
%global pytest py.test
%global flake8 flake8
%endif
Name: rpmlint
Version: 1.10
Release: 15%{?dist}
Version: 1.11
Release: 19%{?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
Source0: %{url}/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
# 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
# Upstream changed to a warning here
# https://github.com/rpm-software-management/rpmlint/pull/363
# This patch does the same on the 1.11 code
Patch213: rpmlint-1.11-libc-warnings.patch
# Don't use the %%python_sitelib macro, because it errors
# See https://fedoraproject.org/wiki/Changes/PythonMacroError
Patch214: rpmlint-1.11-no-python-macro.patch
# Downstream-only patches
Patch215: rpmlint-1.11-spellcheck-handle-missing-language-error.patch
Patch216: rpmlint-1.11-disable-flake8-self-test.patch
BuildArch: noarch
BuildRequires: make
%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-rpm >= 4.4.2.2
BuildRequires: python3-pytest
#BuildRequires: python3-flake8-import-order
%{?__python3:Requires: %{__python3}}
Requires: rpm-python3 >= 4.4.2.2
Requires: python3
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
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.
# they bring quite desirable features.
%if %{with python3}
%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9
Requires: python3-file-magic
BuildRequires: python3-file-magic
%else
Requires: python3-magic
BuildRequires: python3-magic
%endif
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}
%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/
%if %{with python3}
%patch199 -p1
%patch212 -p1
%patch213 -p1
%patch214 -p1
%patch215 -p1
%patch216 -p1
sed -i 's|1.10|%{version}|g' Makefile
%if 0%{?fedora} >= 31 || 0%{?rhel} >= 9
# 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
install -pm 644 %{SOURCE3} config
@ -120,17 +128,19 @@ 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}
%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}
%files
@ -139,37 +149,112 @@ make check PYTHON=%{python} PYTEST=%{pytest} FLAKE8=%{flake8}
%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 <mhroncok@redhat.com> - 1.10-15
- Correctly load .pyc mtime for Python 3.7+ bytecode cache
(RHEL-20900)
* Wed Jan 12 2022 Michal Domonkos <mdomonko@redhat.com> - 1.11-19
- Disable flake8 self-test (#1929210)
* Thu Jun 04 2020 Michal Domonkos <mdomonko@redhat.com> - 1.10-14
- Update crypto warnings in config file to reflect current Fedora policy
(RHBZ#1797545)
* Mon Jan 10 2022 Michal Domonkos <mdomonko@redhat.com> - 1.11-18
- Enable bash-completion (#1999654)
- Handle missing language error during spellcheck (#1929210)
* Fri Jun 14 2019 Thomas Woerner <twoerner@redhat.com> - 1.10.13.2
- Handle rpm change to return surrogate-escaped utf-8 python strings
(RHBZ#1693712)
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1.11-17
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Jun 13 2019 Thomas Woerner <twoerner@redhat.com> - 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)
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.11-16
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Thu Sep 20 2018 Tomas Orsava <torsava@redhat.com> - 1.10-13
- Require the Python interpreter directly instead of using the package name
- Related: rhbz#1619153
* Fri Feb 5 2021 Tom Callaway <spot@fedoraproject.org> - 1.11-15
- correct hard-coded version in Makefile
* Mon Jun 25 2018 Petr Viktorin <pviktori@redhat.com> - 1.10-12
- Remove the flake8 build dependency
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jan 25 2021 Miro Hrončok <mhroncok@redhat.com> - 1.11-13
- Filter out empty py.typed files in Python site-packages
* Fri Aug 21 2020 Miro Hrončok <mhroncok@redhat.com> - 1.11-12
- Filter out empty REQUESTED files in pip installed Python metadata dist-info dirs
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Thu Jul 16 2020 Miro Hrončok <mhroncok@redhat.com> - 1.11-10
- Don't use the %%python_sitelib macro, because it errors
- See https://fedoraproject.org/wiki/Changes/PythonMacroError
* Tue Jun 23 2020 Tom Callaway <spot@fedoraproject.org> - 1.11-9
- use python3-file-magic on f33+
* Tue Jun 16 2020 Tom Callaway <spot@fedoraproject.org> - 1.11-8
- turn *-not-linked-against-libc from errors to warnings (bz1749738)
* Wed Jun 10 2020 Tom Callaway <spot@fedoraproject.org> - 1.11-7
- add /usr/bin/python[23] as valid shells
* Sun May 24 2020 Miro Hrončok <mhroncok@redhat.com> - 1.11-6
- Rebuilt for Python 3.9
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Aug 17 2019 Miro Hrončok <mhroncok@redhat.com> - 1.11-4
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jul 11 2019 Tom Callaway <spot@fedoraproject.org> - 1.11-2
- merge conflig file cleanups from PR
* Fri Jun 21 2019 Tom Callaway <spot@fedoraproject.org> - 1.11-1
- update to 1.11
* Sun Mar 10 2019 Miro Hrončok <mhroncok@redhat.com> - 1.10-22
- Suppress locale error in order to work in default mock (#1668400)
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.10-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Jan 16 2019 Tom Callaway <spot@fedoraproject.org> - 1.10-20
- ignore info-files-without-install-info-postin/postun checks
* Fri Dec 7 2018 Tom Callaway <spot@fedoraproject.org> - 1.10-19
- ignore non-standard-dir-perm error for 700 dirs in /etc and /var/lib
* Fri Oct 5 2018 Tom Callaway <spot@fedoraproject.org> - 1.10-18
- force python3 as exec binary
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.10-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Jun 18 2018 Miro Hrončok <mhroncok@redhat.com> - 1.10-16
- Rebuilt for Python 3.7
* Sun Jun 17 2018 Todd Zullinger <tmz@pobox.com> - 1.10-15
- Fix mixed-use-of-spaces-and-tabs warning (in this spec file)
- Remove el4/el5 configs and /usr/bin symlinks
- Disable automatic compilation of Python files in /usr/share/rpmlint
- Fix non-ghost-in-run filter in config
* Tue Jun 12 2018 Miro Hrončok <mhroncok@redhat.com> - 1.10-14
- apply upstream fix for python 3.7 new magic numbers
* Sat Jun 2 2018 Tom Callaway <spot@fedoraproject.org> 1.10-13
- apply upstream fix for python 3.7 mtime handling
* Thu May 03 2018 Todd Zullinger <tmz@pobox.com> - 1.10-12
- Properly handle the exception on missing files (bz1574509)
- Explicitly disable the non-standard-group check
* Wed Apr 18 2018 Todd Zullinger <tmz@pobox.com>
- Ignore 'no-documentation' in debugsource packages
- Ignore /usr/src/debug/ in debugsource packages
* Tue Apr 17 2018 Tom Callaway <spot@fedoraproject.org> - 1.10-11
- disable library-without-ldconfig-postin/postun checks (F28+)