fix rpmlintrc load from cmdline option (bz2000018)
This commit is contained in:
parent
cfe9d89a45
commit
256a77a06f
61
rpmlint-2.1.0-fix-rpmlintrc-load-from-cmdline-v3.patch
Normal file
61
rpmlint-2.1.0-fix-rpmlintrc-load-from-cmdline-v3.patch
Normal file
@ -0,0 +1,61 @@
|
||||
diff -up rpmlint-2.1.0/rpmlint/cli.py.fix-rpmlintrc-load-from-cmdline rpmlint-2.1.0/rpmlint/cli.py
|
||||
--- rpmlint-2.1.0/rpmlint/cli.py.fix-rpmlintrc-load-from-cmdline 2021-09-17 10:07:00.599255215 -0400
|
||||
+++ rpmlint-2.1.0/rpmlint/cli.py 2021-09-17 10:08:29.337741059 -0400
|
||||
@@ -83,7 +83,7 @@ def process_lint_args(argv):
|
||||
parser.add_argument('-V', '--version', action='version', version=__version__, help='show package version and exit')
|
||||
parser.add_argument('-c', '--config', type=_validate_conf_location, help='load up additional configuration data from specified path (file or directory with *.toml files)')
|
||||
parser.add_argument('-e', '--explain', nargs='+', default='', help='provide detailed explanation for one specific message id')
|
||||
- parser.add_argument('-r', '--rpmlintrc', type=Path, help='load up specified rpmlintrc file')
|
||||
+ parser.add_argument('-r', '--rpmlintrc', type=_is_file_path, help='load up specified rpmlintrc file')
|
||||
parser.add_argument('-v', '--verbose', '--info', action='store_true', help='provide detailed explanations where available')
|
||||
parser.add_argument('-p', '--print-config', action='store_true', help='print the settings that are in effect when using the rpmlint')
|
||||
parser.add_argument('-i', '--installed', nargs='+', default='', help='installed packages to be validated by rpmlint')
|
||||
@@ -164,6 +164,13 @@ def _validate_conf_location(string):
|
||||
return config_paths
|
||||
|
||||
|
||||
+def _is_file_path(path):
|
||||
+ p = Path(path)
|
||||
+ if not p.is_file():
|
||||
+ raise argparse.ArgumentTypeError(f'{path} is not a valid file path')
|
||||
+ return p
|
||||
+
|
||||
+
|
||||
def lint():
|
||||
"""
|
||||
Main wrapper for lint command processing
|
||||
diff -up rpmlint-2.1.0/rpmlint/lint.py.fix-rpmlintrc-load-from-cmdline rpmlint-2.1.0/rpmlint/lint.py
|
||||
--- rpmlint-2.1.0/rpmlint/lint.py.fix-rpmlintrc-load-from-cmdline 2021-08-17 09:31:56.000000000 -0400
|
||||
+++ rpmlint-2.1.0/rpmlint/lint.py 2021-09-17 10:11:13.989642586 -0400
|
||||
@@ -35,6 +35,9 @@ class Lint(object):
|
||||
self.profile.enable()
|
||||
else:
|
||||
self.profile = None
|
||||
+
|
||||
+ if options['rpmlintrc']:
|
||||
+ options['rpmlintrc'] = [options['rpmlintrc']]
|
||||
self._load_rpmlintrc()
|
||||
if options['verbose']:
|
||||
self.config.info = options['verbose']
|
||||
@@ -161,6 +164,9 @@ class Lint(object):
|
||||
Load rpmlintrc from argument or load up from folder
|
||||
"""
|
||||
if self.options['rpmlintrc']:
|
||||
+ # Right now, we allow loading of just a single file, but the 'opensuse'
|
||||
+ # branch contains auto-loading mechanism that can eventually load
|
||||
+ # multiple files.
|
||||
for rcfile in self.options['rpmlintrc']:
|
||||
self.config.load_rpmlintrc(rcfile)
|
||||
else:
|
||||
diff -up rpmlint-2.1.0/test/test_lint.py.fix-rpmlintrc-load-from-cmdline rpmlint-2.1.0/test/test_lint.py
|
||||
--- rpmlint-2.1.0/test/test_lint.py.fix-rpmlintrc-load-from-cmdline 2021-08-17 09:31:56.000000000 -0400
|
||||
+++ rpmlint-2.1.0/test/test_lint.py 2021-09-17 10:06:40.937147554 -0400
|
||||
@@ -410,7 +410,7 @@ def test_run_rpmlintrc_multiple(capsys,
|
||||
def test_run_rpmlintrc_single_file(capsys, packages):
|
||||
additional_options = {
|
||||
'rpmfile': [packages],
|
||||
- 'rpmlintrc': [TEST_RPMLINTRC]
|
||||
+ 'rpmlintrc': TEST_RPMLINTRC
|
||||
}
|
||||
options = {**options_preset, **additional_options}
|
||||
linter = Lint(options)
|
@ -2,7 +2,7 @@
|
||||
|
||||
Name: rpmlint
|
||||
Version: 2.1.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
|
||||
@ -16,6 +16,9 @@ Source5: warn-on-functions.toml
|
||||
Patch0: rpmlint-2.1.0-include-iso-639-2-collective-language-codes.patch
|
||||
# Ignore hidden-file-or-dir for .cargo-checksum.json, merged upstream
|
||||
Patch1: https://github.com/rpm-software-management/rpmlint/pull/700.patch
|
||||
# Fix rpmlintrc load from cmdline
|
||||
# v3 reflects final upstream commits
|
||||
Patch2: rpmlint-2.1.0-fix-rpmlintrc-load-from-cmdline-v3.patch
|
||||
BuildArch: noarch
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: %{py3_dist setuptools}
|
||||
@ -44,6 +47,7 @@ and source packages as well as spec files can be checked.
|
||||
%setup -q -n %{name}-%{version}
|
||||
%patch0 -p1 -b .iso-639-2
|
||||
%patch1 -p1 -b .700
|
||||
%patch2 -p1 -b .fix-rpmlintrc-load-from-cmdline
|
||||
|
||||
# Don't lint the code or measure coverage in %%check
|
||||
sed -i -e 's/ --cov=rpmlint//' -e 's/ --flake8//' setup.cfg
|
||||
@ -71,6 +75,9 @@ cp -a %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{buildroot}%{_sysc
|
||||
%{python3_sitelib}/rpmlint*
|
||||
|
||||
%changelog
|
||||
* Thu Sep 16 2021 Tom Callaway <spot@fedoraproject.org> - 2.1.0-4
|
||||
- fix rpmlintrc load from cmdline option (bz2000018)
|
||||
|
||||
* Sun Sep 05 2021 Miro Hrončok <mhroncok@redhat.com> - 2.1.0-3
|
||||
- Ignore hidden-file-or-dir for .cargo-checksum.json
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user