use proper folder _sourcedir for spec files
Resolves: https://bugzilla.redhat.com/1959363 Upstream: https://github.com/rpm-software-management/rpmlint/pull/633
This commit is contained in:
parent
8c896377da
commit
65f8e57bd5
@ -0,0 +1,48 @@
|
||||
From 8b7bcfad4fa8ee2577210f9e03c093d4e127b6fd Mon Sep 17 00:00:00 2001
|
||||
From: Martin Liska <mliska@suse.cz>
|
||||
Date: Tue, 11 May 2021 09:43:03 +0200
|
||||
Subject: [PATCH] Use proper folder _sourcedir for spec files.
|
||||
|
||||
Fixes #632.
|
||||
---
|
||||
SpecCheck.py | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/SpecCheck.py b/SpecCheck.py
|
||||
index 6b74e7f..bf21ed8 100644
|
||||
--- a/SpecCheck.py
|
||||
+++ b/SpecCheck.py
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
import re
|
||||
import sys
|
||||
+from pathlib import Path
|
||||
try:
|
||||
from urlparse import urlparse
|
||||
except ImportError: # Python 3
|
||||
@@ -155,6 +156,7 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
||||
|
||||
def check_spec(self, pkg, spec_file, spec_lines=None):
|
||||
self._spec_file = spec_file
|
||||
+ self._spec_file_dir = str(Path(self._spec_file).parent)
|
||||
spec_only = isinstance(pkg, Pkg.FakePkg)
|
||||
if not spec_lines:
|
||||
spec_lines = Pkg.readlines(spec_file)
|
||||
@@ -553,7 +555,7 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
||||
# capture and print them nicely, so we do it once each way :P
|
||||
|
||||
out = Pkg.getstatusoutput(
|
||||
- ('rpm', '-q', '--qf=', '-D', '_sourcedir %s' % pkg.dirName(), '--specfile', self._spec_file))
|
||||
+ ('rpm', '-q', '--qf=', '-D', '_sourcedir %s' % self._spec_file_dir, '--specfile', self._spec_file))
|
||||
parse_error = False
|
||||
for line in out[1].splitlines():
|
||||
# No such file or dir hack: https://bugzilla.redhat.com/487855
|
||||
@@ -566,7 +568,7 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
||||
# them with macros expanded for URL checking
|
||||
|
||||
spec_obj = None
|
||||
- rpm.addMacro('_sourcedir', pkg.dirName())
|
||||
+ rpm.addMacro('_sourcedir', self._spec_file_dir)
|
||||
try:
|
||||
ts = rpm.TransactionSet()
|
||||
spec_obj = ts.parseSpec(self._spec_file)
|
11
rpmlint.spec
11
rpmlint.spec
@ -20,7 +20,7 @@
|
||||
|
||||
Name: rpmlint
|
||||
Version: 1.11
|
||||
Release: 16%{?dist}
|
||||
Release: 17%{?dist}
|
||||
Summary: Tool for checking common errors in RPM packages
|
||||
License: GPLv2
|
||||
URL: https://github.com/rpm-software-management/rpmlint
|
||||
@ -39,6 +39,10 @@ Patch213: rpmlint-1.11-libc-warnings.patch
|
||||
# Don't use the %%python_sitelib macro, because it errors
|
||||
# See https://fedoraproject.org/wiki/Changes/PythonMacroError
|
||||
Patch214: rpmlint-1.11-no-python-macro.patch
|
||||
# Use proper folder _sourcedir for spec files
|
||||
# https://bugzilla.redhat.com/1959363
|
||||
# https://github.com/rpm-software-management/rpmlint/pull/633
|
||||
Patch215: rpmlint-1.11-use-proper-folder-_sourcedir-for-spec-files.patch
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: make
|
||||
@ -106,6 +110,7 @@ and source packages as well as spec files can be checked.
|
||||
%patch212 -p1
|
||||
%patch213 -p1
|
||||
%patch214 -p1
|
||||
%patch215 -p1
|
||||
|
||||
sed -i 's|1.10|%{version}|g' Makefile
|
||||
|
||||
@ -165,6 +170,10 @@ make check PYTHON=%{python} PYTEST=%{pytest} FLAKE8=%{flake8}
|
||||
%{_mandir}/man1/rpmlint.1*
|
||||
|
||||
%changelog
|
||||
* Tue May 11 2021 Todd Zullinger <tmz@pobox.com> - 1.11-17
|
||||
- use proper folder _sourcedir for spec files (upstream PR#633)
|
||||
Resolves: rhbz#1959363
|
||||
|
||||
* Tue Apr 13 2021 Miro Hrončok <mhroncok@redhat.com> - 1.11-16
|
||||
- Filter out empty specfile-errors, they are duplicates
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user