RULE: add rulechk 1.6/1.7. fix block defs accordingly 64/119264/1
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 16 Mar 2017 07:22:58 +0000 (16:22 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 16 Mar 2017 07:22:58 +0000 (16:22 +0900)
Change-Id: If83c96417c4318c2fafef70993c5ebd799f99c9e
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
RULES
packaging/platform-preset-mobile.inc
rule_checker.py

diff --git a/RULES b/RULES
index 85ce751a1a7ab166bbe53d0f5917ff13c306b2a4..226aaad7ffb3f19ead28ede6a463227a1d6462b6 100644 (file)
--- a/RULES
+++ b/RULES
@@ -27,6 +27,7 @@
 
 1-8. In order to implement "radio-button" UI (choose only one), the block name starts with "chooseonlyone_"
        E.g., "building-blocks-root-chooseonlyone_Kernel"
+       #### CAUTION: NOT SUPPORTED. NOT GUARANTEED TO WORK AS SUPPOSED ####
 
 1-9. [NAME] = [a-zA-Z0-9_]+
 
index ca0172507a84a025753fdd82a463a20d2efd97a3..738d2c1bf462d7b54a031045a40283f9862f9426 100644 (file)
@@ -8,8 +8,8 @@ Conflicts:      %{name}-sub1-preset-wearable
 Conflicts:     %{name}-sub1-preset-ivi
 Conflicts:     %{name}-sub1-preset-iot
 Suggests:      %{name}-sub2-preset-mobile-tm1
-Suggests:      %{name}-sub2-preset-mobile-tm2-aarch64
-Suggests:      %{name}-sub2-preset-mobile-tm2-armv7l
+Suggests:      %{name}-sub2-preset-mobile-tm2_aarch64
+Suggests:      %{name}-sub2-preset-mobile-tm2_armv7l
 Suggests:      %{name}-sub2-preset-mobile-minimal
 %description sub1-preset-mobile
 Tizen Mobile Platform Presets
@@ -18,8 +18,8 @@ Tizen Mobile Platform Presets
 
 %package sub2-preset-mobile-tm1
 Summary:       Mobile-TM1 Preset
-Conflicts:     %{name}-sub2-preset-mobile-tm2-aarch64
-Conflicts:     %{name}-sub2-preset-mobile-tm2-armv7l
+Conflicts:     %{name}-sub2-preset-mobile-tm2_aarch64
+Conflicts:     %{name}-sub2-preset-mobile-tm2_armv7l
 Conflicts:     %{name}-sub2-preset-mobile-minimal
 # image-configuration must have this file supplied.
 %list_with_require %{_datadir}/image-configurations/mobile-wayland-armv7l-tm1.ks
@@ -33,30 +33,30 @@ You may need mobile + tm1 MIC post script as well.
 (TIC RECIPE for POST is not READY YET)
 %files sub2-preset-mobile-tm1
 
-%package sub2-preset-mobile-tm2-aarch64
+%package sub2-preset-mobile-tm2_aarch64
 Summary:       Mobile-TM2 Preset
 Conflicts:     %{name}-sub2-preset-mobile-tm1
-Conflicts:     %{name}-sub2-preset-mobile-tm2-armv7l
+Conflicts:     %{name}-sub2-preset-mobile-tm2_armv7l
 Conflicts:     %{name}-sub2-preset-mobile-minimal
 # image-configuration must have this file supplied.
 %list_with_require %{_datadir}/image-configurations/mobile-wayland-arm64-tm2.ks
-%description sub2-preset-mobile-tm2-aarch64
+%description sub2-preset-mobile-tm2_aarch64
 Tizen Mobile TM2 Preset. This is for aarch64 architecture only.
 For architectural/post-script note, please refer to tm1 twin.
-%files sub2-preset-mobile-tm2-aarch64
+%files sub2-preset-mobile-tm2_aarch64
 
-%package sub2-preset-mobile-tm2-armv7l
+%package sub2-preset-mobile-tm2_armv7l
 Summary:       Mobile-TM2 Preset
 Conflicts:     %{name}-sub2-preset-mobile-tm1
-Conflicts:     %{name}-sub2-preset-mobile-tm2-aarch64
+Conflicts:     %{name}-sub2-preset-mobile-tm2_aarch64
 Conflicts:     %{name}-sub2-preset-mobile-minimal
 # image-configuration must have this file supplied.
 %list_with_require %{_datadir}/image-configurations/mobile-wayland-armv7l-tm2.ks
-%description sub2-preset-mobile-tm2-armv7l
+%description sub2-preset-mobile-tm2_armv7l
 Tizen Mobile TM2 Preset. This is for armv7l architecture only.
 Although TM2 has 64bit processor, we may use 32bit userspace binaries for it.
 For architectural/post-script note, please refer to tm1 twin.
-%files sub2-preset-mobile-tm2-armv7l
+%files sub2-preset-mobile-tm2_armv7l
 
 %package sub2-preset-mobile-minimal
 Summary:       Mobile Minimal Preset
index 539ee8a2381f685ac45ac60cfbbc9551defb11a7..abf4212fea1e9ff15a7cfe26b2175f3efe750e7d 100755 (executable)
@@ -8,6 +8,11 @@
 # This does not check all rules of "RULES"
 # This is a prototype with a lot of work in progress
 
+# TODO: Context-Aware Rule Check. (inter-block relations)
+# Check if root exists for RULE 1-6
+# Check if sub1 exists for RULE 1-7
+# Check if a block is "Suggested/Required" by another block (orphan check)
+
 
 
 from __future__ import print_function
@@ -76,14 +81,30 @@ def ruleCheckInc(file):
            report(file, lc, line)
            continue
 
-        # RULE 1-5 + 1-9 / there is - in the name
+        # RULE 1-9 for root block (1-5)
         if re.search('^\s*%package\s*root', line) and  \
-            not re.search('^\s*%package\s*root-[a-zA-Z0-9_]*\s*$', line):
+            not re.search('^\s*%package\s*root-[a-zA-Z0-9_]+\s*$', line):
             error += 1
            print("ERROR: RULE 1.9 not met with root (RULE 1.5)")
            report(file, lc, line)
            continue
 
+       # RULE 1-9 for sub1 block (1-6)
+       if re.search('^\s*%package\s*sub1', line) and   \
+           not re.search('^\s*%package\s*sub1-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+\s*$', line):
+           error += 1
+           print("ERROR: RULE 1.9 not met with sub1 (RULE 1.6)")
+           report(file, lc, line)
+           continue
+
+       # RULE 1-9 for sub2 block (1-7)
+       if re.search('^\s*%package\s*sub2', line) and   \
+           not re.search('^\s*%package\s*sub2-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+-[a-zA-Z0-9_]+\s*$', line):
+           error += 1
+           print("ERROR: RULE 1.9 not met with sub1 (RULE 1.7)")
+           report(file, lc, line)
+           continue
+