SHA256
1
0
forked from pool/rpmlint

- add suse-tests-without-badness.patch,

0001-Extend-scm_regex-to-capture-more-SCM-system-files.patch,
      0003-Tighten-lib_regex-to-avoid-false-positive-in-python-.patch

OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=488
This commit is contained in:
Dirk Mueller 2017-09-28 21:08:20 +00:00 committed by Git OBS Bridge
parent 7aa2b48d0f
commit f110300963
4 changed files with 105 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From 1d70b641e5f755de72b0fa0059d4979a79f9553c Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Thu, 28 Sep 2017 22:16:30 +0200
Subject: [PATCH 1/3] Extend scm_regex to capture more SCM system files
Also add unit test coverage for it.
---
FilesCheck.py | 4 +++-
test/test_files.py | 10 ++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index a7724de..87965bc 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -201,7 +201,9 @@ 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)
perl_temp_file_regex = re.compile(r'.*perl.*/(\.packlist|perllocal\.pod)$')
-scm_regex = re.compile(r'/CVS/[^/]+$|/\.(bzr|cvs|git|hg)ignore$|/\.hgtags$|/\.(bzr|git|hg|svn)/|/(\.arch-ids|{arch})/')
+scm_regex = re.compile(
+ r'/(?:RCS|CVS)/[^/]+$|/\.(?:bzr|cvs|git|hg|svn)ignore$|'
+ r',v$|/\.hgtags$|/\.(?:bzr|git|hg|svn)/|/(?:\.arch-ids|{arch})/')
games_path_regex = re.compile(r'^/usr(/lib(64)?)?/games/')
games_group_regex = re.compile(Config.getOption('RpmGamesGroups', DEFAULT_GAMES_GROUPS))
dangling_exceptions = Config.getOption('DanglingSymlinkExceptions', DEFAULT_DANGLING_EXCEPTIONS)
diff --git a/test/test_files.py b/test/test_files.py
index 469a227..f26c0c3 100644
--- a/test/test_files.py
+++ b/test/test_files.py
@@ -52,3 +52,13 @@ def test_script_interpreter():
assert se(b"#! /usr/bin/perl -wT \n") == ("/usr/bin/perl", "-wT")
assert se(b"#!/usr/bin/env python3 foo") == ("/usr/bin/env", "python3 foo")
assert se(b"# something here\n#!not a shebang") == (None, "")
+
+
+def test_scm_regex():
+ from FilesCheck import scm_regex
+
+ assert scm_regex.search('/foo/CVS/bar')
+ assert scm_regex.search('/foo/RCS/bar')
+ assert scm_regex.search('/bar/foo,v')
+ assert scm_regex.search('bar/.svnignore')
+ assert scm_regex.search('bar/.git/refs')
--
2.14.1

View File

@ -0,0 +1,53 @@
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(-)
diff --git a/FilesCheck.py b/FilesCheck.py
index 57de8fb..1852b38 100644
--- a/FilesCheck.py
+++ b/FilesCheck.py
@@ -196,7 +196,7 @@ devel_regex = re.compile(r'(.*)-(debug(info|source)?|devel|headers|source|static
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\.]+|\.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)
diff --git a/test/test_files.py b/test/test_files.py
index f26c0c3..bfffda5 100644
--- a/test/test_files.py
+++ b/test/test_files.py
@@ -62,3 +62,20 @@ 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',
+ '/lib64/libSegFault.so',
+ '/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/lib64/rsocket/binary',))
--
2.14.1

View File

@ -69,7 +69,9 @@ Thu Sep 28 10:40:08 UTC 2017 - dmueller@suse.com
- drop version-control-internal-file.diff, boo1027577-license_tag.patch: upstream
- drop sourced-dirs.diff, fix-shared-library-matching.diff, suse-python-abi-check.diff: obsolete
- drop suse-readd_terminator_in_regex.patch: merged into original patch
- add suse-tests-without-badness.patch
- add suse-tests-without-badness.patch,
0001-Extend-scm_regex-to-capture-more-SCM-system-files.patch,
0003-Tighten-lib_regex-to-avoid-false-positive-in-python-.patch
-------------------------------------------------------------------
Thu Sep 28 09:37:04 UTC 2017 - dmueller@suse.com

View File

@ -100,6 +100,8 @@ Patch54: suse-ignore-specfile-errors.diff
Patch55: invalid-filerequires.diff
Patch57: check-for-self-provides.diff
Patch58: add-check-for-tmpfiles-created-at-r.diff
Patch59: 0001-Extend-scm_regex-to-capture-more-SCM-system-files.patch
Patch60: 0003-Tighten-lib_regex-to-avoid-false-positive-in-python-.patch
Patch70: rpmlint-all-pie.patch
# PATCHLIST END
# BuildArch must at the end. is a bug: https://bugzilla.suse.com/show_bug.cgi?id=926766