From 1d70b641e5f755de72b0fa0059d4979a79f9553c Mon Sep 17 00:00:00 2001 From: Dirk Mueller 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(-) Index: rpmlint-rpmlint-1.10/FilesCheck.py =================================================================== --- rpmlint-rpmlint-1.10.orig/FilesCheck.py +++ rpmlint-rpmlint-1.10/FilesCheck.py @@ -202,7 +202,9 @@ ldconfig_regex = re.compile(r'^[^#]*ldco 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) 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 @@ -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')