From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=bob.c.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 9201A211CD9AC for ; Sat, 23 Feb 2019 00:37:41 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2019 00:37:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,402,1544515200"; d="scan'208";a="145887610" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 23 Feb 2019 00:37:40 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sat, 23 Feb 2019 00:37:40 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.172]) with mapi id 14.03.0415.000; Sat, 23 Feb 2019 16:37:37 +0800 From: "Feng, Bob C" To: Felix Polyudov , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" , "Gao, Liming" Thread-Topic: [edk2] [Patch] BaseTools: Enable component override functionality Thread-Index: AQHUqVbQZCag4BhgL02D105KwSk6MqXsHM4AgAEtNBA= Date: Sat, 23 Feb 2019 08:37:37 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D16008D9EE@SHSMSX101.ccr.corp.intel.com> References: <20190111023851.9172-1-bob.c.feng@intel.com> <9333E191E0D52B4999CE63A99BA663A00302C6691D@atlms1.us.megatrends.com> In-Reply-To: <9333E191E0D52B4999CE63A99BA663A00302C6691D@atlms1.us.megatrends.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzUwYmI0MTMtN2E0NS00MDY1LWI4OWEtNzFlZmM2ZjU5NDM2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaEZrdFwvd1I5ckpsTUNZU0h3OU8yclJwTDJFNnczRnNDNXpYY1hYUk5nRTljdFZLNitLY21aVGd5bnpDb1l5emkifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 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: Sat, 23 Feb 2019 08:37:41 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Felix, I agree. I filed a new BZ: https://bugzilla.tianocore.org/show_bug.cgi?id= =3D1557 to track the document update. I think this new behavior would be better to be recorded in the Build spec. Thanks, Bob -----Original Message----- From: Felix Polyudov [mailto:Felixp@ami.com]=20 Sent: Saturday, February 23, 2019 6:06 AM To: Feng, Bob C ; edk2-devel@lists.01.org Cc: Carsey, Jaben ; Gao, Liming Subject: RE: [edk2] [Patch] BaseTools: Enable component override functional= ity Bob, Do you know if DSC specification has been updated to document this new beha= vior? If not, it should be updated. -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of BobC= F 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 t= he 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/= Source/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 =20 + 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), GlobalDa= ta.gWorkspace, Arch=3Dself._Arch) + if self._Arch !=3D TAB_ARCH_COMMON and (file_guid_str,str(Modu= leFile)) in Components: + self._RawData.DisableOverrideComponent(Components[(file_gu= id_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), GlobalDa= ta.gWorkspace, Arch=3Dself._Arch) ModuleId =3D Record[6] LineNo =3D Record[7] =20 # check the file validation ErrorCode, ErrorInfo =3D ModuleFile.Validate('.inf') if ErrorCode !=3D 0: EdkLogger.error('build', ErrorCode, File=3Dself.MetaFile, = Line=3DLineNo, ExtraData=3DErrorInfo) - # Check duplication - # If arch is COMMON, no duplicate module is checked since all = modules in all component sections are selected - if self._Arch !=3D TAB_ARCH_COMMON and ModuleFile in self._Mod= ules: - DuplicatedFile =3D True =20 Module =3D ModuleBuildClassObject() Module.MetaFile =3D ModuleFile =20 # get module private library instance @@ -792,12 +800,10 @@ cl= ass DscBuildData(PlatformBuildClassObject): else: OptionString =3D Module.BuildOptions[ToolChainFamily, = ToolChain] Module.BuildOptions[ToolChainFamily, ToolChain] =3D Op= tionString + " " + Option =20 RecordList =3D self._RawData[MODEL_META_DATA_HEADER, self._Arc= h, None, ModuleId] - if DuplicatedFile and not RecordList: - EdkLogger.error('build', FILE_DUPLICATED, File=3Dself.Meta= File, ExtraData=3Dstr(ModuleFile), Line=3DLineNo) if RecordList: if len(RecordList) !=3D 1: EdkLogger.error('build', OPTION_UNKNOWN, 'Only FILE_GU= ID can be listed in section.', File=3Dself.MetaFile, ExtraData=3Dstr(= ModuleFile), Line=3DLineNo) ModuleFile =3D ProcessDuplicatedInf(ModuleFile, RecordList= [0][2], GlobalData.gWorkspace) diff --git a/BaseTools/Source/Python/Workspa= ce/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): =20 def __ProcessBuildOption(self): self._ValueList =3D [ReplaceMacro(Value, self._Macros, RaiseError= =3DFalse) for Value in self._ValueList] =20 + 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 : _DefaultStores= Parser, MODEL_EFI_LIBRARY_INSTANCE : _LibraryInstan= ceParser, 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(): =20 def SetEndFlag(self): self.CurrentContent.append(self._DUMMY_) =20 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=20 + and item[-1]>=3D0] =20 ## Python class representation of table storing module data class ModuleT= able(MetaFileTable): _COLUMN_ =3D ''' ID REAL PRIMARY KEY, @@ -371,11 +371,10 @@ class PlatformTable(MetaFileTable): # def Query(self, Model, Scope1=3DNone, Scope2=3DNone, BelongsToItem=3DN= one, FromItem=3DNone): =20 QueryTab =3D self.CurrentContent result =3D [item for item in QueryTab if item[1] =3D=3D Model and = item[-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 Pla= tformTable(MetaFileTable): result =3D [item for item in result if item[9] =3D=3D FromItem= ] =20 result =3D [ [r[2],r[3],r[4],r[5],r[6],r[7],r[0],r[9]] for r in re= sult ] return result =20 + 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 =20 ## Factory class to produce different storage for different type of meta-f= ile 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 proprieta= ry to American Megatrends, Inc. This communication is intended to be read = only by the individual or entity to whom it is addressed or by their design= ee. If the reader of this message is not the intended recipient, you are on= notice that any distribution of this message, in any form, is strictly pro= hibited. Please promptly notify the sender by reply e-mail or by telephone= at 770-246-8600, and then delete or destroy all copies of the transmission= .