[oe-commits] [openembedded-core] 08/12: meta: add search, replace strings to export2json

git at git.openembedded.org git at git.openembedded.org
Thu Apr 20 06:58:29 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 4829f1ebd89dc91860cf72fbbdc7b6bb0d5822bc
Author: brian avery <brian.avery at intel.com>
AuthorDate: Wed Apr 19 12:49:02 2017 -0700

    meta: add search, replace strings to export2json
    
    We want to be able to save relative paths so that we can relocate the
    deploy dir images and kernels, yet still have qemu and testimage work
    correctly.  This extends export2json with 2 named arguments so a
    search/replace operation can be done to remove the leading path.
    
    [YOCTO #11375]
    
    Signed-off-by: brian avery <brian.avery at intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/lib/oe/data.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oe/data.py b/meta/lib/oe/data.py
index 80bba2b..b8901e6 100644
--- a/meta/lib/oe/data.py
+++ b/meta/lib/oe/data.py
@@ -17,7 +17,7 @@ def typed_value(key, d):
     except (TypeError, ValueError) as exc:
         bb.msg.fatal("Data", "%s: %s" % (key, str(exc)))
 
-def export2json(d, json_file, expand=True):
+def export2json(d, json_file, expand=True, searchString="",replaceString=""):
     data2export = {}
     keys2export = []
 
@@ -37,9 +37,11 @@ def export2json(d, json_file, expand=True):
 
     for key in keys2export:
         try:
-            data2export[key] = d.getVar(key, expand)
+            data2export[key] = d.getVar(key, expand).replace(searchString,replaceString)
         except bb.data_smart.ExpansionError:
             data2export[key] = ''
+        except AttributeError:
+            pass
 
     with open(json_file, "w") as f:
         json.dump(data2export, f, skipkeys=True, indent=4, sort_keys=True)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list