From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=63.147.10.40; helo=atlmailgw1.ami.com; envelope-from=felixp@ami.com; receiver=edk2-devel@lists.01.org Received: from atlmailgw1.ami.com (atlmailgw1.ami.com [63.147.10.40]) (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 7DB46202E533A for ; Fri, 22 Feb 2019 14:06:03 -0800 (PST) X-AuditID: ac1060b2-78bff70000002bc0-9d-5c70724a04f0 Received: from atlms2.us.megatrends.com (atlms2.us.megatrends.com [172.16.96.152]) (using TLS with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client did not present a certificate) by atlmailgw1.ami.com (Symantec Messaging Gateway) with SMTP id 65.F6.11200.A42707C5; Fri, 22 Feb 2019 17:06:02 -0500 (EST) Received: from ATLMS1.us.megatrends.com ([fe80::8c55:daf0:ef05:5605]) by atlms2.us.megatrends.com ([fe80::29dc:a91e:ea0c:cdeb%12]) with mapi id 14.03.0415.000; Fri, 22 Feb 2019 17:06:01 -0500 From: Felix Polyudov To: 'BobCF' , "edk2-devel@lists.01.org" CC: Carsey Jaben , Liming Gao Thread-Topic: [edk2] [Patch] BaseTools: Enable component override functionality Thread-Index: AQHUqVbPDa+3ofVc4UiB1DmFvGY4TqXsokVA Date: Fri, 22 Feb 2019 22:06:02 +0000 Message-ID: <9333E191E0D52B4999CE63A99BA663A00302C6691D@atlms1.us.megatrends.com> References: <20190111023851.9172-1-bob.c.feng@intel.com> In-Reply-To: <20190111023851.9172-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.99.93] content-transfer-encoding: quoted-printable MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIKsWRmVeSWpSXmKPExsWyRiBhhq5XUUGMweY2fotfR+exWew5dJTZ YmPTH1aLFfc2sDuweCze85LJo3v2P5YApqgGRpvEvLz8ksSSVIWU1OJkW6WAosyyxORKJYXM FFslQyWFgpzE5NTc1LwSW6XEgoLUvBQlOy4FDGADVJaZp5Cal5yfkpmXbqvkGeyva2Fhaqlr qGQXkpGqkJmXll+Um1iSmZ+nkJyfVwJUnZoCFFVI6OLMmNXcwV5w1aHi8GPhBsZ9Bl2MnBwS AiYSS/rWsIHYQgK7mCQmvHPvYuQCsg8zSizc+oEJJMEmoCpxfHUzC4gtIhApMe/RHrAGZgEf iUerFjOC2MICARKX155khqgJlPi/6zyUbSSxu/EFO4jNAjTn4J5FYDN5gWpu35nMBLHYQuJp ex+YzSlgKfH4QDeYzSggJvH91BomiF3iEreezGeCOFpAYskeiPkSAqISLx//Y4WwFSS2vO9k h6jXkViw+xPUndoSyxa+ZobYKyhxcuYTlgmMorOQjJ2FpGUWkpZZSFoWMLKsYhRKLMnJTczM SS831EvMzdRLzs/dxAhJEZt2MLZcND/EKMDBqMTDOzOrIEaINbGsuDL3EKMEB7OSCG+XIVCI NyWxsiq1KD++qDQntfgQoxMwWCYyS3GDYgsY/fHGBgZSojCOoYmZibmRuaGlibmxsZI4b77a pyghgXRgMspOTS1ILYIZwsTBKdXAyLP/n8Ld+cUir3M3ztV/Wxlxb7ebRZkZ7ze3U7azv/4/ lzal96+YnkTB/SkL3rR1vg1vnTdT+n+J7dv9G7essyrKfv8yaon5AnNtTjvNJ+vu1Vw+tEAj stJk8wMvadOG5hWf9p86t9b+5Q9uz6vdRxs/BnEVzpOPjC36wdooUX3FyD2T7YH8TSWW4oxE Qy3mouJEACLN0C80AwAA Subject: Re: [Patch] BaseTools: Enable component override functionality X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 22:06:03 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Bob, Do you know if DSC specification has been updated to document this new behav= ior? If not, it should be updated. -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of BobCF Sent: Thursday, January 10, 2019 9:39 PM To: edk2-devel@lists.01.org Cc: Carsey Jaben; Liming Gao Subject: [edk2] [Patch] BaseTools: Enable component override functionality https://bugzilla.tianocore.org/show_bug.cgi?id=3D1449 This patch enable build tools to recognize that when two given files have the same GUID, file path and ARCH in Dsc, The later one's definition will be used. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng Cc: Liming Gao Cc: Carsey Jaben --- .../Source/Python/Workspace/DscBuildData.py | 24 ++++++++++++------- .../Source/Python/Workspace/MetaFileParser.py | 5 ++++ .../Source/Python/Workspace/MetaFileTable.py | 7 ++++-- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/S= ource/Python/Workspace/DscBuildData.py index 7e82e8e934..f9805f58f5 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -704,36 +704,44 @@ class DscBuildData(PlatformBuildClassObject): if TAB_DEFAULT_STORES_DEFAULT not in self.DefaultStores: self.DefaultStores[TAB_DEFAULT_STORES_DEFAULT] =3D (0, TAB_= DEFAULT_STORES_DEFAULT) GlobalData.gDefaultStores =3D sorted(self.DefaultStores.keys()) return self.DefaultStores + def OverrideDuplicateModule(self): + RecordList =3D self._RawData[MODEL_META_DATA_COMPONENT, self._Arch] + Macros =3D self._Macros + Macros["EDK_SOURCE"] =3D GlobalData.gEcpSource + Components =3D {} + for Record in RecordList: + ModuleId =3D Record[6] + file_guid =3D self._RawData[MODEL_META_DATA_HEADER, self._Arch,= None, ModuleId] + file_guid_str =3D file_guid[0][2] if file_guid else "NULL" + ModuleFile =3D PathClass(NormPath(Record[0], Macros), GlobalDat= a.gWorkspace, Arch=3Dself._Arch) + if self._Arch !=3D TAB_ARCH_COMMON and (file_guid_str,str(Modul= eFile)) in Components: + self._RawData.DisableOverrideComponent(Components[(file_gui= d_str,str(ModuleFile))]) + Components[(file_guid_str,str(ModuleFile))] =3D ModuleId + self._RawData._PostProcessed =3D False ## Retrieve [Components] section information @property def Modules(self): if self._Modules is not None: return self._Modules - + self.OverrideDuplicateModule() self._Modules =3D OrderedDict() RecordList =3D self._RawData[MODEL_META_DATA_COMPONENT, self._Arch] Macros =3D self._Macros Macros["EDK_SOURCE"] =3D GlobalData.gEcpSource for Record in RecordList: - DuplicatedFile =3D False - ModuleFile =3D PathClass(NormPath(Record[0], Macros), GlobalDat= a.gWorkspace, Arch=3Dself._Arch) ModuleId =3D Record[6] LineNo =3D Record[7] # check the file validation ErrorCode, ErrorInfo =3D ModuleFile.Validate('.inf') if ErrorCode !=3D 0: EdkLogger.error('build', ErrorCode, File=3Dself.MetaFile, L= ine=3DLineNo, ExtraData=3DErrorInfo) - # Check duplication - # If arch is COMMON, no duplicate module is checked since all m= odules in all component sections are selected - if self._Arch !=3D TAB_ARCH_COMMON and ModuleFile in self._Modu= les: - DuplicatedFile =3D True Module =3D ModuleBuildClassObject() Module.MetaFile =3D ModuleFile # get module private library instance @@ -792,12 +800,10 @@ class DscBuildData(PlatformBuildClassObject): else: OptionString =3D Module.BuildOptions[ToolChainFamily, T= oolChain] Module.BuildOptions[ToolChainFamily, ToolChain] =3D Opt= ionString + " " + Option RecordList =3D self._RawData[MODEL_META_DATA_HEADER, self._Arch= , None, ModuleId] - if DuplicatedFile and not RecordList: - EdkLogger.error('build', FILE_DUPLICATED, File=3Dself.MetaF= ile, ExtraData=3Dstr(ModuleFile), Line=3DLineNo) if RecordList: if len(RecordList) !=3D 1: EdkLogger.error('build', OPTION_UNKNOWN, 'Only FILE_GUI= D can be listed in section.', File=3Dself.MetaFile, ExtraData=3Dstr(M= oduleFile), Line=3DLineNo) ModuleFile =3D ProcessDuplicatedInf(ModuleFile, RecordList[= 0][2], GlobalData.gWorkspace) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools= /Source/Python/Workspace/MetaFileParser.py index 032220813b..a52e9229df 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1711,10 +1711,15 @@ class DscParser(MetaFileParser): def __ProcessBuildOption(self): self._ValueList =3D [ReplaceMacro(Value, self._Macros, RaiseError= =3DFalse) for Value in self._ValueList] + def DisableOverrideComponent(self,module_id): + for ori_id in self._IdMapping: + if self._IdMapping[ori_id] =3D=3D module_id: + self._RawTable.DisableComponent(ori_id) + _SectionParser =3D { MODEL_META_DATA_HEADER : _DefineParser, MODEL_EFI_SKU_ID : _SkuIdParser, MODEL_EFI_DEFAULT_STORES : _DefaultStoresP= arser, MODEL_EFI_LIBRARY_INSTANCE : _LibraryInstanc= eParser, diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools/= Source/Python/Workspace/MetaFileTable.py index 004e9494c3..823a87e057 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileTable.py +++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py @@ -74,11 +74,11 @@ class MetaFileTable(): def SetEndFlag(self): self.CurrentContent.append(self._DUMMY_) def GetAll(self): - return [item for item in self.CurrentContent if item[0] >=3D 0 ] + return [item for item in self.CurrentContent if item[0] >=3D 0 and= item[-1]>=3D0] ## Python class representation of table storing module data class ModuleTable(MetaFileTable): _COLUMN_ =3D ''' ID REAL PRIMARY KEY, @@ -371,11 +371,10 @@ class PlatformTable(MetaFileTable): # def Query(self, Model, Scope1=3DNone, Scope2=3DNone, BelongsToItem=3DNo= ne, FromItem=3DNone): QueryTab =3D self.CurrentContent result =3D [item for item in QueryTab if item[1] =3D=3D Model and i= tem[-1]>0 ] - if Scope1 is not None and Scope1 !=3D TAB_ARCH_COMMON: Sc1 =3D set(['COMMON']) Sc1.add(Scope1) result =3D [item for item in result if item[5] in Sc1] Sc2 =3D set( ['COMMON','DEFAULT']) @@ -395,10 +394,14 @@ class PlatformTable(MetaFileTable): result =3D [item for item in result if item[9] =3D=3D FromItem] result =3D [ [r[2],r[3],r[4],r[5],r[6],r[7],r[0],r[9]] for r in res= ult ] return result + def DisableComponent(self,comp_id): + for item in self.CurrentContent: + if item[0] =3D=3D comp_id or item[8] =3D=3D comp_id: + item[-1] =3D -1 ## Factory class to produce different storage for different type of meta-fi= le class MetaFileStorage(object): _FILE_TABLE_ =3D { MODEL_FILE_INF : ModuleTable, -- 2.19.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Please consider the environment before printing this email. The information contained in this message may be confidential and proprietar= y to American Megatrends, Inc. This communication is intended to be read on= ly by the individual or entity to whom it is addressed or by their designee.= If the reader of this message is not the intended recipient, you are on not= ice that any distribution of this message, in any form, is strictly prohibit= ed. Please promptly notify the sender by reply e-mail or by telephone at 77= 0-246-8600, and then delete or destroy all copies of the transmission.