continue
# Prevent: https://github.com/rpm-software-management/rpm/issues/158
- if re.search('^#.*[^%]%[^%]', line) and !re.search('^#!', line):
+ if re.search('^#.*[^%]%[^%]', line) and not re.search('^#!', line):
error += 1
print("ERROR: unless it is shebang, you must not have rpm macro in a # comment. They are expanded and multiline macro will do unexpected effects.")
continue
# RULE 5.2
- if re.search('^\s*Recommends', line, re.IGNORECASE) or
- re.search('^\s*Provides', line, re.IGNORECASE) or
- re.search('^\s*Enhances', line, re.IGNORECASE) or
+ if re.search('^\s*Recommends', line, re.IGNORECASE) or \
+ re.search('^\s*Provides', line, re.IGNORECASE) or \
+ re.search('^\s*Enhances', line, re.IGNORECASE) or \
re.search('^\s*Supplements', line, re.IGNORECASE):
error += 1
print("ERROR: RULE 5.2 .inc file cannot have unsupported relations")
print("ERROR: RULE 1.1 to ensure 1.1, do not use -n option in package name")
# RULE 1-3
- if !re.search('^\s*%package\s*(root)|(sub1)|(sub2)'):
+ if re.search('^\s*%package', line) and not re.search('^\s*%package\s*(root)|(sub1)|(sub2)', line):
error +=1
- print("ERROR: RULE 1.3 the send prefix should be root, sub1, or sub2")
+ print("ERROR: RULE 1.3 the send prefix should be root, sub1, or sub2.")
error += result[0]
warning += result[1]
- print('Error: '+error)
- print('Warning: '+warning)
+ print('Error: '+str(error))
+ print('Warning: '+str(warning))
return error