From 47aac40869234b9f1d15a3b1c05a74b541fafe40 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 13 Jan 2017 15:12:43 +0200 Subject: 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 instead of . A bit better XML design. [YOCTO #10590] (From OE-Core rev: 50ea44c19005b536a2791113f8b536fd10548ead) Signed-off-by: Markus Lehtonen Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/lib/oeqa/utils/metadata.py | 8 +++++--- 1 file 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) -- cgit 1.2.3-korg