Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mail.openembedded.org (Postfix) with ESMTP id BED2471D97 for ; Fri, 13 Jan 2017 13:12:55 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP; 13 Jan 2017 05:12:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,221,1477983600"; d="scan'208";a="1112091342" Received: from hessakys-mobl1.ger.corp.intel.com (HELO mqz-osx-suse64.fi.intel.com) ([10.252.14.44]) by fmsmga002.fm.intel.com with ESMTP; 13 Jan 2017 05:12:55 -0800 From: Markus Lehtonen To: openembedded-core@lists.openembedded.org Date: Fri, 13 Jan 2017 15:12:43 +0200 Message-Id: <1484313166-29604-8-git-send-email-markus.lehtonen@linux.intel.com> X-Mailer: git-send-email 2.6.6 In-Reply-To: <1484313166-29604-1-git-send-email-markus.lehtonen@linux.intel.com> References: <1484313166-29604-1-git-send-email-markus.lehtonen@linux.intel.com> Subject: [PATCH v2 07/10] oeqa.utils.metadata: have layer name as an attribute in xml X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2017 13:12:55 -0000 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] Signed-off-by: Markus Lehtonen --- 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 d5cc290..6331c21 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) -- 2.6.6