SpecCheck: Avoid false positives detecting %setup lines
https://sourceforge.net/p/rpmlint/tickets/41/ Modified-by: Ville Skyttä <ville.skytta@iki.fi> (removed whitespace before %setup as it doesn't actually parse that way)
This commit is contained in:
parent
ffc47e8a10
commit
91da39bbd3
|
@ -96,6 +96,7 @@ conflicts_regex = re.compile('^(?:Build)?Conflicts:\s*(.*)', re.IGNORECASE)
|
||||||
|
|
||||||
compop_regex = re.compile('[<>=]')
|
compop_regex = re.compile('[<>=]')
|
||||||
|
|
||||||
|
setup_regex = re.compile(r'%setup\b') # intentionally no whitespace before!
|
||||||
setup_q_regex = re.compile(' -[A-Za-z]*q')
|
setup_q_regex = re.compile(' -[A-Za-z]*q')
|
||||||
setup_t_regex = re.compile(' -[A-Za-z]*T')
|
setup_t_regex = re.compile(' -[A-Za-z]*T')
|
||||||
setup_ab_regex = re.compile(' -[A-Za-z]*[ab]')
|
setup_ab_regex = re.compile(' -[A-Za-z]*[ab]')
|
||||||
|
@ -259,7 +260,7 @@ class SpecCheck(AbstractCheck.AbstractCheck):
|
||||||
if if_regex.search(line):
|
if if_regex.search(line):
|
||||||
if_depth = if_depth + 1
|
if_depth = if_depth + 1
|
||||||
|
|
||||||
if line.startswith('%setup'):
|
if setup_regex.match(line):
|
||||||
if not setup_q_regex.search(line):
|
if not setup_q_regex.search(line):
|
||||||
# Don't warn if there's a -T without -a or -b
|
# Don't warn if there's a -T without -a or -b
|
||||||
if setup_t_regex.search(line):
|
if setup_t_regex.search(line):
|
||||||
|
|
Loading…
Reference in New Issue