fix issue with epath on macros, fix python35 issues

This commit is contained in:
Tom Callaway 2015-11-30 14:12:19 -05:00
parent e162585b4a
commit 16156f17aa
3 changed files with 54 additions and 2 deletions

View File

@ -0,0 +1,12 @@
diff -up rpmlint-rpmlint-1.8/TagsCheck.py.epathfix rpmlint-rpmlint-1.8/TagsCheck.py
--- rpmlint-rpmlint-1.8/TagsCheck.py.epathfix 2015-11-30 13:59:57.338676145 -0500
+++ rpmlint-rpmlint-1.8/TagsCheck.py 2015-11-30 14:00:08.181558438 -0500
@@ -435,7 +435,7 @@ private_so_paths = set()
for path in ('%perl_archlib', '%perl_vendorarch', '%perl_sitearch',
'%python_sitearch', '%ruby_sitearch', '%php_extdir'):
epath = rpm.expandMacro(path)
- if epath != path:
+ if epath and epath != path:
private_so_paths.add(epath)
private_so_paths.add(re.sub(r'/lib64(?=/|$)', '/lib', epath))
private_so_paths.add(re.sub(r'/lib(?=/|$)', '/lib64', epath))

View File

@ -0,0 +1,35 @@
diff -up rpmlint-rpmlint-1.8/FilesCheck.py.py35 rpmlint-rpmlint-1.8/FilesCheck.py
--- rpmlint-rpmlint-1.8/FilesCheck.py.py35 2015-11-30 14:04:42.008425141 -0500
+++ rpmlint-rpmlint-1.8/FilesCheck.py 2015-11-30 14:06:31.960635048 -0500
@@ -210,7 +210,7 @@ kernel_package_regex = re.compile('^kern
normal_zero_length_regex = re.compile('^/etc/security/console\.apps/|/\.nosearch$|/__init__\.py$')
perl_regex = re.compile('^/usr/lib/perl5/(?:vendor_perl/)?([0-9]+\.[0-9]+)\.([0-9]+)/')
python_regex = re.compile('^/usr/lib(?:64)?/python([.0-9]+)/')
-python_bytecode_regex_pep3147 = re.compile('^(.*)/__pycache__/(.*)\.(.*)(\.py[oc])$')
+python_bytecode_regex_pep3147 = re.compile('^(.*)/__pycache__/(.*?)\.([^.]+)(\.opt-[12])?\.py[oc]$')
python_bytecode_regex = re.compile('^(.*)(\.py[oc])$')
python_default_version = Config.getOption('PythonDefaultVersion', None)
perl_version_trick = Config.getOption('PerlVersionTrick', True)
diff -up rpmlint-rpmlint-1.8/test/test_files.py.py35 rpmlint-rpmlint-1.8/test/test_files.py
--- rpmlint-rpmlint-1.8/test/test_files.py.py35 2015-11-30 14:07:38.248158721 -0500
+++ rpmlint-rpmlint-1.8/test/test_files.py 2015-11-30 14:07:32.263201728 -0500
@@ -0,0 +1,19 @@
+from FilesCheck import python_bytecode_to_script as pbts
+
+
+class TestPythonBytecodeToScript(object):
+
+ def test_pep3147(self):
+ assert pbts("/usr/lib64/python3.4/__pycache__/__phello__.foo.cpython-34.pyc") == "/usr/lib64/python3.4/__phello__.foo.py"
+ assert pbts("/usr/lib64/python3.4/__pycache__/__phello__.foo.cpython-34.pyo") == "/usr/lib64/python3.4/__phello__.foo.py"
+
+ def test_py2(self):
+ assert pbts("/usr/lib/python2.7/site-packages/_pytest/main.pyc") == "/usr/lib/python2.7/site-packages/_pytest/main.py"
+ assert pbts("/usr/lib/python2.7/site-packages/_pytest/main.pyo") == "/usr/lib/python2.7/site-packages/_pytest/main.py"
+
+ def test_pep0488(self):
+ assert pbts("/usr/lib/python3.5/site-packages/__pycache__/pytest.cpython-35.opt-1.pyc") == "/usr/lib/python3.5/site-packages/pytest.py"
+ assert pbts("/usr/lib/python3.5/site-packages/__pycache__/pytest.cpython-35.opt-2.pyc") == "/usr/lib/python3.5/site-packages/pytest.py"
+ assert pbts("/usr/lib/python3.5/site-packages/__pycache__/pytest.cpython-35.pyc") == "/usr/lib/python3.5/site-packages/pytest.py"
+
+# ex: ts=4 sw=4 et

View File

@ -14,7 +14,7 @@
Name: rpmlint
Version: 1.8
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Tool for checking common errors in RPM packages
Group: Development/Tools
License: GPLv2
@ -26,7 +26,10 @@ Source3: %{name}-etc.config
Source4: %{name}.config.el4
# EL-5 specific config
Source5: %{name}.config.el5
# https://github.com/rpm-software-management/rpmlint/commit/4e8657f47fb15b7a871b88054d15ea1141dd55b3
Patch0: rpmlint-1.8-epathfix.patch
# https://github.com/rpm-software-management/rpmlint/commit/3b0286ba7f2192807b6d1eadf1fe7c46cc364854
Patch1: rpmlint-1.8-python35-fix.patch
BuildArch: noarch
%if %{with python3}
BuildRequires: python3-devel
@ -75,6 +78,8 @@ and source packages as well as spec files can be checked.
%prep
%setup -q -n %{name}-%{name}-%{version}
%patch0 -p1 -b .epathfix
%patch1 -p1 -b .py35
sed -i -e /MenuCheck/d Config.py
cp -p config config.example
install -pm 644 %{SOURCE3} config