1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

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]

(From OE-Core rev: 50ea44c19005b536a2791113f8b536fd10548ead)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Markus Lehtonen
2017-01-13 15:12:43 +02:00
committed by Richard Purdie
parent 28858af49f
commit 47aac40869
+5 -3
View File
@@ -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)