From fe6ad61fcf3f773a06806f38426479a794ef4284 Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Thu, 16 Mar 2017 15:01:10 +0900 Subject: [PATCH] RULE: rule checker bugfix Change-Id: Ia230691e39b426fbf07df5f146d8e890f5b776a2 Signed-off-by: MyungJoo Ham --- rule_checker.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rule_checker.py b/rule_checker.py index 75d909c..068a36e 100755 --- a/rule_checker.py +++ b/rule_checker.py @@ -35,15 +35,15 @@ def ruleCheckInc(file): 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") @@ -54,9 +54,9 @@ def ruleCheckInc(file): 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.") @@ -79,8 +79,8 @@ def main(): error += result[0] warning += result[1] - print('Error: '+error) - print('Warning: '+warning) + print('Error: '+str(error)) + print('Warning: '+str(warning)) return error -- 2.34.1