!11 update to 2.4.0

From: @wk333 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
This commit is contained in:
openeuler-ci-bot 2023-06-25 11:32:08 +00:00 committed by Gitee
commit 070af7ae1c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
15 changed files with 304 additions and 1045 deletions

View File

@ -0,0 +1,101 @@
From 7d707f7f370c31f3d9841415c1458a2d21640a15 Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Fri, 3 Mar 2023 12:56:37 -0500
Subject: [PATCH] TagsCheck: handle license exception in grouping
A valid license exception which is in a grouping is reported as invalid.
This is due to the trailing ')' being included in the regex. The
following license:
(GPL-2.0-only OR GPL-3.0-only WITH Qt-GPL-exception-1.0) AND MIT
returns:
W: invalid-license-exception Qt-GPL-exception-1.0)
Adjust the license_exception_regex to exclude trailing parenthesis.
Fixes: https://bugzilla.redhat.com/2175241
---
rpmlint/checks/TagsCheck.py | 2 +-
.../valid-exception-in-grouping-1.0-1.src.rpm | Bin 0 -> 6615 bytes
test/test_tags.py | 12 ++++++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 test/source/valid-exception-in-grouping-1.0-1.src.rpm
diff --git a/rpmlint/checks/TagsCheck.py b/rpmlint/checks/TagsCheck.py
index ad9a35f2..923538ba 100644
--- a/rpmlint/checks/TagsCheck.py
+++ b/rpmlint/checks/TagsCheck.py
@@ -21,7 +21,7 @@ lib_package_regex = re.compile(r'(?:^(?:compat-)?lib.*?(\.so.*)?|libs?[\d-]*)$',
leading_space_regex = re.compile(r'^\s+')
pkg_config_regex = re.compile(r'^/usr/(?:lib\d*|share)/pkgconfig/')
license_regex = re.compile(r'\(([^)]+)\)|\s(?:and|or|AND|OR)\s')
-license_exception_regex = re.compile(r'(\S+)\s(?:WITH|with)\s(\S+)')
+license_exception_regex = re.compile(r'(\S+)\s(?:WITH|with)\s([^)]+)')
invalid_version_regex = re.compile(r'([0-9](?:rc|alpha|beta|pre).*)', re.IGNORECASE)
# () are here for grouping purpose in the regexp
tag_regex = re.compile(r'^((?:Auto(?:Req|Prov|ReqProv)|Build(?:Arch(?:itectures)?|Root)|(?:Build)?Conflicts|(?:Build)?(?:Pre)?Requires|Copyright|(?:CVS|SVN)Id|Dist(?:ribution|Tag|URL)|DocDir|(?:Build)?Enhances|Epoch|Exclu(?:de|sive)(?:Arch|OS)|Group|Icon|License|Name|No(?:Patch|Source)|Obsoletes|Packager|Patch\d*|Prefix(?:es)?|Provides|(?:Build)?Recommends|Release|RHNPlatform|Serial|Source\d*|(?:Build)?Suggests|Summary|(?:Build)?Supplements|(?:Bug)?URL|Vendor|Version)(?:\([^)]+\))?:)\s*\S', re.IGNORECASE)
diff --git a/test/source/valid-exception-in-grouping-1.0-1.src.rpm b/test/source/valid-exception-in-grouping-1.0-1.src.rpm
new file mode 100644
index 0000000000000000000000000000000000000000..c74b2f048a8d45b224df143f7a77f75d21eba87c
GIT binary patch
literal 6615
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
literal 0
HcmV?d00001
diff --git a/test/test_tags.py b/test/test_tags.py
index 210fb2db..42a83154 100644
--- a/test/test_tags.py
+++ b/test/test_tags.py
@@ -77,6 +77,18 @@ def test_valid_license_exception(tmpdir, package, tagscheck):
assert 'W: invalid-license-exception' not in out
+@pytest.mark.parametrize('package', ['source/valid-exception-in-grouping'])
+def test_valid_license_exception_in_grouping(tmpdir, package, tagscheck):
+ CONFIG.info = True
+ CONFIG.configuration['ValidLicenses'] = ['BSD-3-Clause', 'GPL-2.0-only']
+ CONFIG.configuration['ValidLicenseExceptions'] = ['Qt-GPL-exception-1.0']
+ output = Filter(CONFIG)
+ test = TagsCheck(CONFIG, output)
+ test.check(get_tested_package(package, tmpdir))
+ out = output.print_results(output.results)
+ assert 'W: invalid-license-exception' not in out
+
+
@pytest.mark.parametrize('package', ['binary/xtables-addons-kmp-default'])
def test_forbidden_controlchar_found_requires(tmpdir, package, tagscheck):
output, test = tagscheck

View File

@ -0,0 +1,28 @@
From 48aa148bd633aa4e27b28239d98cd809e0e45f22 Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Mon, 20 Mar 2023 03:14:14 -0400
Subject: [PATCH] TagsCheck: restore space exclusion to license_exception_regex
In 7d707f7f (TagsCheck: handle license exception in grouping,
2023-03-03), the regex lost the exclusion of space characters. This
isn't immediately noticeable because we strip the strings generated by
the regex before use, but it's better to keep the regex more precise.
Suggested-by: Daniel Garcia Moreno <daniel.garcia@suse.com>
---
rpmlint/checks/TagsCheck.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rpmlint/checks/TagsCheck.py b/rpmlint/checks/TagsCheck.py
index 923538ba..65c75c92 100644
--- a/rpmlint/checks/TagsCheck.py
+++ b/rpmlint/checks/TagsCheck.py
@@ -21,7 +21,7 @@
leading_space_regex = re.compile(r'^\s+')
pkg_config_regex = re.compile(r'^/usr/(?:lib\d*|share)/pkgconfig/')
license_regex = re.compile(r'\(([^)]+)\)|\s(?:and|or|AND|OR)\s')
-license_exception_regex = re.compile(r'(\S+)\s(?:WITH|with)\s([^)]+)')
+license_exception_regex = re.compile(r'(\S+)\s(?:WITH|with)\s([^)\s]+)')
invalid_version_regex = re.compile(r'([0-9](?:rc|alpha|beta|pre).*)', re.IGNORECASE)
# () are here for grouping purpose in the regexp
tag_regex = re.compile(r'^((?:Auto(?:Req|Prov|ReqProv)|Build(?:Arch(?:itectures)?|Root)|(?:Build)?Conflicts|(?:Build)?(?:Pre)?Requires|Copyright|(?:CVS|SVN)Id|Dist(?:ribution|Tag|URL)|DocDir|(?:Build)?Enhances|Epoch|Exclu(?:de|sive)(?:Arch|OS)|Group|Icon|License|Name|No(?:Patch|Source)|Obsoletes|Packager|Patch\d*|Prefix(?:es)?|Provides|(?:Build)?Recommends|Release|RHNPlatform|Serial|Source\d*|(?:Build)?Suggests|Summary|(?:Build)?Supplements|(?:Bug)?URL|Vendor|Version)(?:\([^)]+\))?:)\s*\S', re.IGNORECASE)

View File

@ -0,0 +1,56 @@
From 393cde4e70a6efdf1353ca1d4a8ba6500c0dc967 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Sat, 8 Oct 2022 10:12:54 +0200
Subject: [PATCH] fix broken regex for no-manual-page-for-binary check
It was a regression since 718e1eb9e6e84edf34026f2b62653f3d8f75d993.
Fixes: #918.
---
rpmlint/checks/FilesCheck.py | 6 +++---
test/test_files.py | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/rpmlint/checks/FilesCheck.py b/rpmlint/checks/FilesCheck.py
index 067e603d..cbd32259 100644
--- a/rpmlint/checks/FilesCheck.py
+++ b/rpmlint/checks/FilesCheck.py
@@ -204,7 +204,7 @@
non_readable_regexs = (re.compile(r'^/var/log/'),
re.compile(r'^/etc/(g?shadow-?|securetty)$'))
-man_base_regex = re.compile(r'^/usr(?:/share)?/man(?:/overrides)?/man(?P<category>[^/]+)/(?P<filename>.+)')
+man_base_regex = re.compile(r'^/usr(?:/share)?/man(?:/overrides)?/man(?P<category>[^/]+)/(?P<filename>((?P<binary>[^.]+)\..+))')
fsf_license_regex = re.compile(br'(GNU((\s+(Library|Lesser|Affero))?(\s+General)?\s+Public|\s+Free\s+Documentation)\s+Licen[cs]e|(GP|FD)L)', re.IGNORECASE)
fsf_wrong_address_regex = re.compile(br'(675\s+Mass\s+Ave|59\s+Temple\s+Place|Franklin\s+Steet|02139|02111-1307)', re.IGNORECASE)
@@ -702,7 +702,7 @@ def check(self, pkg):
# look for man pages
res = man_base_regex.fullmatch(f)
if res:
- man_basenames.add(res.group('category'))
+ man_basenames.add(res.group('binary'))
res = bin_regex.search(f)
if res:
@@ -924,7 +924,7 @@ def check(self, pkg):
res = man_base_regex.fullmatch(f)
if res:
- man_basenames.add(res.group('category'))
+ man_basenames.add(res.group('binary'))
else:
res = bin_regex.search(f)
if res:
diff --git a/test/test_files.py b/test/test_files.py
index 09fae39f..684a39b6 100644
--- a/test/test_files.py
+++ b/test/test_files.py
@@ -175,6 +175,7 @@ def test_distribution_tags(tmpdir, package, filescheck):
test.check(get_tested_package(package, tmpdir))
out = output.print_results(output.results)
assert 'manpage-not-compressed' in out
+ assert 'no-manual-page-for-binary' not in out
assert 'This manual page is not compressed with the bz2 compression' in out

View File

@ -0,0 +1,97 @@
From 65abdbd383166ce727ece30f79b0808f46c2da29 Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Mon, 20 Mar 2023 03:20:44 -0400
Subject: [PATCH] TagsCheck: handle license exception in first item of a
grouping
The change in 7d707f7f (TagsCheck: handle license exception in grouping,
2023-03-03) is insufficient when the exception is on the first item in a
grouping, e.g.:
License: (Apache-2.0 WITH LLVM-exception OR NCSA) AND BSD-3-Clause
Adjust `license_exception_regex` to exclude a leading '(' as well as a
trailing ')'.
---
rpmlint/checks/TagsCheck.py | 2 +-
.../valid-exception-begin-grouping-1.0-1.src.rpm | Bin 0 -> 6644 bytes
test/test_tags.py | 12 ++++++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 test/source/valid-exception-begin-grouping-1.0-1.src.rpm
diff --git a/rpmlint/checks/TagsCheck.py b/rpmlint/checks/TagsCheck.py
index 65c75c92..64088f55 100644
--- a/rpmlint/checks/TagsCheck.py
+++ b/rpmlint/checks/TagsCheck.py
@@ -21,7 +21,7 @@
leading_space_regex = re.compile(r'^\s+')
pkg_config_regex = re.compile(r'^/usr/(?:lib\d*|share)/pkgconfig/')
license_regex = re.compile(r'\(([^)]+)\)|\s(?:and|or|AND|OR)\s')
-license_exception_regex = re.compile(r'(\S+)\s(?:WITH|with)\s([^)\s]+)')
+license_exception_regex = re.compile(r'([^(\s]+)\s(?:WITH|with)\s([^)\s]+)')
invalid_version_regex = re.compile(r'([0-9](?:rc|alpha|beta|pre).*)', re.IGNORECASE)
# () are here for grouping purpose in the regexp
tag_regex = re.compile(r'^((?:Auto(?:Req|Prov|ReqProv)|Build(?:Arch(?:itectures)?|Root)|(?:Build)?Conflicts|(?:Build)?(?:Pre)?Requires|Copyright|(?:CVS|SVN)Id|Dist(?:ribution|Tag|URL)|DocDir|(?:Build)?Enhances|Epoch|Exclu(?:de|sive)(?:Arch|OS)|Group|Icon|License|Name|No(?:Patch|Source)|Obsoletes|Packager|Patch\d*|Prefix(?:es)?|Provides|(?:Build)?Recommends|Release|RHNPlatform|Serial|Source\d*|(?:Build)?Suggests|Summary|(?:Build)?Supplements|(?:Bug)?URL|Vendor|Version)(?:\([^)]+\))?:)\s*\S', re.IGNORECASE)
diff --git a/test/source/valid-exception-begin-grouping-1.0-1.src.rpm b/test/source/valid-exception-begin-grouping-1.0-1.src.rpm
new file mode 100644
index 0000000000000000000000000000000000000000..d0aba4903debd79db253b7655f3a001f2edfe0b2
GIT binary patch
literal 6644
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
literal 0
HcmV?d00001
diff --git a/test/test_tags.py b/test/test_tags.py
index 42a83154..6c5d5280 100644
--- a/test/test_tags.py
+++ b/test/test_tags.py
@@ -89,6 +89,18 @@ def test_valid_license_exception_in_grouping(tmpdir, package, tagscheck):
assert 'W: invalid-license-exception' not in out
+@pytest.mark.parametrize('package', ['source/valid-exception-begin-grouping'])
+def test_valid_license_exception_begin_grouping(tmpdir, package, tagscheck):
+ CONFIG.info = True
+ CONFIG.configuration['ValidLicenses'] = ['BSD-3-Clause', 'GPL-2.0-only']
+ CONFIG.configuration['ValidLicenseExceptions'] = ['Qt-GPL-exception-1.0']
+ output = Filter(CONFIG)
+ test = TagsCheck(CONFIG, output)
+ test.check(get_tested_package(package, tmpdir))
+ out = output.print_results(output.results)
+ assert 'W: invalid-license-exception' not in out
+
+
@pytest.mark.parametrize('package', ['binary/xtables-addons-kmp-default'])
def test_forbidden_controlchar_found_requires(tmpdir, package, tagscheck):
output, test = tagscheck

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,44 +0,0 @@
From 3a072351314c3a3ec11650ad8efd2fc6ececf987 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Sat, 4 Nov 2017 02:17:52 +0100
Subject: [PATCH] Properly handle the exception on missing files
Missing files raises a FileNotFoundError, not OSError. Also
simplify logic.
(cherry picked from commit d59bc2a1e2698040553c09610cb2befa1ef8d76a)
---
Pkg.py | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/Pkg.py b/Pkg.py
index e257243..01d0289 100644
--- a/Pkg.py
+++ b/Pkg.py
@@ -714,20 +714,15 @@ class Pkg(AbstractPkg):
pkgfile.magic = "symbolic link to `%s'" % pkgfile.linkto
elif not pkgfile.size:
pkgfile.magic = 'empty'
- if not pkgfile.magic and _magic:
+ if (not pkgfile.magic and
+ not pkgfile.is_ghost and _magic):
# file() method evaluates every file twice with python2,
# use descriptor() method instead
try:
fd = os.open(pkgfile.path, os.O_RDONLY)
- except OSError:
- if not pkgfile.is_ghost:
- raise
- else:
pkgfile.magic = b2s(_magic.descriptor(fd))
- # libmagic up to 5.18 already closes the descriptor
- try:
os.close(fd)
- except OSError:
+ except FileNotFoundError:
pass
if pkgfile.magic is None:
pkgfile.magic = ''
--
2.17.0

View File

@ -1,13 +0,0 @@
diff --git a/FilesCheck.py b/FilesCheck.py
index c8666b9..78b22ef 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -331,7 +331,7 @@ def peek(filename, pkg, length=1024):
'3.4': [3310],
'3.5': [3350, 3351], # 3350 for < 3.5.2
'3.6': [3379],
- '3.7': [3390],
+ '3.7': [3390, 3391, 3392, 3393, 3394],
}

