summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorbrian avery <brian.avery@intel.com>2017-04-19 12:49:02 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-20 07:55:26 +0100
commitecd485650c5b8d72df726258d9b347626ba26165 (patch)
treeca84f51f2834720cfa0eb763c2457a9de673ee7d /meta/lib/oe
parent7f0f7df8b3f699340382b35a4c599b0ac0bcc0f9 (diff)
downloadpoky-ecd485650c5b8d72df726258d9b347626ba26165.tar.gz
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] (From OE-Core rev: 4829f1ebd89dc91860cf72fbbdc7b6bb0d5822bc) Signed-off-by: brian avery <brian.avery@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/data.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/meta/lib/oe/data.py b/meta/lib/oe/data.py
index 80bba2b9d2..b8901e63f5 100644
--- a/meta/lib/oe/data.py
+++ b/meta/lib/oe/data.py
@@ -17,7 +17,7 @@ def typed_value(key, d):
17 except (TypeError, ValueError) as exc: 17 except (TypeError, ValueError) as exc:
18 bb.msg.fatal("Data", "%s: %s" % (key, str(exc))) 18 bb.msg.fatal("Data", "%s: %s" % (key, str(exc)))
19 19
20def export2json(d, json_file, expand=True): 20def export2json(d, json_file, expand=True, searchString="",replaceString=""):
21 data2export = {} 21 data2export = {}
22 keys2export = [] 22 keys2export = []
23 23
@@ -37,9 +37,11 @@ def export2json(d, json_file, expand=True):
37 37
38 for key in keys2export: 38 for key in keys2export:
39 try: 39 try:
40 data2export[key] = d.getVar(key, expand) 40 data2export[key] = d.getVar(key, expand).replace(searchString,replaceString)
41 except bb.data_smart.ExpansionError: 41 except bb.data_smart.ExpansionError:
42 data2export[key] = '' 42 data2export[key] = ''
43 except AttributeError:
44 pass
43 45
44 with open(json_file, "w") as f: 46 with open(json_file, "w") as f:
45 json.dump(data2export, f, skipkeys=True, indent=4, sort_keys=True) 47 json.dump(data2export, f, skipkeys=True, indent=4, sort_keys=True)