From: MyungJoo Ham Date: Thu, 16 Mar 2017 06:30:30 +0000 (+0900) Subject: RULE: enforce rule check at build X-Git-Tag: submit/tizen/20170405.075452~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F50%2F119250%2F1;p=tools%2Fbuilding-blocks.git RULE: enforce rule check at build Change-Id: I67f55b495fcc864cfb54d3d202cb2ed9f4585e8a Signed-off-by: MyungJoo Ham --- diff --git a/packaging/building-blocks.spec b/packaging/building-blocks.spec index 8f52507..d68f19c 100644 --- a/packaging/building-blocks.spec +++ b/packaging/building-blocks.spec @@ -40,6 +40,9 @@ Source3700: platform-preset-home_appliance.inc # To get .ks files BuildRequires: image-configurations +# To check the rules +BuildRequires: python + # Root Domains Suggests: %{name}-root-Kernel Suggests: %{name}-root-SystemFW @@ -100,10 +103,13 @@ In Tizen building blocks, "Requires" means mandatory package. end \ end}} +%prep +%setup %build -ls /usr/share/image-configurations/ +# rule_checker returns non-zero if there is an error in *.inc, breaking the build +python ./rule_checker.py %files diff --git a/rule_checker.py b/rule_checker.py index 068a36e..e17f6d0 100755 --- a/rule_checker.py +++ b/rule_checker.py @@ -53,6 +53,11 @@ def ruleCheckInc(file): error += 1 print("ERROR: RULE 1.1 to ensure 1.1, do not use -n option in package name") + # Implicit / General Rule + if re.search('^\s*%package\s', line, re.IGNORECASE) and not re.search('^\s*%package\s', line): + error += 1 + print('ERROR: (General) Please use %package, not '+re.search('^%package')) + # RULE 1-3 if re.search('^\s*%package', line) and not re.search('^\s*%package\s*(root)|(sub1)|(sub2)', line): error +=1