RULE: enforce rule check at build 50/119250/1
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 16 Mar 2017 06:30:30 +0000 (15:30 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 16 Mar 2017 06:30:30 +0000 (15:30 +0900)
Change-Id: I67f55b495fcc864cfb54d3d202cb2ed9f4585e8a
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
packaging/building-blocks.spec
rule_checker.py

index 8f52507..d68f19c 100644 (file)
@@ -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
 
index 068a36e..e17f6d0 100755 (executable)
@@ -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