diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2017-01-13 15:12:43 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-19 22:45:46 +0000 |
commit | 50ea44c19005b536a2791113f8b536fd10548ead (patch) | |
tree | 8557cd98f56217a60d00316e213471c1ad0ad697 /meta | |
parent | 7757970bced4ecd6503991c0cf11f4d9158f650c (diff) | |
download | openembedded-core-50ea44c19005b536a2791113f8b536fd10548ead.tar.gz openembedded-core-50ea44c19005b536a2791113f8b536fd10548ead.tar.bz2 openembedded-core-50ea44c19005b536a2791113f8b536fd10548ead.zip |
oeqa.utils.metadata: have layer name as an attribute in xml
Have the layer name as an attribute instead of of the name of the
element itself. That is, have <layer name="layer_name"/> instead of
<layer_name/>. A bit better XML design.
[YOCTO #10590]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/utils/metadata.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py index d5cc2906b1..6331c21f6d 100644 --- a/meta/lib/oeqa/utils/metadata.py +++ b/meta/lib/oeqa/utils/metadata.py @@ -90,12 +90,14 @@ def write_metadata_file(file_path, metadata): with open(file_path, 'w') as f: f.write(xml_doc.toprettyxml()) -def dict_to_XML(tag, dictionary): +def dict_to_XML(tag, dictionary, **kwargs): """ Return XML element converting dicts recursively. """ - elem = Element(tag) + elem = Element(tag, **kwargs) for key, val in dictionary.items(): - if isinstance(val, MutableMapping): + if tag == 'layers': + child = (dict_to_XML('layer', val, name=key)) + elif isinstance(val, MutableMapping): child = (dict_to_XML(key, val)) else: child = Element(key) |