Dirk Mueller
2764482b3b
0001-Handle-post-scripts-that-contain-non-ascii-character.patch OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=515
53 lines
2.0 KiB
Diff
53 lines
2.0 KiB
Diff
From bcc9a315dae3aacf27854f16328c59e32eab2816 Mon Sep 17 00:00:00 2001
|
|
From: Dirk Mueller <dirk@dmllr.de>
|
|
Date: Thu, 28 Sep 2017 23:04:22 +0200
|
|
Subject: [PATCH 3/3] Tighten lib_regex to avoid false positive in python
|
|
bindings
|
|
|
|
Also add unit test coverage for it.
|
|
---
|
|
FilesCheck.py | 2 +-
|
|
test/test_files.py | 17 +++++++++++++++++
|
|
2 files changed, 18 insertions(+), 1 deletion(-)
|
|
|
|
Index: rpmlint-rpmlint-1.10/FilesCheck.py
|
|
===================================================================
|
|
--- rpmlint-rpmlint-1.10.orig/FilesCheck.py
|
|
+++ rpmlint-rpmlint-1.10/FilesCheck.py
|
|
@@ -197,7 +197,7 @@ devel_regex = re.compile(r'(.*)-(debug(i
|
|
debuginfo_package_regex = re.compile(r'-debug(info)?$')
|
|
debugsource_package_regex = re.compile(r'-debugsource$')
|
|
use_debugsource = Config.getOption('UseDebugSource', False)
|
|
-lib_regex = re.compile(r'lib(64)?/lib[^/]*(\.so\..*|-[0-9.]+\.so)')
|
|
+lib_regex = re.compile(r'/lib(?:64)?/lib[^/]+(?:\.so\.[\d\.]+|-[\d\.]+\.so)$')
|
|
ldconfig_regex = re.compile(r'^[^#]*ldconfig', re.MULTILINE)
|
|
depmod_regex = re.compile(r'^[^#]*depmod', re.MULTILINE)
|
|
install_info_regex = re.compile(r'^[^#]*install-info', re.MULTILINE)
|
|
Index: rpmlint-rpmlint-1.10/test/test_files.py
|
|
===================================================================
|
|
--- rpmlint-rpmlint-1.10.orig/test/test_files.py
|
|
+++ rpmlint-rpmlint-1.10/test/test_files.py
|
|
@@ -62,3 +62,22 @@ def test_scm_regex():
|
|
assert scm_regex.search('/bar/foo,v')
|
|
assert scm_regex.search('bar/.svnignore')
|
|
assert scm_regex.search('bar/.git/refs')
|
|
+
|
|
+
|
|
+def test_lib_regex():
|
|
+ from FilesCheck import lib_regex
|
|
+
|
|
+ # true matches
|
|
+ assert all(
|
|
+ lib_regex.search(x) for x in
|
|
+ ('/lib/libnsl-2.26.so',
|
|
+ '/usr/lib64/libgnomeui.so.3',
|
|
+ '/lib64/libgcc_s.so.1'))
|
|
+
|
|
+ # false positives
|
|
+ assert not any(
|
|
+ lib_regex.search(x) for x in
|
|
+ ('/usr/share/gdb/auto-load/usr/lib/libglib-2.0.so.0.4600.1-gdb.py',
|
|
+ '/usr/share/doc/findlib/lib-1.0.so',
|
|
+ '/usr/lib64/libvulkan_radeon.so',
|
|
+ '/usr/lib64/rsocket/binary',))
|