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:47:22 +0000 |
| commit | 47aac40869234b9f1d15a3b1c05a74b541fafe40 (patch) | |
| tree | 7c8bac739263fd8f8cf6ac86c9cf046bfa83e07f /meta/lib/oeqa/utils | |
| parent | 28858af49fcc2a97957ba1e9c9e545980c47bfa9 (diff) | |
| download | poky-47aac40869234b9f1d15a3b1c05a74b541fafe40.tar.gz | |
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>
Diffstat (limited to 'meta/lib/oeqa/utils')
| -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): | |||
| 90 | with open(file_path, 'w') as f: | 90 | with open(file_path, 'w') as f: |
| 91 | f.write(xml_doc.toprettyxml()) | 91 | f.write(xml_doc.toprettyxml()) |
| 92 | 92 | ||
| 93 | def dict_to_XML(tag, dictionary): | 93 | def dict_to_XML(tag, dictionary, **kwargs): |
| 94 | """ Return XML element converting dicts recursively. """ | 94 | """ Return XML element converting dicts recursively. """ |
| 95 | 95 | ||
| 96 | elem = Element(tag) | 96 | elem = Element(tag, **kwargs) |
| 97 | for key, val in dictionary.items(): | 97 | for key, val in dictionary.items(): |
| 98 | if isinstance(val, MutableMapping): | 98 | if tag == 'layers': |
| 99 | child = (dict_to_XML('layer', val, name=key)) | ||
| 100 | elif isinstance(val, MutableMapping): | ||
| 99 | child = (dict_to_XML(key, val)) | 101 | child = (dict_to_XML(key, val)) |
| 100 | else: | 102 | else: |
| 101 | child = Element(key) | 103 | child = Element(key) |
