fix broken regex for no-manual-page-for-binary check

Apply upstream patch to fix regression in no-manual-page-for-binary
check.

Convert to %autosetup as well; adding %patch lines manually is a hassle.

Resolves: #2132936
This commit is contained in:
Todd Zullinger 2022-10-08 11:57:17 -04:00
parent 670d708754
commit 178007d39d
2 changed files with 62 additions and 1 deletions

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

@ -14,6 +14,10 @@ Source3: scoring.toml
Source4: users-groups.toml
Source5: warn-on-functions.toml
# https://bugzilla.redhat.com/2132936
# https://github.com/rpm-software-management/rpmlint/pull/943
Patch0: https://github.com/rpm-software-management/rpmlint/commit/393cde4e.patch#/0001-fix-broken-regex-for-no-manual-page-for-binary-check.patch
BuildArch: noarch
BuildRequires: python3-devel
# tests
@ -39,7 +43,7 @@ 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}-%{version}
%autosetup -p1
# Replace python-magic dep with file-magic (rhbz#1899279)
sed -i 's/python-magic/file-magic/g' setup.py
@ -78,6 +82,7 @@ cp -a %{SOURCE1} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{buildroot}%{_sysconfdir}/xdg
%changelog
* Fri Oct 07 2022 Todd Zullinger <tmz@pobox.com> - 2.4.0-3
- disable various errors/warnings for debug/devel packages
- fix broken regex for no-manual-page-for-binary check (rhbz#2132936)
* Wed Oct 05 2022 Miro Hrončok <mhroncok@redhat.com> - 2.4.0-2
- remove the license list, depend on rpmlint-fedora-license-data instead