From 889dc5b76bc2754ff5c54c52857aa6fda382752e Mon Sep 17 00:00:00 2001 From: Tom spot Callaway Date: Thu, 1 Jul 2021 12:19:48 -0400 Subject: [PATCH] fix rpmlint -i where it wrongly assumes a tmp dir --- rpmlint-2.0.0-PR672.patch | 36 ++++++++++++++++++++++++++++++++++++ rpmlint.spec | 9 ++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 rpmlint-2.0.0-PR672.patch diff --git a/rpmlint-2.0.0-PR672.patch b/rpmlint-2.0.0-PR672.patch new file mode 100644 index 0000000..19ec05d --- /dev/null +++ b/rpmlint-2.0.0-PR672.patch @@ -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 diff --git a/rpmlint.spec b/rpmlint.spec index efb168b..438445b 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -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 - 2.0.0-4 +- fix rpmlint -i where it wrongly assumes a tmp dir + * Fri Jun 04 2021 Python Maint - 2.0.0-3 - Rebuilt for Python 3.10