From nobody Thu May 2 14:09:30 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1492069066098684.5723102088049; Thu, 13 Apr 2017 00:37:46 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 062D121939238; Thu, 13 Apr 2017 00:37:45 -0700 (PDT) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4A18421A18AAA for ; Thu, 13 Apr 2017 00:37:43 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Apr 2017 00:37:42 -0700 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by orsmga002.jf.intel.com with ESMTP; 13 Apr 2017 00:37:41 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,194,1488873600"; d="scan'208";a="73504379" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Thu, 13 Apr 2017 15:37:38 +0800 Message-Id: <1492069058-18964-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch] BaseTools: Copy "TianoCore" userextensions into As Built Inf X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Per build spec to update the tool to copy "TianoCore" userextensions to As Built INF file. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- BaseTools/Source/Python/AutoGen/AutoGen.py | 36 ++++++++++++++++++= ++++ .../Source/Python/AutoGen/InfSectionParser.py | 18 +++++++++++ 2 files changed, 54 insertions(+) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 285e4a4..c18802f 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -138,10 +138,12 @@ ${END} ## @LIB_INSTANCES${BEGIN} # ${libraryclasses_item}${END} =20 ${depexsection_item} =20 +${userextension_tianocore_item} + ${tail_comments} =20 [BuildOptions.${module_arch}] ## @AsBuilt${BEGIN} ## ${flags_item}${END} @@ -3077,10 +3079,34 @@ class ModuleAutoGen(AutoGen): if len(DepexExpressionList) > 0: EdkLogger.verbose('') self._DepexExpressionList[ModuleType] =3D DepexExpressionL= ist return self._DepexExpressionList =20 + # Get the tiano core user extension, it is contain dependent library. + # @retval: a list contain tiano core userextension. + # + def _GetTianoCoreUserExtensionList(self): + TianoCoreUserExtentionList =3D [] + for M in [self.Module] + self.DependentLibraryList: + Filename =3D M.MetaFile.Path + InfObj =3D InfSectionParser.InfSectionParser(Filename) + TianoCoreUserExtenList =3D InfObj.GetUserExtensionTianoCore() + for TianoCoreUserExtent in TianoCoreUserExtenList: + for Section in TianoCoreUserExtent.keys(): + ItemList =3D Section.split(TAB_SPLIT) + Arch =3D self.Arch + if len(ItemList) =3D=3D 4: + Arch =3D ItemList[3] + if Arch.upper() =3D=3D TAB_ARCH_COMMON or Arch.upper()= =3D=3D self.Arch.upper(): + TianoCoreList =3D [] + TianoCoreList.extend([TAB_SECTION_START + Section = + TAB_SECTION_END]) + TianoCoreList.extend(TianoCoreUserExtent[Section][= :]) + TianoCoreList.append('\n') + TianoCoreUserExtentionList.append(TianoCoreList) + + return TianoCoreUserExtentionList + ## Return the list of specification version required for the module # # @retval list The list of specification defined in module fi= le # def _GetSpecification(self): @@ -4044,10 +4070,20 @@ class ModuleAutoGen(AutoGen): =20 # Generated LibraryClasses section in comments. for Library in self.LibraryAutoGenList: AsBuiltInfDict['libraryclasses_item'] +=3D [Library.MetaFile.F= ile.replace('\\', '/')] =20 + # Generated UserExtensions TianoCore section. + # All tianocore user extensions are copied. + UserExtStr =3D '' + for TianoCore in self._GetTianoCoreUserExtensionList(): + UserExtStr +=3D '\n'.join(TianoCore) + ExtensionFile =3D os.path.join(self.MetaFile.Dir, TianoCore[1]) + if os.path.isfile(ExtensionFile): + shutil.copy2(ExtensionFile, self.OutputDir) + AsBuiltInfDict['userextension_tianocore_item'] =3D UserExtStr + # Generated depex expression section in comments. AsBuiltInfDict['depexsection_item'] =3D '' DepexExpresion =3D self._GetDepexExpresionString() if DepexExpresion: AsBuiltInfDict['depexsection_item'] =3D DepexExpresion diff --git a/BaseTools/Source/Python/AutoGen/InfSectionParser.py b/BaseTool= s/Source/Python/AutoGen/InfSectionParser.py index 7f78236..cdc9e5e 100644 --- a/BaseTools/Source/Python/AutoGen/InfSectionParser.py +++ b/BaseTools/Source/Python/AutoGen/InfSectionParser.py @@ -60,10 +60,28 @@ class InfSectionParser(): FindEnd =3D True self._FileSectionDataList.append({SectionLine: SectionData= [:]}) SectionData =3D [] SectionLine =3D '' =20 + # Get user extension TianoCore data + # + # @return: a list include some dictionary that key is section and valu= e is a list contain all data. + def GetUserExtensionTianoCore(self): + UserExtensionTianoCore =3D [] + if not self._FileSectionDataList: + return UserExtensionTianoCore + for SectionDataDict in self._FileSectionDataList: + for key in SectionDataDict.keys(): + if key.lower().startswith("[userextensions") and key.lower= ().find('.tianocore.') > -1: + SectionLine =3D key.lstrip(TAB_SECTION_START).rstrip(T= AB_SECTION_END) + SubSectionList =3D [SectionLine] + if str(SectionLine).find(TAB_COMMA_SPLIT) > -1: + SubSectionList =3D str(SectionLine).split(TAB_COMM= A_SPLIT) + for SubSection in SubSectionList: + if SubSection.lower().find('.tianocore.') > -1: + UserExtensionTianoCore.append({SubSection: Sec= tionDataDict[key]}) + return UserExtensionTianoCore =20 # Get depex expresion # # @return: a list include some dictionary that key is section and valu= e is a list contain all data. def GetDepexExpresionList(self): --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel