[yocto] [PATCH 2/2] [yocto-ab-helper] utils.py: Resolved unicode data expansion

Aaron Chan aaron.chun.yew.chan at intel.com
Mon Jul 2 03:30:06 PDT 2018


A patch to fix the data expansion config.json

Signed-off-by: Aaron Chan <aaron.chun.yew.chan at intel.com>
---
 scripts/utils.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/scripts/utils.py b/scripts/utils.py
index 7c6535c..d26cd0c 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -142,6 +142,22 @@ def loadconfig():
             else:
                 ourconfig[c][x] = config[c][x]
 
+    def resolvexp(pattern, config, c):
+        try:
+            strMatch = re.compile(pattern)
+            expansion = strMatch.match(config[c]).group(1)
+            reference = strMatch.match(config[c]).group(2)
+            if reference:
+                ourconfig[c] = config[c].replace(expansion, config[reference])
+        except:
+            pass
+
+    def handlestr(config, ourconfig, c):
+        if not c in ourconfig:
+            ourconfig[c] = config[c]
+        if isinstance(config[c], str):
+            resolvexp(r"(\${(.+)})", config, c)
+        
     ourconfig = {}
     for f in files.split():
         p = f
-- 
2.7.4



More information about the yocto mailing list