summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyungJoo Ham <myungjoo.ham@samsung.com>2017-04-06 14:10:32 +0900
committerMyungJoo Ham <myungjoo.ham@samsung.com>2017-04-06 14:10:32 +0900
commitc76db55634c8ccef40675aef93ca3897d4d82735 (patch)
tree2817ca33b91e8affb3230b11cf26dc53d35799fc
parent3e3b12204906083c4b1bd3316c048ba307401fdd (diff)
downloadbuilding-blocks-c76db55634c8ccef40675aef93ca3897d4d82735.tar.gz
building-blocks-c76db55634c8ccef40675aef93ca3897d4d82735.tar.bz2
building-blocks-c76db55634c8ccef40675aef93ca3897d4d82735.zip
RULE: rule checker hide verbose message. -v to show them.
Change-Id: Icff0dba64b69c652b4e11a4b2738752ee4455ec4 Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
-rwxr-xr-xrule_checker.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/rule_checker.py b/rule_checker.py
index d01eff6..6bd830e 100755
--- a/rule_checker.py
+++ b/rule_checker.py
@@ -15,6 +15,12 @@ import os
import sys
import collections
+verbose = 0
+def print_v(*args):
+ global verbose
+ if verbose:
+ print(*args)
+
Block = collections.namedtuple('Block', 'name level parent children description files')
blocks = {}
@@ -74,7 +80,7 @@ def ruleCheckInterBlock():
def ruleCheckInc(file):
global blocks
- print("Checking "+file)
+ print_v("Checking "+file)
error = 0
warning = 0
@@ -150,7 +156,7 @@ def ruleCheckInc(file):
cs = blocks[n].children
cs.append(c)
blocks[n]._replace(children = cs)
- print("Children added to "+n+" of "+c)
+ print_v("Children added to "+n+" of "+c)
# RULE 5.1
if re.search(r'^\s*BuildRequires', line, re.IGNORECASE):
@@ -264,7 +270,7 @@ def ruleCheckInc(file):
p = re.sub(r'^([a-zA-Z0-9_]+-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+)-.*', r'\1', n)
p = re.sub(r'\n', r'', p) # remove trailing \n
- print("Block: "+n+", level = "+str(l)+", parent = ["+p+"]")
+ print_v("Block: "+n+", level = "+str(l)+", parent = ["+p+"]")
lastpkg = n
newBlock = Block(name=n, level=l, parent=p, children=[], description=0, files=0)
@@ -342,7 +348,17 @@ def ruleCheckInc(file):
def main():
- global blocks
+ global blocks, verbose
+
+ if len(sys.argv) > 1:
+ count = 0
+ for option in sys.argv:
+ count+=1
+ if (count == 1):
+ continue
+ if option == '-v':
+ verbose = 1
+
dirs = os.listdir("packaging/")
error = 0
@@ -356,9 +372,9 @@ def main():
warning += result[1]
elif re.search(r'^\..*\.sw.', file):
# skip if it is vi swap file
- print("There is a garbage in packaging. But let's skip (next version should check git status")
+ print_v("There is a garbage in packaging. But let's skip (next version should check git status")
elif not file == 'building-blocks.spec':
- print("Please do not put garbage files in packaging/ directory: "+file)
+ print("ERROR: Please do not put garbage files in packaging/ directory: "+file)
error += 1
result = ruleCheckInterBlock()