Report all unexpanded macros in files and changelogs, not just first of line.

git-svn-id: svn+ssh://rpmlint.zarb.org/home/projects/rpmlint/svn/trunk@1696 9bc8b190-ac0f-0410-8968-dc7d1f502856
This commit is contained in:
Ville Skyttä 2010-01-19 21:46:51 +00:00
parent a475327fbb
commit eaec3236bb
3 changed files with 8 additions and 7 deletions

View File

@ -11,7 +11,8 @@
import re
macro_regex = re.compile('(%+)[{(]?\w+[)}]?')
# Note: do not add any capturing parentheses here
macro_regex = re.compile('%+[{(]?\w+[)}]?')
class AbstractCheck:
known_checks = {}

View File

@ -381,9 +381,8 @@ class FilesCheck(AbstractCheck.AbstractCheck):
is_doc = f in doc_files
nonexec_file = False
res = AbstractCheck.macro_regex.search(f)
if res:
printWarning(pkg, 'misspelled-macro', f, res.group(0))
for match in AbstractCheck.macro_regex.findall(f):
printWarning(pkg, 'misspelled-macro', f, match)
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:

View File

@ -408,9 +408,10 @@ class SpecCheck(AbstractCheck.AbstractCheck):
conf)
if current_section == 'changelog':
res = AbstractCheck.macro_regex.search(line)
if res and len(res.group(1)) % 2:
printWarning(pkg, 'macro-in-%changelog', res.group(0))
for match in AbstractCheck.macro_regex.findall(line):
res = re.match('%+', match)
if len(res.group(0)) % 2:
printWarning(pkg, 'macro-in-%changelog', match)
else:
if not depscript_override:
depscript_override = depscript_override_regex.search(line) is not None