Move regex that matches macros to AbstractCheck, use it, improve misspelled-macro info message.
git-svn-id: svn+ssh://rpmlint.zarb.org/home/projects/rpmlint/svn/trunk@1619 9bc8b190-ac0f-0410-8968-dc7d1f502856
This commit is contained in:
parent
ad0d6a882c
commit
005b606122
|
@ -11,6 +11,8 @@
|
|||
import re
|
||||
|
||||
|
||||
macro_regex = re.compile('(%+)[{(]?(\w+)')
|
||||
|
||||
class AbstractCheck:
|
||||
known_checks = {}
|
||||
|
||||
|
|
|
@ -205,7 +205,6 @@ log_regex = re.compile('^/var/log/[^/]+$')
|
|||
lib_path_regex = re.compile('^(/usr(/X11R6)?)?/lib(64)?')
|
||||
lib_package_regex = re.compile('^(lib|.+-libs)')
|
||||
hidden_file_regex = re.compile('/\.[^/]*$')
|
||||
misspelled_macro_regex = re.compile('%{.*}')
|
||||
siteperl_perl_regex = re.compile('/site_perl/')
|
||||
manifest_perl_regex = re.compile('^/usr/share/doc/perl-.*/MANIFEST(\.SKIP)?$')
|
||||
shebang_regex = re.compile('^#!\s*(\S*)')
|
||||
|
@ -329,8 +328,9 @@ class FilesCheck(AbstractCheck.AbstractCheck):
|
|||
is_doc = f in doc_files
|
||||
nonexec_file = False
|
||||
|
||||
if misspelled_macro_regex.search(f):
|
||||
printWarning(pkg, 'misspelled-macro', f)
|
||||
res = AbstractCheck.macro_regex.search(f)
|
||||
if res:
|
||||
printWarning(pkg, 'misspelled-macro', f, res.group(2))
|
||||
if standard_users and user not in standard_users:
|
||||
printWarning(pkg, 'non-standard-uid', f, user)
|
||||
if standard_groups and group not in standard_groups:
|
||||
|
@ -969,8 +969,9 @@ for the wrong kernel.''',
|
|||
configuration for them.''',
|
||||
|
||||
'misspelled-macro',
|
||||
'''This package contains a file which matches %{.*}; this is often the sign
|
||||
of a misspelled macro. Please check your spec file.''',
|
||||
'''This package contains a file which contains something that looks like an
|
||||
unexpanded macro; this is often the sign of a misspelling. Please check your
|
||||
specfile.''',
|
||||
|
||||
'manifest-in-perl-module',
|
||||
'''This perl module package contains a MANIFEST or a MANIFEST.SKIP file
|
||||
|
|
|
@ -48,7 +48,6 @@ hardcoded_lib_path_exceptions_regex = re.compile(Config.getOption('HardcodedLibP
|
|||
prereq_regex = re.compile('^PreReq(\(.*\))?:\s*(.+?)\s*$', re.IGNORECASE)
|
||||
buildprereq_regex = re.compile('^BuildPreReq:\s*(.+?)\s*$', re.IGNORECASE)
|
||||
use_utf8 = Config.getOption('UseUTF8', Config.USEUTF8_DEFAULT)
|
||||
macro_regex = re.compile('(%+)[{(]?(\w+)')
|
||||
libdir_regex = re.compile('%{?_lib(?:dir)?\}?\\b')
|
||||
comment_or_empty_regex = re.compile('^\s*(#|$)')
|
||||
defattr_regex = re.compile('^\s*%defattr\\b')
|
||||
|
@ -409,7 +408,7 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
|||
conf)
|
||||
|
||||
if current_section == 'changelog':
|
||||
res = macro_regex.search(line)
|
||||
res = AbstractCheck.macro_regex.search(line)
|
||||
if res and len(res.group(1)) % 2:
|
||||
printWarning(pkg, 'macro-in-%changelog', res.group(2))
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue