Updated patch to trigger handlestr() when unicode string is found
during iteration json.loads(config.json). Unicode and list with data
expansion were not handled hence adding this patch to handle conversion.
Added a debug message to dump pretty json data populated to ourconfig[c].

e.g "REPO_STASH_DIR" read as ${BASE_HOMEDIR}/git/mirror, where it should be
    "REPO_STASH_DIR" as /home/pokybuild/git/mirror

Signed-off-by: Aaron Chan <aaron.chun.yew.c...@intel.com>
---
 scripts/utils.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/utils.py b/scripts/utils.py
index d26cd0c..32caa4f 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -152,11 +152,13 @@ def loadconfig():
         except:
             pass
 
-    def handlestr(config, ourconfig, c):
+    def handlestr(config, ourconfig, c, debug=False):
         if not c in ourconfig:
             ourconfig[c] = config[c]
         if isinstance(config[c], str):
             resolvexp(r"(\${(.+)})", config, c)
+        if debug:
+            print(json.dumps(ourconfig[c], indent=4, sort_keys=True))
         
     ourconfig = {}
     for f in files.split():
@@ -168,6 +170,8 @@ def loadconfig():
             for c in config:
                 if isinstance(config[c], dict):
                     handledict(config, ourconfig, c)
+                elif isinstance(config[c], str):
+                    handlestr(config, ourconfig, c)
                 else:
                     ourconfig[c] = config[c]
 
-- 
2.7.4

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to