fix rpmlint -i where it wrongly assumes a tmp dir

This commit is contained in:
Tom spot Callaway 2021-07-01 12:19:48 -04:00
parent a5cb936436
commit 889dc5b76b
2 changed files with 44 additions and 1 deletions

36
rpmlint-2.0.0-PR672.patch Normal file
View File

@ -0,0 +1,36 @@
diff -up rpmlint-2.0.0/rpmlint/pkg.py.672 rpmlint-2.0.0/rpmlint/pkg.py
--- rpmlint-2.0.0/rpmlint/pkg.py.672 2021-07-01 12:07:42.406914041 -0400
+++ rpmlint-2.0.0/rpmlint/pkg.py 2021-07-01 12:08:31.965200930 -0400
@@ -480,8 +480,10 @@ class Pkg(AbstractPkg):
def _extract(self, dirname, verbose):
if not Path(dirname).is_dir():
print_warning('Unable to access dir %s' % dirname)
+ elif dirname == '/':
+ # it is an InstalledPkg
+ pass
else:
- dirname = dirname if dirname != '/' else None
self.__tmpdir = tempfile.TemporaryDirectory(
prefix='rpmlint.%s.' % Path(self.filename).name, dir=dirname
)
diff -up rpmlint-2.0.0/test/test_lint.py.672 rpmlint-2.0.0/test/test_lint.py
--- rpmlint-2.0.0/test/test_lint.py.672 2021-07-01 12:08:44.717274750 -0400
+++ rpmlint-2.0.0/test/test_lint.py 2021-07-01 12:09:40.593598217 -0400
@@ -391,3 +391,17 @@ def test_run_rpmlintrc_single_file(capsy
out, err = capsys.readouterr()
assert not err
assert 'rpmlintrc:' in out
+
+
+
+def test_installed_package(capsys):
+ additional_options = {
+ 'installed': ['bzip2'],
+ 'permissive': True
+ }
+ options = {**options_preset, **additional_options}
+ linter = Lint(options)
+ retcode = linter.run()
+ out, err = capsys.readouterr()
+ assert '1 packages and 0 specfiles checked' in out
+ assert retcode == 0

View File

@ -1,6 +1,6 @@
Name: rpmlint
Version: 2.0.0
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Tool for checking common errors in RPM packages
License: GPLv2
URL: https://github.com/rpm-software-management/rpmlint
@ -11,6 +11,8 @@ Source2: licenses.toml
Source3: scoring.toml
Source4: users-groups.toml
Source5: warn-on-functions.toml
# https://github.com/rpm-software-management/rpmlint/pull/672
Patch0: rpmlint-2.0.0-PR672.patch
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: %{py3_dist setuptools}
@ -37,6 +39,8 @@ and source packages as well as spec files can be checked.
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1 -b .672
# Don't lint the code or measure coverage in %%check
sed -i -e 's/ --cov=rpmlint//' -e 's/ --flake8//' setup.cfg
@ -61,6 +65,9 @@ cp -a %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{buildroot}%{_sysc
%{python3_sitelib}/rpmlint*
%changelog
* Thu Jul 1 2021 Tom Callaway <spot@fedoraproject.org> - 2.0.0-4
- fix rpmlint -i where it wrongly assumes a tmp dir
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 2.0.0-3
- Rebuilt for Python 3.10