From: MyungJoo Ham Date: Wed, 5 Apr 2017 11:19:55 +0000 (+0900) Subject: RULE: rule check on RULE 5.4 X-Git-Tag: submit/tizen/20170406.050031~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2041c6fa367550b665190d4b3f348a13b8963f7;p=tools%2Fbuilding-blocks.git RULE: rule check on RULE 5.4 Change-Id: Ia804e4f662c931c3b70f28e648f0129f7bfc4a15 Signed-off-by: MyungJoo Ham --- diff --git a/rule_checker.py b/rule_checker.py index eaa574f..28e1658 100755 --- a/rule_checker.py +++ b/rule_checker.py @@ -117,13 +117,36 @@ def ruleCheckInc(file): continue else: # If it's just a package, skip checking. - c = re.sub(r'^\s*((Suggests)|(Requires)):\s*%{name}-', r'', line) - if c == line: + cname = re.sub(r'^\s*((Suggests)|(Requires)):\s*%{name}-', r'', line) + if cname == line: continue c = re.sub(r'^\s*((Suggests)|(Requires)):\s*%{name}-sub[12]-', r'', line) c = re.sub(r'\s*', r'', c) c = re.sub(r'\n', r'', c) + # RULE 5.4 + if n[:6] != "preset" and n[:7] != "feature": + level = blocks[n].level + clevel = 0 + if cname[:4] == 'root': + clevel = 0 + elif cname[:4] == 'sub1': + clevel = 1 + elif cname[:4] == 'sub2': + clevel = 2 + elif cname[:4] == 'sub3': + clevel = 3 + if (clevel - 1) != level: + error += 1 + print("ERROR: RULE 5.4. Non preset/feature block cannot have non-direct chile block as its dependents (Requires/Suggests). Level Mismatch") + report(file, lc, line) + continue + if c[:len(n)] != n: + error += 1 + print("ERROR: RULE 5.4. Non preset/feature block cannot have non-direct chile block as its dependents (Requires/Suggests). Child from another hierarchy.") + report(file, lc, line) + continue + cs = blocks[n].children cs.append(c) blocks[n]._replace(children = cs)