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] 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 a7724de3..87965bc4 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 469a2278..f26c0c30 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.42.0.windows.2