View File

@ -1,57 +0,0 @@
diff -up rpmlint-rpmlint-1.10/FilesCheck.py.py37mtime rpmlint-rpmlint-1.10/FilesCheck.py
--- rpmlint-rpmlint-1.10/FilesCheck.py.py37mtime 2018-06-02 14:29:53.035453468 -0400
+++ rpmlint-rpmlint-1.10/FilesCheck.py 2018-06-02 14:32:55.430860108 -0400
@@ -377,6 +377,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
@@ -729,7 +750,7 @@ class FilesCheck(AbstractCheck.AbstractC
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'
@@ -752,13 +773,14 @@ class FilesCheck(AbstractCheck.AbstractC
# 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(

View File

@ -1,37 +0,0 @@
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, 11 insertions(+)
diff --git a/Pkg.py b/Pkg.py
index 8cf701c..4c96098 100644
--- a/Pkg.py
+++ b/Pkg.py
@@ -164,8 +164,17 @@ def is_utf8(fname):
def is_utf8_bytestr(s):
+ """Returns True whether the given text is UTF-8.
+ Due to changes in rpm, needs to handle both bytes and unicode."""
try:
- s.decode('UTF-8')
+ if hasattr(s, 'decode'):
+ s.decode('utf-8')
+ elif hasattr(s, 'encode'):
+ s.encode('utf-8')
+ else:
+ unexpected = type(s).__name__
+ raise TypeError(
+ 'Expected str/unicode/bytes, not {}'.format(unexpected))
except UnicodeError:
return False
return True
--
2.23.0

Binary file not shown.

BIN
rpmlint-2.4.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,2 +0,0 @@
# Add local system wide rpmlint configuration here or in other *config files
# in this directory.

View File

@ -1,471 +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
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("ValidGroups", [])
setOption("ValidShells", (
"<lua>",
"/bin/sh",
"/bin/bash",
"/sbin/ldconfig",
"/usr/bin/perl",
"/usr/bin/python",
))
setOption("DanglingSymlinkExceptions", (
['consolehelper$', 'usermode'],
['consolehelper-gtk$', 'usermode-gtk'],
))
setOption("ValidLicenses", (
'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("-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 (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.*")
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-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$")
# 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")
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://gitee.com/src-openeuler/rpmlint/wikis'''
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',
'description' : bad_crypto_warning},
'crypto-policy-non-compliance-gnutls-2' :
{'f_name' : 'gnutls_priority_init',
'good_param' : 'SYSLOG',
'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))

View File

@ -1,25 +1,21 @@
%global _python_bytecompile_extra 0 %global _python_bytecompile_extra 0
Name: rpmlint Name: rpmlint
Version: 1.10 Version: 2.4.0
Release: 19 Release: 1
Summary: Check the RPM package of tools for common errors Summary: Check the RPM package of tools for common errors
License: GPLv2 License: GPL-2.0-or-later
URL: https://github.com/rpm-software-management/rpmlint URL: https://github.com/rpm-software-management/rpmlint
Source0: https://github.com/rpm-software-management/rpmlint/archive/rpmlint-%{version}.tar.gz Source0: https://github.com/rpm-software-management/rpmlint/archive/rpmlint-%{version}.tar.gz
Source1: rpmlint.config
Source2: rpmlint-etc.config
Patch0001: rpmlint-1.10-ignore-debuginfo-useless-provides.patch Patch0: https://github.com/rpm-software-management/rpmlint/commit/393cde4e.patch#/0001-fix-broken-regex-for-no-manual-page-for-binary-check.patch
Patch0002: rpmlint-1.10-flake-cleanups.patch Patch1: https://github.com/rpm-software-management/rpmlint/commit/7d707f7f.patch#/0001-TagsCheck-handle-license-exception-in-grouping.patch
Patch0003: rpmlint-1.10-missing-files-exception.patch Patch2: https://github.com/rpm-software-management/rpmlint/commit/48aa148b.patch#/0001-TagsCheck-restore-space-exclusion-to-license_excepti.patch
Patch0004: rpmlint-1.10-py37mtime.patch Patch3: https://github.com/rpm-software-management/rpmlint/commit/65abdbd3.patch#/0002-TagsCheck-handle-license-exception-in-first-item-of-.patch
Patch0005: rpmlint-1.10-py37magic.patch
Patch0006: rpmlint-1.10-ugly-workaroud-for-RPM-4.14-vs-4.15-python3-bindings-incompatibility.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python3-devel rpm-python3 >= 4.4.2.2 python3-pytest sed >= 3.95 BuildRequires: python3-devel rpm-python3 >= 4.4.2.2 python3-pytest sed >= 3.95 git
Requires: python3 rpm-python3 >= 4.4.2.2 Requires: python3 rpm-python3 >= 4.4.2.2
Requires: perl-interpreter cpio binutils desktop-file-utils gzip bzip2 xz %{_bindir}/groff Requires: perl-interpreter cpio binutils desktop-file-utils gzip bzip2 xz %{_bindir}/groff
@ -34,34 +30,33 @@ Summary: Help document for the rpmlint package
Help document for the rpmlint package. Help document for the rpmlint package.
%prep %prep
%autosetup -n %{name}-%{name}-%{version} -p1 %autosetup -p1 -Sgit
sed -i -e /MenuCheck/d Config.py sed -i 's/python-magic/file-magic/g' setup.py
cp -p config config.example
install -pm 644 %{SOURCE2} config sed -i -e 's/ --cov=rpmlint//' -e 's/ --flake8//' setup.cfg
sed -i '/^@pytest.mark.no_cover/d' test/test_lint.py
%build %build
make COMPILE_PYC=1 PYTHON=%{__python3} %py3_build
%install %install
touch rpmlint.pyc rpmlint.pyo %py3_install
%make_install ETCDIR=%{_sysconfdir} MANDIR=%{_mandir} \
LIBDIR=%{_datadir}/rpmlint BINDIR=%{_bindir} PYTHON=%{__python3}
install -pm 644 %{SOURCE1} %{buildroot}%{_datadir}/rpmlint/config
%files %files
%doc README.md config.example COPYING %doc README.md COPYING
%config(noreplace) %{_sysconfdir}/rpmlint/
%{_bindir}/{rpmdiff,rpmlint} %{_bindir}/{rpmdiff,rpmlint}
%{_datadir}/rpmlint/ %{python3_sitelib}/rpmlint*
%exclude %{_sysconfdir}/bash_completion.d/
%files help %files help
%{_mandir}/man1/*
%changelog %changelog
* Sun Jun 25 2023 liyanan <thistleslyn@163.com> - 2.4.0-1
- Update to 2.4.0
* Wed Nov 4 2020 Guoshuai Sun <sunguoshuai@huawei.com> - 1.10-19 * Wed Nov 4 2020 Guoshuai Sun <sunguoshuai@huawei.com> - 1.10-19
- Ugly workaroud for RPM 4.14 vs 4.15 python3 bindings incompatibility - Ugly workaroud for RPM 4.14 vs 4.15 python3 bindings incompatibility