SHA256
1
0
forked from pool/rpmlint
rpmlint/0001-Extend-scm_regex-to-capture-more-SCM-system-files.patch

48 lines
2.0 KiB
Diff
Raw Normal View History

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