From nobody Tue Nov 26 02:15:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+59353+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59353+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1589306650; cv=none; d=zohomail.com; s=zohoarc; b=aGOkKFrh8Xj2y6cMJk+rJ9Um4HJMFbU+O9UeRO5PbGj9yw4HO/JYFLp642+3CZEkNDfnRA/GNbSqM7Kmug5ezG08UKvYNG2ybY/NPeu+dTAJfbAwW8qzprmLC7ujbXBrYK097ZdSKFUwSVwKk5yITa0XXZg0LXaH/uEG5VNqGHw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589306650; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=r4fjzytHtKSq2tvXBR13FQaDr3sV83AATu1qiuh0fCs=; b=S8xwMINDZ4hyK4Q6gBcuCdmWLtBOKc7LXzsSgzITxGjgp52AxCmQZYoQZzWujOkEz7c5exHD3seJ6sMf6XTOgdFT6xqOg7SiCGSDpB+yicdoB/URUpdE/60faYB+uwbPLWuml1kxYDwi30OPgE6EYBX9VVeCVkZKoen8+dC78nI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59353+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 15893066501241000.1194239477106; Tue, 12 May 2020 11:04:10 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id JWpsYY1788612xOSaqF0fEpn; Tue, 12 May 2020 11:04:09 -0700 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web12.619.1589306648411974121 for ; Tue, 12 May 2020 11:04:08 -0700 IronPort-SDR: 7QFeZupj32VFXyeCout1yWkpS1LkwM5D5qmcQGy37kViPeHNhPP4TtePx5Rk8Fm4TZrI1jebKz gbNFr9VEE6qQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2020 11:04:07 -0700 IronPort-SDR: OBL2DwSD/0yIjABsq9GEZI3XKq0Al7w9ot5bqGchf/Lti4coz+IPQYodtmZQORLxIdH9N3aSsi 0Q5DmmvG4TEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,384,1583222400"; d="scan'208";a="306548714" X-Received: from ecbjorge-mobl1.amr.corp.intel.com ([10.254.2.156]) by FMSMGA003.fm.intel.com with ESMTP; 12 May 2020 11:04:06 -0700 From: "Bjorge, Erik C" To: devel@edk2.groups.io Cc: Ashley E Desimone , Nate DeSimone , Puja Pandya , Bret Barkelew , Prince Agyeman Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Adding manifest support for submodule init Date: Tue, 12 May 2020 11:04:00 -0700 Message-Id: <643f03028f1dd1cfc8b51dcbb024b851b9414900.1589306304.git.erik.c.bjorge@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,erik.c.bjorge@intel.com X-Gm-Message-State: u7kox7s0OTUsTK5WpDBzQdUDx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589306649; bh=IQhzsaRdY4f0TSvRsTl3B58LxfFLydvrkPO/lMW6WXc=; h=Cc:Date:From:Reply-To:Subject:To; b=QdhVQ/88605GqAZlf5lNCpIYyY6fUmAMtYPVGGKdr4wkWgkDFlGA5S9wL2OmrlJBajj vmyGOF7Im73jmnvA86oH9kRiutB9z40SkkExeA0rrPpHAfjGam/Y5hZvo6Ez66UI4tteR 8o2tVD+FCjwoGaD/WaoRUIvxQPV2BxQW32M= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Enabling support for selective submodule initialization in the manifest file. This will allow for more control over the submodules that are initialized. If this section is not present the existing functionality will be used. Signed-off-by: Erik Bjorge Cc: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Bret Barkelew Cc: Prince Agyeman Reviewed-by: Ashley DeSimone --- edkrepo_manifest_parser/edk_manifest.py | 78 +++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/edkrepo_manifest_parser/edk_manifest.py b/edkrepo_manifest_par= ser/edk_manifest.py index 1e2b111..45be2fe 100644 --- a/edkrepo_manifest_parser/edk_manifest.py +++ b/edkrepo_manifest_parser/edk_manifest.py @@ -37,6 +37,7 @@ FolderToFolderMappingFolder =3D namedtuple('FolderToFolde= rMappingFolder', ['projec FolderToFolderMappingFolderExclude =3D namedtuple('FolderToFolderMappingFo= lderExclude', ['path']) =20 SubmoduleAlternateRemote =3D namedtuple('SubmoduleAlternateRemote', ['remo= te_name', 'original_url', 'alternate_url']) +SubmoduleInitPath =3D namedtuple('SubmoduleInitPath', ['remote_name', 'com= bo', 'recursive', 'path']) =20 REQUIRED_ATTRIB_ERROR_MSG =3D "Required attribute malformed in <{}>: {}" NO_ASSOCIATED_REMOTE =3D 'There are no remotes associated with the ClientG= itHook entry:\nsource:{} destination:{}' \ @@ -138,6 +139,7 @@ class ManifestXml(BaseXmlHelper): self._commit_templates =3D {} # dict of commit message t= emplates with the remote name as the key self._folder_to_folder_mappings =3D [] # List of FolderToFolderMa= pping objects self._submodule_alternate_remotes =3D [] + self._submodule_init_list =3D [] =20 # # Append include XML's to the Manifest etree before parsing @@ -191,6 +193,13 @@ class ManifestXml(BaseXmlHelper): for element in subroot.iter(tag=3D'SubmoduleAlternateRemote'): self._submodule_alternate_remotes.append(_SubmoduleAlterna= teRemote(element, self._remotes)) =20 + # + # Determine submodule initialization paths + # + for subroot in self._tree.iter(tag=3D'SelectiveSubmoduleInitList'): + for element in subroot.iter(tag=3D'Submodule'): + self._submodule_init_list.append(_SubmoduleInitEntry(eleme= nt)) + # # parse tags # requires RemoteList to be parsed first @@ -386,6 +395,22 @@ class ManifestXml(BaseXmlHelper): alternates.append(alternate.tuple) return alternates =20 + def get_submodule_init_paths(self, remote_name=3DNone, combo=3DNone): + submodule_list =3D [] + if remote_name is None and combo is None: + submodule_list =3D self._tuple_list(self._submodule_init_list) + elif remote_name is not None and combo is None: + submodule_list =3D self._tuple_list( + [x for x in self._submodule_init_list if x.remote_name =3D= =3D remote_name]) + elif remote_name is None and combo is not None: + submodule_list =3D self._tuple_list( + [x for x in self._submodule_init_list if x.combo =3D=3D co= mbo or x.combo is None]) + else: + submodule_list =3D self._tuple_list( + [x for x in self._submodule_init_list + if x.remote_name =3D=3D remote_name and (x.combo =3D=3D c= ombo or x.combo is None)]) + return submodule_list + def write_current_combo(self, combo_name, filename=3DNone): # # Updates the CurrentClonedCombo tag of _tree attribute and writes= the entire tree out to the @@ -460,6 +485,10 @@ class ManifestXml(BaseXmlHelper): if self._tree.find('SubmoduleAlternateRemotes'): submodule_alt_url_root =3D ET.SubElement(pin_root, 'SubmoduleA= lternateRemotes') =20 + selective_submodules_root =3D None + if self._tree.find('SelectiveSubmoduleInitList'): + selective_submodules_root =3D ET.SubElement(pin_root, 'Selecti= veSubmoduleInitList') + remote_root =3D ET.SubElement(pin_root, 'RemoteList') source_root =3D ET.SubElement(pin_root, 'Combination') source_root.attrib['name'] =3D self._combinations[combo_name].name @@ -487,6 +516,13 @@ class ManifestXml(BaseXmlHelper): if alt_url_element.attrib['remote'] =3D=3D src_tuple.r= emote_name: submodule_alt_url_root.append(alt_url_element) =20 + for subroot_selective_subs in self._tree.iter('SelectiveSubmod= uleInitList'): + for selective_sub in subroot_selective_subs.iter('Submodul= e'): + if selective_sub.attrib['remote'] =3D=3D src_tuple.rem= ote_name: + if 'combo' in selective_sub.attrib and selective_s= ub.attrib['combo'] !=3D combo_name: + continue + selective_submodules_root.append(selective_sub) + sparse =3D 'true' if src_tuple.sparse else 'false' sub =3D 'true' if src_tuple.enable_submodule else 'false' # Write the source element based on what value branch or commi= t is available. @@ -535,6 +571,10 @@ class ManifestXml(BaseXmlHelper): submodule_alt_url_root.text =3D '\n ' submodule_alt_url_root.tail =3D '\n\n ' list(submodule_alt_url_root)[-1].tail =3D '\n ' + if selective_submodules_root: + selective_submodules_root.text =3D '\n ' + selective_submodules_root.tail =3D '\n\n ' + list(selective_submodules_root)[-1].tail =3D '\n ' remote_root.text =3D '\n ' remote_root.tail =3D '\n\n ' list(remote_root)[-1].tail =3D '\n ' @@ -882,6 +922,27 @@ class _SubmoduleAlternateRemote(): return SubmoduleAlternateRemote(self.remote_name, self.originalUrl= , self.altUrl) =20 =20 +class _SubmoduleInitEntry(): + def __init__(self, element): + try: + self.remote_name =3D element.attrib['remote'] + self.path =3D element.text + except KeyError as k: + raise KeyError(REQUIRED_ATTRIB_ERROR_MSG.format(k, element.tag= )) + try: + self.combo =3D element.attrib['combo'] + except Exception: + self.combo =3D None + try: + self.recursive =3D element.attrib['recursive'].lower() =3D=3D = 'true' + except Exception: + self.recursive =3D False + + @property + def tuple(self): + return SubmoduleInitPath(self.remote_name, self.combo, self.recurs= ive, self.path) + + # # Optional entry point for debug and validation of the CiIndexXml & Manife= stXml classes # @@ -956,6 +1017,23 @@ def main(): for alt in alts: print(alt) =20 + print('\nGet Submodule Init Objects') + print('\nAll:') + for entry in test_manifest.get_submodule_init_paths(): + print('+ {}'.format(entry)) + print('\nPer Remote:') + for remote in test_manifest.remotes: + for entry in test_manifest.get_submodule_init_paths(remote.nam= e): + print('+ {}'.format(entry)) + print('\nCurrent Combo:') + current_combo =3D test_manifest.general_config.current_combo + for entry in test_manifest.get_submodule_init_paths(combo=3Dcurren= t_combo): + print('+ {}'.format(entry)) + print('\nCurrent Combo Per Remote:') + for remote in test_manifest.remotes: + for entry in test_manifest.get_submodule_init_paths(remote.nam= e, current_combo): + print('+ {}'.format(entry)) + if not test_manifest.is_pin_file(): print('\nSparse settings:') print(test_manifest.sparse_settings) --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59353): https://edk2.groups.io/g/devel/message/59353 Mute This Topic: https://groups.io/mt/74164692/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-