From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 D77FE2244E3F2 for ; Sun, 15 Apr 2018 18:43:27 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2018 18:43:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,457,1517904000"; d="scan'208";a="37593056" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 15 Apr 2018 18:43:26 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 15 Apr 2018 18:43:26 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 15 Apr 2018 18:43:25 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.151]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.197]) with mapi id 14.03.0319.002; Mon, 16 Apr 2018 09:43:21 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH v1 2/3] BaseTools: use predefined constants instead of local strings Thread-Index: AQHT0NcRwHG1sffGEkqsI0PVFXsrD6P8lSUA Date: Mon, 16 Apr 2018 01:43:21 +0000 Message-ID: References: <3baab15814564d07b6fc73ffb8ca1465bc2aa971.1523369916.git.jaben.carsey@intel.com> In-Reply-To: <3baab15814564d07b6fc73ffb8ca1465bc2aa971.1523369916.git.jaben.carsey@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v1 2/3] BaseTools: use predefined constants instead of local strings X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Apr 2018 01:43:28 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Jaben, One comment on this patch, in InfBuildData.py, MetaFileParser.py and MetaFi= leTable.py add "from Common.DataType import TAB_ARCH_COMMON,TAB_ARCH_COMMON= ", the " TAB_ARCH_COMMON" was wrote twice, but in the code it use TAB_ARCH_= COMMON and TAB_COMMON. Current it still build pass because in those files it also have " from Comm= on.DataType import *". So you will send out a V2 or update this import statement when push the pat= ch?=20 Other patch are fine to me. Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Tuesday, April 10, 2018 10:20 PM To: edk2-devel@lists.01.org Cc: Gao, Liming ; Zhu, Yonghong Subject: [PATCH v1 2/3] BaseTools: use predefined constants instead of loca= l strings Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 24 +-- BaseTools/Source/Python/AutoGen/BuildEngine.py | 23 +-- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 15 +- BaseTools/Source/Python/AutoGen/GenVar.py | 15 +- BaseTools/Source/Python/Common/DataType.py | 2 + BaseTools/Source/Python/GenFds/AprioriSection.py | 3 +- BaseTools/Source/Python/GenFds/FdfParser.py | 29 ++-- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 5 +- BaseTools/Source/Python/GenFds/GenFds.py | 13 +- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 9 +- BaseTools/Source/Python/GenFds/Section.py | 3 +- BaseTools/Source/Python/Workspace/DecBuildData.py | 5 +- BaseTools/Source/Python/Workspace/DscBuildData.py | 154 ++++++++++---= ------- BaseTools/Source/Python/Workspace/InfBuildData.py | 7 +- BaseTools/Source/Python/Workspace/MetaFileParser.py | 34 ++--- BaseTools/Source/Python/Workspace/MetaFileTable.py | 22 +-- BaseTools/Source/Python/Workspace/WorkspaceDatabase.py | 6 +- 17 files changed, 196 insertions(+), 173 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 3384fdb70b7e..abdddec5ed6a 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -45,6 +45,8 @@ import InfSectionParser import datetime import hashlib from GenVar import VariableMgr,var_info +from Common.DataType import TAB_DEFAULT +from Common.DataType import TAB_COMMON =20 ## Regular expression for splitting Dependency Expression string into toke= ns gDepexTokenPattern =3D re.compile("(\(|\)|\w+| \S+\.inf)") @@ -253,7 +255,7 @@ class WorkspaceAutoGen(AutoGen): self.BuildDatabase =3D MetaFileDb self.MetaFile =3D ActivePlatform self.WorkspaceDir =3D WorkspaceDir - self.Platform =3D self.BuildDatabase[self.MetaFile, 'COMMON'= , Target, Toolchain] + self.Platform =3D self.BuildDatabase[self.MetaFile, TAB_COMM= ON, Target, Toolchain] GlobalData.gActivePlatform =3D self.Platform self.BuildTarget =3D Target self.ToolChain =3D Toolchain @@ -803,7 +805,7 @@ class WorkspaceAutoGen(AutoGen): # Here we just need to get FILE_GUID from INF = file, use 'COMMON' as ARCH attribute. and use=20 # BuildObject from one of AutoGenObjectList is= enough. # - InfObj =3D self.AutoGenObjectList[0].BuildData= base.WorkspaceDb.BuildObject[PathClassObj, 'COMMON', self.BuildTarget, self= .ToolChain] + InfObj =3D self.AutoGenObjectList[0].BuildData= base.WorkspaceDb.BuildObject[PathClassObj, TAB_COMMON, self.BuildTarget, se= lf.ToolChain] if not InfObj.Guid.upper() in _GuidDict.keys()= : _GuidDict[InfObj.Guid.upper()] =3D FfsFile else: @@ -1355,7 +1357,7 @@ class PlatformAutoGen(AutoGen): EdkLogger.error("build", FILE_READ_FAILURE, "Can not f= ind VPD map file %s to fix up VPD offset." % VpdMapFilePath) =20 NvStoreOffset =3D int(NvStoreOffset,16) if NvStoreOffset.u= pper().startswith("0X") else int(NvStoreOffset) - default_skuobj =3D PcdNvStoreDfBuffer[0].SkuInfoList.get("= DEFAULT") + default_skuobj =3D PcdNvStoreDfBuffer[0].SkuInfoList.get(T= AB_DEFAULT) maxsize =3D self.VariableInfo.VpdRegionSize - NvStoreOffs= et if self.VariableInfo.VpdRegionSize else len(default_skuobj.DefaultValue.= split(",")) var_data =3D self.VariableInfo.PatchNVStoreDefaultMaxSize(= maxsize) =20 @@ -1363,7 +1365,7 @@ class PlatformAutoGen(AutoGen): default_skuobj.DefaultValue =3D var_data PcdNvStoreDfBuffer[0].DefaultValue =3D var_data PcdNvStoreDfBuffer[0].SkuInfoList.clear() - PcdNvStoreDfBuffer[0].SkuInfoList['DEFAULT'] =3D defau= lt_skuobj + PcdNvStoreDfBuffer[0].SkuInfoList[TAB_DEFAULT] =3D def= ault_skuobj PcdNvStoreDfBuffer[0].MaxDatumSize =3D str(len(default= _skuobj.DefaultValue.split(","))) =20 return OrgVpdFile @@ -1603,12 +1605,12 @@ class PlatformAutoGen(AutoGen): PcdKey in VpdPcdDict: Pcd =3D VpdPcdDict[PcdKey] SkuValueMap =3D {} - DefaultSku =3D Pcd.SkuInfoList.get('DEFAULT') + DefaultSku =3D Pcd.SkuInfoList.get(TAB_DEFAULT) if DefaultSku: PcdValue =3D DefaultSku.DefaultValue if PcdValue not in SkuValueMap: SkuValueMap[PcdValue] =3D [] - VpdFile.Add(Pcd, 'DEFAULT',DefaultSku.VpdOffse= t) + VpdFile.Add(Pcd, TAB_DEFAULT,DefaultSku.VpdOff= set) SkuValueMap[PcdValue].append(DefaultSku) =20 for (SkuName,Sku) in Pcd.SkuInfoList.items(): @@ -1667,9 +1669,9 @@ class PlatformAutoGen(AutoGen): # just pick the a value to determine whether i= s unicode string type SkuValueMap =3D {} SkuObjList =3D DscPcdEntry.SkuInfoList.items() - DefaultSku =3D DscPcdEntry.SkuInfoList.get('DE= FAULT') + DefaultSku =3D DscPcdEntry.SkuInfoList.get(TAB= _DEFAULT) if DefaultSku: - defaultindex =3D SkuObjList.index(('DEFAUL= T',DefaultSku)) + defaultindex =3D SkuObjList.index((TAB_DEF= AULT,DefaultSku)) SkuObjList[0],SkuObjList[defaultindex] =3D= SkuObjList[defaultindex],SkuObjList[0] for (SkuName,Sku) in SkuObjList: Sku.VpdOffset =3D Sku.VpdOffset.strip()=20 @@ -1793,7 +1795,7 @@ class PlatformAutoGen(AutoGen): for (SkuName,SkuId) in allskuset: if type(SkuId) in (str,unicode) and eval(SkuId) =3D=3D= 0 or SkuId =3D=3D 0: continue - pcd.SkuInfoList[SkuName] =3D copy.deepcopy(pcd.SkuInfo= List['DEFAULT']) + pcd.SkuInfoList[SkuName] =3D copy.deepcopy(pcd.SkuInfo= List[TAB_DEFAULT]) pcd.SkuInfoList[SkuName].SkuId =3D SkuId self.AllPcdList =3D self._NonDynamicPcdList + self._DynamicPcdList =20 @@ -2420,7 +2422,7 @@ class PlatformAutoGen(AutoGen): if self.Platform.SkuName in self.Platform.SkuIds: SkuName =3D self.Platform.SkuName else: - SkuName =3D 'DEFAULT' + SkuName =3D TAB_DEFAULT ToPcd.SkuInfoList =3D { SkuName : SkuInfoClass(SkuName, self.Platform.SkuIds[SkuNa= me][0], '', '', '', '', '', ToPcd.DefaultValue) } @@ -3458,7 +3460,7 @@ class ModuleAutoGen(AutoGen): if self._BinaryFileList is None: self._BinaryFileList =3D [] for F in self.Module.Binaries: - if F.Target not in ['COMMON', '*'] and F.Target !=3D self.= BuildTarget: + if F.Target not in [TAB_COMMON, '*'] and F.Target !=3D sel= f.BuildTarget: continue self._BinaryFileList.append(F) self._ApplyBuildRule(F, F.Type) diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Sou= rce/Python/AutoGen/BuildEngine.py index 0daed7da610d..8e32312a8018 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -27,6 +27,7 @@ from Common.String import NormPath from Common.DataType import * =20 import Common.EdkLogger as EdkLogger +from Common.DataType import TAB_COMMON =20 ## Convert file type to file list macro name # @@ -375,7 +376,7 @@ class BuildRule: self.Parse() =20 # some intrinsic rules - self.RuleDatabase[TAB_DEFAULT_BINARY_FILE, "COMMON", "COMMON", "CO= MMON"] =3D self._BinaryFileRule + self.RuleDatabase[TAB_DEFAULT_BINARY_FILE, TAB_COMMON, TAB_COMMON,= TAB_COMMON] =3D self._BinaryFileRule self.FileTypeList.add(TAB_DEFAULT_BINARY_FILE) =20 ## Parse the build rule strings @@ -434,9 +435,9 @@ class BuildRule: ## Merge section information just got into rule database def EndOfSection(self): Database =3D self.RuleDatabase - # if there's specific toochain family, 'COMMON' doesn't make sense= any more - if len(self._TotalToolChainFamilySet) > 1 and 'COMMON' in self._To= talToolChainFamilySet: - self._TotalToolChainFamilySet.remove('COMMON') + # if there's specific toochain family, TAB_COMMON doesn't make sen= se any more + if len(self._TotalToolChainFamilySet) > 1 and TAB_COMMON in self._= TotalToolChainFamilySet: + self._TotalToolChainFamilySet.remove(TAB_COMMON) for Family in self._TotalToolChainFamilySet: Input =3D self._RuleInfo[Family, self._InputFile] Output =3D self._RuleInfo[Family, self._OutputFile] @@ -463,8 +464,8 @@ class BuildRule: FileType =3D '' RuleNameList =3D self.RuleContent[LineIndex][1:-1].split(',') for RuleName in RuleNameList: - Arch =3D 'COMMON' - BuildType =3D 'COMMON' + Arch =3D TAB_COMMON + BuildType =3D TAB_COMMON TokenList =3D [Token.strip().upper() for Token in RuleName.spl= it('.')] # old format: Build.File-Type if TokenList[0] =3D=3D "BUILD": @@ -499,12 +500,12 @@ class BuildRule: if Arch not in self._ArchList: self._ArchList.append(Arch) =20 - if 'COMMON' in self._BuildTypeList and len(self._BuildTypeList) > = 1: + if TAB_COMMON in self._BuildTypeList and len(self._BuildTypeList) = > 1: EdkLogger.error("build", FORMAT_INVALID, "Specific build types must not be mixed with c= ommon one", File=3Dself.RuleFile, Line=3DLineIndex + 1, ExtraData=3Dself.RuleContent[LineIndex]) - if 'COMMON' in self._ArchList and len(self._ArchList) > 1: + if TAB_COMMON in self._ArchList and len(self._ArchList) > 1: EdkLogger.error("build", FORMAT_INVALID, "Specific ARCH must not be mixed with common o= ne", File=3Dself.RuleFile, Line=3DLineIndex + 1, @@ -537,7 +538,7 @@ class BuildRule: if len(TokenList) > 1: Family =3D TokenList[1].strip().upper() else: - Family =3D "COMMON" + Family =3D TAB_COMMON =20 if Family not in FamilyList: FamilyList.append(Family) @@ -545,7 +546,7 @@ class BuildRule: self._FamilyList =3D FamilyList self._TotalToolChainFamilySet.update(FamilyList) self._State =3D SectionType.upper() - if 'COMMON' in FamilyList and len(FamilyList) > 1: + if TAB_COMMON in FamilyList and len(FamilyList) > 1: EdkLogger.error("build", FORMAT_INVALID, "Specific tool chain family should not be mixe= d with general one", File=3Dself.RuleFile, Line=3DLineIndex + 1, @@ -637,7 +638,7 @@ if __name__ =3D=3D '__main__': print print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) print - print str(Br[".s", "SEC", "IPF", "COMMON"][1]) + print str(Br[".s", "SEC", "IPF", TAB_COMMON][1]) print print str(Br[".s", "SEC"][1]) =20 diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source= /Python/AutoGen/GenPcdDb.py index a2c4fb39ec85..88f646b2522c 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -20,6 +20,7 @@ from ValidCheckingInfoObject import VAR_VALID_OBJECT_FACT= ORY from Common.VariableAttributes import VariableAttributes import copy from struct import unpack +from Common.DataType import TAB_DEFAULT =20 DATABASE_VERSION =3D 7 =20 @@ -981,14 +982,14 @@ def CreatePcdDataBase(PcdDBData): delta =3D {} basedata =3D {} for skuname,skuid in PcdDBData: - if len(PcdDBData[(skuname,skuid)][1]) !=3D len(PcdDBData[("DEFAULT= ","0")][1]): + if len(PcdDBData[(skuname,skuid)][1]) !=3D len(PcdDBData[(TAB_DEFA= ULT,"0")][1]): EdkLogger.ERROR("The size of each sku in one pcd are not same"= ) for skuname,skuid in PcdDBData: - if skuname =3D=3D "DEFAULT": + if skuname =3D=3D TAB_DEFAULT: continue - delta[(skuname,skuid)] =3D [(index,data,hex(data)) for index,data = in enumerate(PcdDBData[(skuname,skuid)][1]) if PcdDBData[(skuname,skuid)][1= ][index] !=3D PcdDBData[("DEFAULT","0")][1][index]] - basedata[(skuname,skuid)] =3D [(index,PcdDBData[("DEFAULT","0")][1= ][index],hex(PcdDBData[("DEFAULT","0")][1][index])) for index,data in enume= rate(PcdDBData[(skuname,skuid)][1]) if PcdDBData[(skuname,skuid)][1][index]= !=3D PcdDBData[("DEFAULT","0")][1][index]] - databasebuff =3D PcdDBData[("DEFAULT","0")][0] + delta[(skuname,skuid)] =3D [(index,data,hex(data)) for index,data = in enumerate(PcdDBData[(skuname,skuid)][1]) if PcdDBData[(skuname,skuid)][1= ][index] !=3D PcdDBData[(TAB_DEFAULT,"0")][1][index]] + basedata[(skuname,skuid)] =3D [(index,PcdDBData[(TAB_DEFAULT,"0")]= [1][index],hex(PcdDBData[(TAB_DEFAULT,"0")][1][index])) for index,data in e= numerate(PcdDBData[(skuname,skuid)][1]) if PcdDBData[(skuname,skuid)][1][in= dex] !=3D PcdDBData[(TAB_DEFAULT,"0")][1][index]] + databasebuff =3D PcdDBData[(TAB_DEFAULT,"0")][0] =20 for skuname,skuid in delta: # 8 byte align @@ -1011,7 +1012,7 @@ def CreatePcdDataBase(PcdDBData): =20 return newbuffer def CreateVarCheckBin(VarCheckTab): - return VarCheckTab[('DEFAULT',"0")] + return VarCheckTab[(TAB_DEFAULT,"0")] def CreateAutoGen(PcdDriverAutoGenData): autogenC =3D TemplateString() for skuname,skuid in PcdDriverAutoGenData: @@ -1062,7 +1063,7 @@ def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform= ,Phase): final_data =3D () for item in PcdDbBuffer: final_data +=3D unpack("B",item) - PcdDBData[("DEFAULT","0")] =3D (PcdDbBuffer, final_data) + PcdDBData[(TAB_DEFAULT,"0")] =3D (PcdDbBuffer, final_data) =20 return AdditionalAutoGenH, AdditionalAutoGenC, CreatePcdDataBase(PcdDB= Data) ## Create PCD database in DXE or PEI phase diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/P= ython/AutoGen/GenVar.py index d222e6ed5e7e..686258c77c90 100644 --- a/BaseTools/Source/Python/AutoGen/GenVar.py +++ b/BaseTools/Source/Python/AutoGen/GenVar.py @@ -20,6 +20,7 @@ import copy from Common.VariableAttributes import VariableAttributes from Common.Misc import * import collections +from Common.DataType import TAB_DEFAULT =20 var_info =3D collections.namedtuple("uefi_var", "pcdindex,pcdname,defaults= toragename,skuname,var_name, var_guid, var_offset,var_attribute,pcd_default= _value, default_value, data_type") NvStorageHeaderSize =3D 28 @@ -141,7 +142,7 @@ class VariableMgr(object): default_data_buffer =3D "" others_data_buffer =3D "" tail =3D None - default_sku_default =3D indexedvarinfo.get(index).get(("DEFAUL= T","STANDARD")) + default_sku_default =3D indexedvarinfo.get(index).get((TAB_DEF= AULT,"STANDARD")) =20 if default_sku_default.data_type not in ["UINT8","UINT16","UIN= T32","UINT64","BOOLEAN"]: var_max_len =3D max([len(var_item.default_value.split(",")= ) for var_item in sku_var_info.values()]) @@ -154,13 +155,13 @@ class VariableMgr(object): for item in default_data_buffer: default_data_array +=3D unpack("B",item) =20 - if ("DEFAULT","STANDARD") not in var_data: - var_data[("DEFAULT","STANDARD")] =3D collections.OrderedDi= ct() - var_data[("DEFAULT","STANDARD")][index] =3D (default_data_buff= er,sku_var_info[("DEFAULT","STANDARD")]) + if (TAB_DEFAULT,"STANDARD") not in var_data: + var_data[(TAB_DEFAULT,"STANDARD")] =3D collections.Ordered= Dict() + var_data[(TAB_DEFAULT,"STANDARD")][index] =3D (default_data_bu= ffer,sku_var_info[(TAB_DEFAULT,"STANDARD")]) =20 for (skuid,defaultstoragename) in indexedvarinfo.get(index): tail =3D None - if (skuid,defaultstoragename) =3D=3D ("DEFAULT","STANDARD"= ): + if (skuid,defaultstoragename) =3D=3D (TAB_DEFAULT,"STANDAR= D"): continue other_sku_other =3D indexedvarinfo.get(index).get((skuid,d= efaultstoragename)) =20 @@ -189,7 +190,7 @@ class VariableMgr(object): if not var_data: return [] =20 - pcds_default_data =3D var_data.get(("DEFAULT","STANDARD"),{}) + pcds_default_data =3D var_data.get((TAB_DEFAULT,"STANDARD"),{}) NvStoreDataBuffer =3D "" var_data_offset =3D collections.OrderedDict() offset =3D NvStorageHeaderSize @@ -219,7 +220,7 @@ class VariableMgr(object): =20 data_delta_structure_buffer =3D "" for skuname,defaultstore in var_data: - if (skuname,defaultstore) =3D=3D ("DEFAULT","STANDARD"): + if (skuname,defaultstore) =3D=3D (TAB_DEFAULT,"STANDARD"): continue pcds_sku_data =3D var_data.get((skuname,defaultstore)) delta_data_set =3D [] diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index 0bc2306ea61a..89d95c8a0bde 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -312,6 +312,8 @@ TAB_DEFINE =3D 'DEFINE' TAB_NMAKE =3D 'Nmake' TAB_USER_EXTENSIONS =3D 'UserExtensions' TAB_INCLUDE =3D '!include' +TAB_DEFAULT =3D 'DEFAULT' +TAB_COMMON =3D 'COMMON' =20 # # Common Define diff --git a/BaseTools/Source/Python/GenFds/AprioriSection.py b/BaseTools/S= ource/Python/GenFds/AprioriSection.py index 92a74670ed25..e6b8aa151b31 100644 --- a/BaseTools/Source/Python/GenFds/AprioriSection.py +++ b/BaseTools/Source/Python/GenFds/AprioriSection.py @@ -25,6 +25,7 @@ from Common.String import * from Common.Misc import SaveFileOnChange,PathClass from Common import EdkLogger from Common.BuildToolError import * +from Common.DataType import TAB_COMMON =20 ## process APRIORI file data and generate PEI/DXE APRIORI file # @@ -84,7 +85,7 @@ class AprioriSection (AprioriSectionClassObject): Guid =3D Inf.Guid =20 else: - Inf =3D GenFdsGlobalVariable.WorkSpace.BuildObject[Pat= hClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), 'COMMON', GenFdsGlo= balVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] + Inf =3D GenFdsGlobalVariable.WorkSpace.BuildObject[Pat= hClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), TAB_COMMON, GenFdsG= lobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] Guid =3D Inf.Guid =20 self.BinFileList =3D Inf.Module.Binaries diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 9b7e898570a3..992dfea926d4 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -52,6 +52,12 @@ from Common.String import NormPath import Common.GlobalData as GlobalData from Common.Expression import * from Common import GlobalData +from Common.DataType import TAB_COMMON_DEFINES,SUP_MODULE_BASE, SUP_MODULE= _SEC,\ +SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE,\ +SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DR= IVER,\ +SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_UEFI_DRIVER,SUP_MODULE_UEFI_APPLICAT= ION,\ +SUP_MODULE_USER_DEFINED, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,\ +SUP_MODULE_MM_CORE_STANDALONE,TAB_DEFAULT,TAB_COMMON,ARCH_LIST_FULL from Common.String import ReplaceMacro import uuid from Common.Misc import tdict @@ -509,8 +515,8 @@ class FdfParser: if Item =3D=3D '' or Item =3D=3D 'RULE': return =20 - if Item =3D=3D 'DEFINES': - self.__CurSection =3D ['COMMON', 'COMMON', 'COMMON'] + if Item =3D=3D TAB_COMMON_DEFINES.upper(): + self.__CurSection =3D [TAB_COMMON, TAB_COMMON, TAB_COMMON] elif Item =3D=3D 'VTF' and len(ItemList) =3D=3D 3: UiName =3D ItemList[2] Pos =3D UiName.find(',') @@ -518,9 +524,9 @@ class FdfParser: UiName =3D UiName[:Pos] self.__CurSection =3D ['VTF', UiName, ItemList[1]] elif len(ItemList) > 1: - self.__CurSection =3D [ItemList[0], ItemList[1], 'COMMON'] + self.__CurSection =3D [ItemList[0], ItemList[1], TAB_COMMON] elif len(ItemList) > 0: - self.__CurSection =3D [ItemList[0], 'DUMMY', 'COMMON'] + self.__CurSection =3D [ItemList[0], 'DUMMY', TAB_COMMON] =20 ## PreprocessFile() method # @@ -884,7 +890,7 @@ class FdfParser: =20 if self.__CurSection: # Defines macro - ScopeMacro =3D self.__MacroDict['COMMON', 'COMMON', 'COMMON'] + ScopeMacro =3D self.__MacroDict[TAB_COMMON, TAB_COMMON, TAB_CO= MMON] if ScopeMacro: MacroDict.update(ScopeMacro) =20 @@ -3586,7 +3592,7 @@ class FdfParser: raise Warning("expected '.'", self.FileName, self.CurrentLineN= umber) =20 Arch =3D self.__SkippedChars.rstrip(".") - if Arch.upper() not in ("IA32", "X64", "IPF", "EBC", "ARM", "AARCH= 64", "COMMON"): + if Arch.upper() not in ARCH_LIST_FULL: raise Warning("Unknown Arch '%s'" % Arch, self.FileName, self.= CurrentLineNumber) =20 ModuleType =3D self.__GetModuleType() @@ -3632,12 +3638,13 @@ class FdfParser: =20 if not self.__GetNextWord(): raise Warning("expected Module type", self.FileName, self.Curr= entLineNumber) - if self.__Token.upper() not in ("SEC", "PEI_CORE", "PEIM", "DXE_CO= RE", \ - "DXE_DRIVER", "DXE_SAL_DRIVER", \ - "DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \ - "UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFI= NED", "DEFAULT", "BASE", \ + if self.__Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PEI_COR= E, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, \ + SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRI= VER, \ + SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUN= TIME_DRIVER, \ + SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLI= CATION, SUP_MODULE_USER_DEFINED, TAB_DEFAULT, SUP_MODULE_BASE, \ "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC= _PEIM", "RELOCATABLE_PEIM", \ - "PE32_PEIM", "BS_DRIVER", "RT_DRIV= ER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE", "MM_STANDALON= E", "MM_CORE_STANDALONE"): + "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_R= T_DRIVER", "APPLICATION", "ACPITABLE", \ + SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE= , SUP_MODULE_MM_CORE_STANDALONE): raise Warning("Unknown Module type '%s'" % self.__Token, self.= FileName, self.CurrentLineNumber) return self.__Token =20 diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/= Source/Python/GenFds/FfsInfStatement.py index 0dbffffc9a15..0994b7f8aa6c 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -47,6 +47,7 @@ import Common.GlobalData as GlobalData from DepexSection import DepexSection from Common.Misc import SaveFileOnChange from Common.Expression import * +from Common.DataType import TAB_COMMON =20 ## generate FFS from INF # @@ -205,7 +206,7 @@ class FfsInfStatement(FfsInfStatementClassObject): self.ShadowFromInfFile =3D Inf.Shadow =20 else: - Inf =3D GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassOb= j, 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChai= nTag] + Inf =3D GenFdsGlobalVariable.WorkSpace.BuildObject[PathClassOb= j, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolCh= ainTag] self.BaseName =3D Inf.BaseName self.ModuleGuid =3D Inf.Guid self.ModuleType =3D Inf.ModuleType @@ -568,7 +569,7 @@ class FfsInfStatement(FfsInfStatementClassObject): =20 RuleName =3D 'RULE' + \ '.' + \ - 'COMMON' + \ + TAB_COMMON + \ '.' + \ self.ModuleType.upper() =20 diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Py= thon/GenFds/GenFds.py index 49e26424bbfc..de6905de8e1f 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -43,6 +43,7 @@ from Common.MultipleWorkspace import MultipleWorkspace as= mws import FfsFileStatement import glob from struct import unpack +from Common.DataType import TAB_COMMON =20 ## Version and Copyright versionNumber =3D "1.0" + ' ' + gBUILD_VERSION @@ -239,11 +240,11 @@ def main(): ArchList =3D Options.archList.split(',') else: # EdkLogger.error("GenFds", OPTION_MISSING, "Missing build ARCH= ") - ArchList =3D BuildWorkSpace.BuildObject[GenFdsGlobalVariable.A= ctivePlatform, 'COMMON', Options.BuildTarget, Options.ToolChain].SupArchLis= t + ArchList =3D BuildWorkSpace.BuildObject[GenFdsGlobalVariable.A= ctivePlatform, TAB_COMMON, Options.BuildTarget, Options.ToolChain].SupArchL= ist =20 - TargetArchList =3D set(BuildWorkSpace.BuildObject[GenFdsGlobalVari= able.ActivePlatform, 'COMMON', Options.BuildTarget, Options.ToolChain].SupA= rchList) & set(ArchList) + TargetArchList =3D set(BuildWorkSpace.BuildObject[GenFdsGlobalVari= able.ActivePlatform, TAB_COMMON, Options.BuildTarget, Options.ToolChain].Su= pArchList) & set(ArchList) if len(TargetArchList) =3D=3D 0: - EdkLogger.error("GenFds", GENFDS_ERROR, "Target ARCH %s not in= platform supported ARCH %s" % (str(ArchList), str(BuildWorkSpace.BuildObje= ct[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList))) + EdkLogger.error("GenFds", GENFDS_ERROR, "Target ARCH %s not in= platform supported ARCH %s" % (str(ArchList), str(BuildWorkSpace.BuildObje= ct[GenFdsGlobalVariable.ActivePlatform, TAB_COMMON].SupArchList))) =20 for Arch in ArchList: GenFdsGlobalVariable.OutputDirFromDscDict[Arch] =3D NormPath(B= uildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, Option= s.BuildTarget, Options.ToolChain].OutputDirectory) @@ -675,7 +676,7 @@ class GenFds : # @retval None # def PreprocessImage(BuildDb, DscFile): - PcdDict =3D BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobalVar= iable.TargetName, GenFdsGlobalVariable.ToolChainTag].Pcds + PcdDict =3D BuildDb.BuildObject[DscFile, TAB_COMMON, GenFdsGlobalV= ariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Pcds PcdValue =3D '' for Key in PcdDict: PcdObj =3D PcdDict[Key] @@ -694,9 +695,9 @@ class GenFds : if Int64PcdValue > 0: TopAddress =3D Int64PcdValue =20 - ModuleDict =3D BuildDb.BuildObject[DscFile, 'COMMON', GenFdsGlobal= Variable.TargetName, GenFdsGlobalVariable.ToolChainTag].Modules + ModuleDict =3D BuildDb.BuildObject[DscFile, TAB_COMMON, GenFdsGlob= alVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Modules for Key in ModuleDict: - ModuleObj =3D BuildDb.BuildObject[Key, 'COMMON', GenFdsGlobalV= ariable.TargetName, GenFdsGlobalVariable.ToolChainTag] + ModuleObj =3D BuildDb.BuildObject[Key, TAB_COMMON, GenFdsGloba= lVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] print ModuleObj.BaseName + ' ' + ModuleObj.ModuleType =20 def GenerateGuidXRefFile(BuildDb, ArchList, FdfParserObj): diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index fcb191981c95..68a0a09c7bbc 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -32,6 +32,7 @@ import Common.DataType as DataType from Common.Misc import PathClass from Common.LongFilePathSupport import OpenLongFilePath as open from Common.MultipleWorkspace import MultipleWorkspace as mws +from Common.DataType import TAB_COMMON =20 ## Global variables # @@ -130,7 +131,7 @@ class GenFdsGlobalVariable: @staticmethod def GetBuildRules(Inf, Arch): if not Arch: - Arch =3D 'COMMON' + Arch =3D TAB_COMMON =20 if not Arch in GenFdsGlobalVariable.OutputDirDict: return {} @@ -217,7 +218,7 @@ class GenFdsGlobalVariable: FileList.append((File, DataType.TAB_UNKNOWN_FILE)) =20 for File in Inf.Binaries: - if File.Target in ['COMMON', '*', GenFdsGlobalVariable.TargetN= ame]: + if File.Target in [TAB_COMMON, '*', GenFdsGlobalVariable.Targe= tName]: FileList.append((File, File.Type)) =20 for File, FileType in FileList: @@ -757,7 +758,7 @@ class GenFdsGlobalVariable: # @param Str String that may contain macro # @param MacroDict Dictionary that contains macro value pair # - def MacroExtend (Str, MacroDict=3D{}, Arch=3D'COMMON'): + def MacroExtend (Str, MacroDict=3D{}, Arch=3DTAB_COMMON): if Str is None : return None =20 @@ -769,7 +770,7 @@ class GenFdsGlobalVariable: '$(SPACE)' : ' ' } OutputDir =3D GenFdsGlobalVariable.OutputDirFromDscDict[GenFdsGlob= alVariable.ArchList[0]] - if Arch !=3D 'COMMON' and Arch in GenFdsGlobalVariable.ArchList: + if Arch !=3D TAB_COMMON and Arch in GenFdsGlobalVariable.ArchList: OutputDir =3D GenFdsGlobalVariable.OutputDirFromDscDict[Arch] =20 Dict['$(OUTPUT_DIRECTORY)'] =3D OutputDir diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/P= ython/GenFds/Section.py index 5e0b4bee7d1c..a2b85f651cd5 100644 --- a/BaseTools/Source/Python/GenFds/Section.py +++ b/BaseTools/Source/Python/GenFds/Section.py @@ -20,6 +20,7 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable import Common.LongFilePathOs as os, glob from Common import EdkLogger from Common.BuildToolError import * +from Common.DataType import TAB_COMMON =20 ## section base class # @@ -128,7 +129,7 @@ class Section (SectionClassObject): FileList =3D [] if FileType is not None: for File in FfsInf.BinFileList: - if File.Arch =3D=3D "COMMON" or FfsInf.CurrentArch =3D=3D = File.Arch: + if File.Arch =3D=3D TAB_COMMON or FfsInf.CurrentArch =3D= =3D File.Arch: if File.Type =3D=3D FileType or (int(FfsInf.PiSpecVers= ion, 16) >=3D 0x0001000A \ and FileType =3D=3D 'DXE_= DPEX'and File.Type =3D=3D 'SMM_DEPEX') \ or (FileType =3D=3D 'TE'a= nd File.Type =3D=3D 'PE32'): diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/= Source/Python/Workspace/DecBuildData.py index 49ef1df4aa76..db3ac83ae057 100644 --- a/BaseTools/Source/Python/Workspace/DecBuildData.py +++ b/BaseTools/Source/Python/Workspace/DecBuildData.py @@ -16,6 +16,7 @@ from Common.DataType import * from Common.Misc import * from types import * from collections import OrderedDict +from Common.DataType import TAB_ARCH_COMMON,TAB_COMMON =20 from Workspace.BuildClassObject import PackageBuildClassObject, StructureP= cd, PcdClassObject =20 @@ -63,7 +64,7 @@ class DecBuildData(PackageBuildClassObject): # @param Platform (not used for DecBuildData) # @param Macros Macros used for replacement in DSC fil= e # - def __init__(self, File, RawData, BuildDataBase, Arch=3D'COMMON', Targ= et=3DNone, Toolchain=3DNone): + def __init__(self, File, RawData, BuildDataBase, Arch=3DTAB_ARCH_COMMO= N, Target=3DNone, Toolchain=3DNone): self.MetaFile =3D File self._PackageDir =3D File.Dir self._RawData =3D RawData @@ -327,7 +328,7 @@ class DecBuildData(PackageBuildClassObject): PublicInclues.append(File) if File in self._PrivateIncludes: EdkLogger.error('build', OPTION_CONFLICT, "Can't d= etermine %s's attribute, it is both defined as Private and non-Private attr= ibute in DEC file." % File, File=3Dself.MetaFile, Line=3DLineNo) - if Record[3] =3D=3D "COMMON": + if Record[3] =3D=3D TAB_COMMON: self._CommonIncludes.append(File) return self._Includes =20 diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 35ef15262a09..8d460891fbe0 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -36,6 +36,8 @@ import re from Common.Parsing import IsValidWord from Common.VariableAttributes import VariableAttributes import Common.GlobalData as GlobalData +from Common.DataType import TAB_DEFAULT +from Common.DataType import TAB_ARCH_COMMON,TAB_COMMON import subprocess from Common.Misc import SaveFileOnChange from Workspace.BuildClassObject import PlatformBuildClassObject, Structure= Pcd, PcdClassObject, ModuleBuildClassObject @@ -208,7 +210,7 @@ class DscBuildData(PlatformBuildClassObject): # @param Platform (not used for DscBuildData) # @param Macros Macros used for replacement in DSC fil= e # - def __init__(self, FilePath, RawData, BuildDataBase, Arch=3D'COMMON', = Target=3DNone, Toolchain=3DNone): + def __init__(self, FilePath, RawData, BuildDataBase, Arch=3DTAB_ARCH_C= OMMON, Target=3DNone, Toolchain=3DNone): self.MetaFile =3D FilePath self._RawData =3D RawData self._Bdb =3D BuildDataBase @@ -509,7 +511,7 @@ class DscBuildData(PlatformBuildClassObject): if self._Header is None: self._GetHeaderInfo() if self._SkuName is None: - self._SkuName =3D 'DEFAULT' + self._SkuName =3D TAB_DEFAULT return self._SkuName =20 ## Override SKUID_IDENTIFIER @@ -653,10 +655,10 @@ class DscBuildData(PlatformBuildClassObject): EdkLogger.error('build', FORMAT_INVALID, "The format o= f the Sku ID name is invalid. The correct format is '(a-zA-Z0-9_)(a-zA-Z0-9= _-.)*'", File=3Dself.MetaFile, Line=3DRecord[-1= ]) self._SkuIds[Record[1].upper()] =3D (str(self.ToInt(Record= [0])), Record[1].upper(), Record[2].upper()) - if 'DEFAULT' not in self._SkuIds: - self._SkuIds['DEFAULT'] =3D ("0","DEFAULT","DEFAULT") - if 'COMMON' not in self._SkuIds: - self._SkuIds['COMMON'] =3D ("0","DEFAULT","DEFAULT") + if TAB_DEFAULT not in self._SkuIds: + self._SkuIds[TAB_DEFAULT] =3D ("0",TAB_DEFAULT,TAB_DEFAULT= ) + if TAB_COMMON not in self._SkuIds: + self._SkuIds[TAB_COMMON] =3D ("0",TAB_DEFAULT,TAB_DEFAULT) return self._SkuIds def ToInt(self,intstr): return int(intstr,16) if intstr.upper().startswith("0X") else int(= intstr) @@ -708,7 +710,7 @@ class DscBuildData(PlatformBuildClassObject): 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 'COMMON' and ModuleFile in self._Modules: + if self._Arch !=3D TAB_ARCH_COMMON and ModuleFile in self._Mod= ules: DuplicatedFile =3D True =20 Module =3D ModuleBuildClassObject() @@ -817,7 +819,7 @@ class DscBuildData(PlatformBuildClassObject): EdkLogger.error('build', ErrorCode, File=3Dself.MetaFi= le, Line=3DLineNo, ExtraData=3DErrorInfo) =20 - if ModuleType !=3D 'COMMON' and ModuleType not in SUP_MODU= LE_LIST: + if ModuleType !=3D TAB_COMMON and ModuleType not in SUP_MO= DULE_LIST: EdkLogger.error('build', OPTION_UNKNOWN, "Unknown modu= le type [%s]" % ModuleType, File=3Dself.MetaFile, ExtraData=3DLibr= aryInstance, Line=3DLineNo) LibraryClassDict[Arch, ModuleType, LibraryClass] =3D Libra= ryInstance @@ -929,9 +931,9 @@ class DscBuildData(PlatformBuildClassObject): if sku_usage =3D=3D SkuClass.SINGLE: for pcdname in Pcds: pcd =3D Pcds[pcdname] - Pcds[pcdname].SkuInfoList =3D {"DEFAULT":pcd.SkuInfoList[s= kuid] for skuid in pcd.SkuInfoList if skuid in available_sku} + Pcds[pcdname].SkuInfoList =3D {TAB_DEFAULT:pcd.SkuInfoList= [skuid] for skuid in pcd.SkuInfoList if skuid in available_sku} if type(pcd) is StructurePcd and pcd.SkuOverrideValues: - Pcds[pcdname].SkuOverrideValues =3D {"DEFAULT":pcd.Sku= OverrideValues[skuid] for skuid in pcd.SkuOverrideValues if skuid in availa= ble_sku} + Pcds[pcdname].SkuOverrideValues =3D {TAB_DEFAULT:pcd.S= kuOverrideValues[skuid] for skuid in pcd.SkuOverrideValues if skuid in avai= lable_sku} else: for pcdname in Pcds: pcd =3D Pcds[pcdname] @@ -957,9 +959,9 @@ class DscBuildData(PlatformBuildClassObject): self._PCD_TYPE_STRING_[MODEL_PCD_P= ATCHABLE_IN_MODULE]]: pcd.PcdValueFromComm =3D pcd.DefaultValue elif pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII= ], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: - pcd.PcdValueFromComm =3D pcd.SkuInfoList.get("DEFAULT").Hi= iDefaultValue + pcd.PcdValueFromComm =3D pcd.SkuInfoList.get(TAB_DEFAULT).= HiiDefaultValue else: - pcd.PcdValueFromComm =3D pcd.SkuInfoList.get("DEFAULT").De= faultValue + pcd.PcdValueFromComm =3D pcd.SkuInfoList.get(TAB_DEFAULT).= DefaultValue for pcd in self._Pcds: if isinstance(self._Pcds[pcd],StructurePcd) and (self._Pcds[pc= d].PcdValueFromComm or self._Pcds[pcd].PcdFieldValueFromComm): UpdateCommandLineValue(self._Pcds[pcd]) @@ -1162,7 +1164,7 @@ class DscBuildData(PlatformBuildClassObject): for CodeBase in (EDKII_NAME, EDK_NAME): RecordList =3D self._RawData[MODEL_META_DATA_BUILD_OPTION,= self._Arch, CodeBase] for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Du= mmy3, Dummy4,Dummy5 in RecordList: - if Dummy3.upper() !=3D 'COMMON': + if Dummy3.upper() !=3D TAB_COMMON: continue CurKey =3D (ToolChainFamily, ToolChain, CodeBase) # @@ -1182,7 +1184,7 @@ class DscBuildData(PlatformBuildClassObject): options =3D sdict() self._ModuleTypeOptions[Edk, ModuleType] =3D options DriverType =3D '%s.%s' % (Edk, ModuleType) - CommonDriverType =3D '%s.%s' % ('COMMON', ModuleType) + CommonDriverType =3D '%s.%s' % (TAB_COMMON, ModuleType) RecordList =3D self._RawData[MODEL_META_DATA_BUILD_OPTION, sel= f._Arch] for ToolChainFamily, ToolChain, Option, Dummy1, Dummy2, Dummy3= , Dummy4,Dummy5 in RecordList: Type =3D Dummy2 + '.' + Dummy3 @@ -1282,7 +1284,7 @@ class DscBuildData(PlatformBuildClassObject): Pcds =3D AllPcds DefaultStoreMgr =3D DefaultStore(self.DefaultStores) SkuIds =3D self.SkuIdMgr.AvailableSkuIdSet - SkuIds.update({'DEFAULT':0}) + SkuIds.update({TAB_DEFAULT:0}) DefaultStores =3D set([storename for pcdobj in AllPcds.values() fo= r skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStor= eDict.keys()]) =20 S_PcdSet =3D [] @@ -1295,7 +1297,7 @@ class DscBuildData(PlatformBuildClassObject): for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, default_stor= e, Dummy4,Dummy5 in RecordList: SkuName =3D SkuName.upper() default_store =3D default_store.upper() - SkuName =3D 'DEFAULT' if SkuName =3D=3D 'COMMON' else SkuName + SkuName =3D TAB_DEFAULT if SkuName =3D=3D TAB_COMMON else SkuN= ame if SkuName not in SkuIds: continue =20 @@ -1323,7 +1325,7 @@ class DscBuildData(PlatformBuildClassObject): str_pcd_obj_str.DefaultFromDSC =3D {skuname:{defau= ltstore: str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.get(defaultstore= , str_pcd_obj.SkuInfoList[skuname].DefaultValue) for defaultstore in Defaul= tStores} for skuname in str_pcd_obj.SkuInfoList} for str_pcd_data in StrPcdSet[str_pcd]: if str_pcd_data[3] in SkuIds: - str_pcd_obj_str.AddOverrideValue(str_pcd_data[2], = str(str_pcd_data[6]), 'DEFAULT' if str_pcd_data[3] =3D=3D 'COMMON' else str= _pcd_data[3],'STANDARD' if str_pcd_data[4] =3D=3D 'COMMON' else str_pcd_dat= a[4], self.MetaFile.File if self.WorkspaceDir not in self.MetaFile.File els= e self.MetaFile.File[len(self.WorkspaceDir) if self.WorkspaceDir.endswith(o= s.path.sep) else len(self.WorkspaceDir)+1:],LineNo=3Dstr_pcd_data[5]) + str_pcd_obj_str.AddOverrideValue(str_pcd_data[2], = str(str_pcd_data[6]), TAB_DEFAULT if str_pcd_data[3] =3D=3D TAB_COMMON else= str_pcd_data[3],'STANDARD' if str_pcd_data[4] =3D=3D TAB_COMMON else str_p= cd_data[4], self.MetaFile.File if self.WorkspaceDir not in self.MetaFile.Fi= le else self.MetaFile.File[len(self.WorkspaceDir) if self.WorkspaceDir.ends= with(os.path.sep) else len(self.WorkspaceDir)+1:],LineNo=3Dstr_pcd_data[5]) S_pcd_set[str_pcd[1], str_pcd[0]] =3D str_pcd_obj_str else: EdkLogger.error('build', PARSER_ERROR, @@ -1353,7 +1355,7 @@ class DscBuildData(PlatformBuildClassObject): NoDefault =3D False if skuid not in stru_pcd.SkuOverrideValues: while nextskuid not in stru_pcd.SkuOverrideValues: - if nextskuid =3D=3D "DEFAULT": + if nextskuid =3D=3D TAB_DEFAULT: NoDefault =3D True break nextskuid =3D self.SkuIdMgr.GetNextSkuId(nextskuid= ) @@ -1366,7 +1368,7 @@ class DscBuildData(PlatformBuildClassObject): NoDefault =3D False if skuid not in stru_pcd.SkuOverrideValues: while nextskuid not in stru_pcd.SkuOverrideValues: - if nextskuid =3D=3D "DEFAULT": + if nextskuid =3D=3D TAB_DEFAULT: NoDefault =3D True break nextskuid =3D self.SkuIdMgr.GetNextSkuId(nexts= kuid) @@ -1396,14 +1398,14 @@ class DscBuildData(PlatformBuildClassObject): str_pcd_obj.SkuInfoList[skuname].DefaultStoreDict.= update({StoreName:PcdValue}) elif str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD= _FIXED_AT_BUILD], self._PCD_TYPE_STRING_[MODEL_PCD_P= ATCHABLE_IN_MODULE]]: - if skuname in (self.SkuIdMgr.SystemSkuId, 'DEFAULT', '= COMMON'): + if skuname in (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT,= TAB_COMMON): str_pcd_obj.DefaultValue =3D PcdValue else: if skuname not in str_pcd_obj.SkuInfoList: nextskuid =3D self.SkuIdMgr.GetNextSkuId(skuname) NoDefault =3D False while nextskuid not in str_pcd_obj.SkuInfoList: - if nextskuid =3D=3D "DEFAULT": + if nextskuid =3D=3D TAB_DEFAULT: NoDefault =3D True break nextskuid =3D self.SkuIdMgr.GetNextSkuId(nexts= kuid) @@ -1428,11 +1430,11 @@ class DscBuildData(PlatformBuildClassObject): =20 for pcdkey in Pcds: pcd =3D Pcds[pcdkey] - if 'DEFAULT' not in pcd.SkuInfoList and 'COMMON' in pcd.Sk= uInfoList: - pcd.SkuInfoList['DEFAULT'] =3D pcd.SkuInfoList['COMMON= '] - del pcd.SkuInfoList['COMMON'] - elif 'DEFAULT' in pcd.SkuInfoList and 'COMMON' in pcd.SkuI= nfoList: - del pcd.SkuInfoList['COMMON'] + if TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON in pc= d.SkuInfoList: + pcd.SkuInfoList[TAB_DEFAULT] =3D pcd.SkuInfoList[TAB_C= OMMON] + del pcd.SkuInfoList[TAB_COMMON] + elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.= SkuInfoList: + del pcd.SkuInfoList[TAB_COMMON] =20 map(self.FilterSkuSettings,[Pcds[pcdkey] for pcdkey in Pcds if Pcd= s[pcdkey].Type in DynamicPcdType]) return Pcds @@ -1458,11 +1460,11 @@ class DscBuildData(PlatformBuildClassObject): PcdValueDict =3D sdict() for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dumm= y4,Dummy5 in RecordList: SkuName =3D SkuName.upper() - SkuName =3D 'DEFAULT' if SkuName =3D=3D 'COMMON' else SkuName + SkuName =3D TAB_DEFAULT if SkuName =3D=3D TAB_COMMON else SkuN= ame if SkuName not in AvailableSkuIdSet: EdkLogger.error('build ', PARAMETER_INVALID, 'Sku %s is no= t defined in [SkuIds] section' % SkuName, File=3Dself.MetaFile, Line=3DD= ummy5) - if SkuName in (self.SkuIdMgr.SystemSkuId, 'DEFAULT', 'COMMON')= : + if SkuName in (self.SkuIdMgr.SystemSkuId, TAB_DEFAULT, TAB_COM= MON): if "." not in TokenSpaceGuid: PcdSet.add((PcdCName, TokenSpaceGuid, SkuName, Dummy5)= ) PcdDict[Arch, PcdCName, TokenSpaceGuid, SkuName] =3D Setti= ng @@ -1481,10 +1483,10 @@ class DscBuildData(PlatformBuildClassObject): PcdValue =3D None DatumType =3D None MaxDatumSize =3D None - if 'COMMON' in PcdSetting: - PcdValue, DatumType, MaxDatumSize =3D PcdSetting['COMMON'] - if 'DEFAULT' in PcdSetting: - PcdValue, DatumType, MaxDatumSize =3D PcdSetting['DEFAULT'= ] + if TAB_COMMON in PcdSetting: + PcdValue, DatumType, MaxDatumSize =3D PcdSetting[TAB_COMMO= N] + if TAB_DEFAULT in PcdSetting: + PcdValue, DatumType, MaxDatumSize =3D PcdSetting[TAB_DEFAU= LT] if self.SkuIdMgr.SystemSkuId in PcdSetting: PcdValue, DatumType, MaxDatumSize =3D PcdSetting[self.SkuI= dMgr.SystemSkuId] =20 @@ -1615,7 +1617,7 @@ class DscBuildData(PlatformBuildClassObject): FieldName =3D FieldName.rsplit('[', 1)[0] CApp =3D CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, = %d); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."),= ArrayIndex + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], = FieldList[FieldName_ori][0]) for skuname in Pcd.SkuOverrideValues: - if skuname =3D=3D "COMMON": + if skuname =3D=3D TAB_COMMON: continue for defaultstorenameitem in Pcd.SkuOverrideValues[skuname]: CApp =3D CApp + "// SkuName: %s, DefaultStoreName: %s \n"= % (skuname, defaultstorenameitem) @@ -1739,10 +1741,10 @@ class DscBuildData(PlatformBuildClassObject): CApp =3D CApp + ' UINT32 FieldSize;\n' CApp =3D CApp + ' CHAR8 *Value;\n' =20 - CApp =3D CApp + "// SkuName: %s, DefaultStoreName: %s \n" % ('DEF= AULT', 'STANDARD') + CApp =3D CApp + "// SkuName: %s, DefaultStoreName: %s \n" % (TAB_= DEFAULT, 'STANDARD') inherit_OverrideValues =3D Pcd.SkuOverrideValues[SkuName] - if (SkuName,DefaultStoreName) =3D=3D ('DEFAULT','STANDARD'): - pcddefaultvalue =3D Pcd.DefaultFromDSC.get('DEFAULT',{}).get('= STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue + if (SkuName,DefaultStoreName) =3D=3D (TAB_DEFAULT,'STANDARD'): + pcddefaultvalue =3D Pcd.DefaultFromDSC.get(TAB_DEFAULT,{}).get= ('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue else: if not Pcd.DscRawValue: # handle the case that structure pcd is not appear in DSC @@ -1761,14 +1763,14 @@ class DscBuildData(PlatformBuildClassObject): (Pcd.TokenSpaceGuidCName, Pcd.Toke= nCName, FieldList)) Value, ValueSize =3D ParseFieldValue (FieldList) =20 - if (SkuName,DefaultStoreName) =3D=3D ('DEFAULT','STANDARD'= ): + if (SkuName,DefaultStoreName) =3D=3D (TAB_DEFAULT,'STANDAR= D'): if isinstance(Value, str): - CApp =3D CApp + ' Pcd =3D %s; // From DSC Default= Value %s\n' % (Value, Pcd.DefaultFromDSC.get('DEFAULT',{}).get('STANDARD',= Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue) + CApp =3D CApp + ' Pcd =3D %s; // From DSC Default= Value %s\n' % (Value, Pcd.DefaultFromDSC.get(TAB_DEFAULT,{}).get('STANDARD= ', Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue) elif IsArray: # # Use memcpy() to copy value into field # - CApp =3D CApp + ' Value =3D %s; // From DSC D= efault Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DefaultFromD= SC.get('DEFAULT',{}).get('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFromDS= C else Pcd.DefaultValue) + CApp =3D CApp + ' Value =3D %s; // From DSC D= efault Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DefaultFromD= SC.get(TAB_DEFAULT,{}).get('STANDARD', Pcd.DefaultValue) if Pcd.DefaultFrom= DSC else Pcd.DefaultValue) CApp =3D CApp + ' memcpy (Pcd, Value, %d);\n' % (= ValueSize) else: if isinstance(Value, str): @@ -1780,7 +1782,7 @@ class DscBuildData(PlatformBuildClassObject): CApp =3D CApp + ' Value =3D %s; // From DSC D= efault Value %s\n' % (self.IntToCString(Value, ValueSize), Pcd.DscRawValue.= get(SkuName,{}).get(DefaultStoreName)) CApp =3D CApp + ' memcpy (Pcd, Value, %d);\n' % (= ValueSize) continue - if (SkuName,DefaultStoreName) =3D=3D ('DEFAULT','STANDARD') or= (( (SkuName,'') not in Pcd.ValueChain) and ( (SkuName,DefaultStoreName) no= t in Pcd.ValueChain )): + if (SkuName,DefaultStoreName) =3D=3D (TAB_DEFAULT,'STANDARD') = or (( (SkuName,'') not in Pcd.ValueChain) and ( (SkuName,DefaultStoreName) = not in Pcd.ValueChain )): for FieldName in FieldList: IsArray =3D IsFieldValueAnArray(FieldList[FieldName][0= ]) if IsArray: @@ -2239,7 +2241,7 @@ class DscBuildData(PlatformBuildClassObject): =20 for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dumm= y4,Dummy5 in RecordList: SkuName =3D SkuName.upper() - SkuName =3D 'DEFAULT' if SkuName =3D=3D 'COMMON' else SkuName + SkuName =3D TAB_DEFAULT if SkuName =3D=3D TAB_COMMON else SkuN= ame if SkuName not in AvailableSkuIdSet: EdkLogger.error('build', PARAMETER_INVALID, 'Sku %s is not= defined in [SkuIds] section' % SkuName, File=3Dself.MetaFile, Line=3DD= ummy5) @@ -2289,15 +2291,15 @@ class DscBuildData(PlatformBuildClassObject): for sku in pcd.SkuInfoList.values(): if (sku.DefaultValue =3D=3D "" or sku.DefaultValue=3D=3DNo= ne): sku.DefaultValue =3D pcdDecObject.DefaultValue - if 'DEFAULT' not in pcd.SkuInfoList and 'COMMON' not in pcd.Sk= uInfoList: + if TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON not in pc= d.SkuInfoList: valuefromDec =3D pcdDecObject.DefaultValue - SkuInfo =3D SkuInfoClass('DEFAULT', '0', '', '', '', '', '= ', valuefromDec) - pcd.SkuInfoList['DEFAULT'] =3D SkuInfo - elif 'DEFAULT' not in pcd.SkuInfoList and 'COMMON' in pcd.SkuI= nfoList: - pcd.SkuInfoList['DEFAULT'] =3D pcd.SkuInfoList['COMMON'] - del pcd.SkuInfoList['COMMON'] - elif 'DEFAULT' in pcd.SkuInfoList and 'COMMON' in pcd.SkuInfoL= ist: - del pcd.SkuInfoList['COMMON'] + SkuInfo =3D SkuInfoClass(TAB_DEFAULT, '0', '', '', '', '',= '', valuefromDec) + pcd.SkuInfoList[TAB_DEFAULT] =3D SkuInfo + elif TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON in pcd.= SkuInfoList: + pcd.SkuInfoList[TAB_DEFAULT] =3D pcd.SkuInfoList[TAB_COMMO= N] + del pcd.SkuInfoList[TAB_COMMON] + elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuI= nfoList: + del pcd.SkuInfoList[TAB_COMMON] =20 map(self.FilterSkuSettings,Pcds.values()) =20 @@ -2306,14 +2308,14 @@ class DscBuildData(PlatformBuildClassObject): def FilterSkuSettings(self, PcdObj): =20 if self.SkuIdMgr.SkuUsageType =3D=3D self.SkuIdMgr.SINGLE: - if 'DEFAULT' in PcdObj.SkuInfoList and self.SkuIdMgr.SystemSku= Id not in PcdObj.SkuInfoList: - PcdObj.SkuInfoList[self.SkuIdMgr.SystemSkuId] =3D PcdObj.S= kuInfoList['DEFAULT'] - PcdObj.SkuInfoList =3D {'DEFAULT':PcdObj.SkuInfoList[self.SkuI= dMgr.SystemSkuId]} - PcdObj.SkuInfoList['DEFAULT'].SkuIdName =3D 'DEFAULT' - PcdObj.SkuInfoList['DEFAULT'].SkuId =3D '0' + if TAB_DEFAULT in PcdObj.SkuInfoList and self.SkuIdMgr.SystemS= kuId not in PcdObj.SkuInfoList: + PcdObj.SkuInfoList[self.SkuIdMgr.SystemSkuId] =3D PcdObj.S= kuInfoList[TAB_DEFAULT] + PcdObj.SkuInfoList =3D {TAB_DEFAULT:PcdObj.SkuInfoList[self.Sk= uIdMgr.SystemSkuId]} + PcdObj.SkuInfoList[TAB_DEFAULT].SkuIdName =3D TAB_DEFAULT + PcdObj.SkuInfoList[TAB_DEFAULT].SkuId =3D '0' =20 elif self.SkuIdMgr.SkuUsageType =3D=3D self.SkuIdMgr.DEFAULT: - PcdObj.SkuInfoList =3D {'DEFAULT':PcdObj.SkuInfoList['DEFAULT'= ]} + PcdObj.SkuInfoList =3D {TAB_DEFAULT:PcdObj.SkuInfoList[TAB_DEF= AULT]} =20 return PcdObj =20 @@ -2346,7 +2348,7 @@ class DscBuildData(PlatformBuildClassObject): def CompletePcdValues(self,PcdSet): Pcds =3D {} DefaultStoreObj =3D DefaultStore(self._GetDefaultStores()) - SkuIds =3D {skuname:skuid for skuname,skuid in self.SkuIdMgr.Avail= ableSkuIdSet.items() if skuname !=3D'COMMON'} + SkuIds =3D {skuname:skuid for skuname,skuid in self.SkuIdMgr.Avail= ableSkuIdSet.items() if skuname !=3DTAB_COMMON} DefaultStores =3D set([storename for pcdobj in PcdSet.values() for= skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStore= Dict.keys()]) for PcdCName, TokenSpaceGuid in PcdSet: PcdObj =3D PcdSet[(PcdCName, TokenSpaceGuid)] @@ -2377,7 +2379,7 @@ class DscBuildData(PlatformBuildClassObject): PcdObj.SkuInfoList[skuname].SkuId =3D skuid PcdObj.SkuInfoList[skuname].SkuIdName =3D skuname if PcdType in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], = self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: - PcdObj.DefaultValue =3D PcdObj.SkuInfoList.values()[0].Hii= DefaultValue if self.SkuIdMgr.SkuUsageType =3D=3D self.SkuIdMgr.SINGLE else= PcdObj.SkuInfoList["DEFAULT"].HiiDefaultValue + PcdObj.DefaultValue =3D PcdObj.SkuInfoList.values()[0].Hii= DefaultValue if self.SkuIdMgr.SkuUsageType =3D=3D self.SkuIdMgr.SINGLE else= PcdObj.SkuInfoList[TAB_DEFAULT].HiiDefaultValue Pcds[PcdCName, TokenSpaceGuid]=3D PcdObj return Pcds ## Retrieve dynamic HII PCD settings @@ -2404,9 +2406,9 @@ class DscBuildData(PlatformBuildClassObject): =20 for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, DefaultStore= , Dummy4,Dummy5 in RecordList: SkuName =3D SkuName.upper() - SkuName =3D 'DEFAULT' if SkuName =3D=3D 'COMMON' else SkuName + SkuName =3D TAB_DEFAULT if SkuName =3D=3D TAB_COMMON else SkuN= ame DefaultStore =3D DefaultStore.upper() - if DefaultStore =3D=3D "COMMON": + if DefaultStore =3D=3D TAB_COMMON: DefaultStore =3D "STANDARD" if SkuName not in AvailableSkuIdSet: EdkLogger.error('build', PARAMETER_INVALID, 'Sku %s is not= defined in [SkuIds] section' % SkuName, @@ -2498,15 +2500,15 @@ class DscBuildData(PlatformBuildClassObject): for default_store in sku.DefaultStoreDict: sku.DefaultStoreDict[default_store]=3DpcdDecObject= .DefaultValue pcd.DefaultValue =3D pcdDecObject.DefaultValue - if 'DEFAULT' not in pcd.SkuInfoList and 'COMMON' not in pcd.Sk= uInfoList: + if TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON not in pc= d.SkuInfoList: valuefromDec =3D pcdDecObject.DefaultValue - SkuInfo =3D SkuInfoClass('DEFAULT', '0', SkuInfoObj.Variab= leName, SkuInfoObj.VariableGuid, SkuInfoObj.VariableOffset, valuefromDec,Va= riableAttribute=3DSkuInfoObj.VariableAttribute,DefaultStore=3D{DefaultStore= :valuefromDec}) - pcd.SkuInfoList['DEFAULT'] =3D SkuInfo - elif 'DEFAULT' not in pcd.SkuInfoList and 'COMMON' in pcd.SkuI= nfoList: - pcd.SkuInfoList['DEFAULT'] =3D pcd.SkuInfoList['COMMON'] - del pcd.SkuInfoList['COMMON'] - elif 'DEFAULT' in pcd.SkuInfoList and 'COMMON' in pcd.SkuInfoL= ist: - del pcd.SkuInfoList['COMMON'] + SkuInfo =3D SkuInfoClass(TAB_DEFAULT, '0', SkuInfoObj.Vari= ableName, SkuInfoObj.VariableGuid, SkuInfoObj.VariableOffset, valuefromDec,= VariableAttribute=3DSkuInfoObj.VariableAttribute,DefaultStore=3D{DefaultSto= re:valuefromDec}) + pcd.SkuInfoList[TAB_DEFAULT] =3D SkuInfo + elif TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON in pcd.= SkuInfoList: + pcd.SkuInfoList[TAB_DEFAULT] =3D pcd.SkuInfoList[TAB_COMMO= N] + del pcd.SkuInfoList[TAB_COMMON] + elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuI= nfoList: + del pcd.SkuInfoList[TAB_COMMON] =20 if pcd.MaxDatumSize.strip(): MaxSize =3D int(pcd.MaxDatumSize, 0) @@ -2566,7 +2568,7 @@ class DscBuildData(PlatformBuildClassObject): =20 for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dumm= y4,Dummy5 in RecordList: SkuName =3D SkuName.upper() - SkuName =3D 'DEFAULT' if SkuName =3D=3D 'COMMON' else SkuName + SkuName =3D TAB_DEFAULT if SkuName =3D=3D TAB_COMMON else SkuN= ame if SkuName not in AvailableSkuIdSet: EdkLogger.error('build', PARAMETER_INVALID, 'Sku %s is not= defined in [SkuIds] section' % SkuName, File=3Dself.MetaFile, Line=3DD= ummy5) @@ -2621,15 +2623,15 @@ class DscBuildData(PlatformBuildClassObject): for sku in pcd.SkuInfoList.values(): if (sku.DefaultValue =3D=3D "" or sku.DefaultValue=3D=3DNo= ne): sku.DefaultValue =3D pcdDecObject.DefaultValue - if 'DEFAULT' not in pcd.SkuInfoList and 'COMMON' not in pcd.Sk= uInfoList: + if TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON not in pc= d.SkuInfoList: valuefromDec =3D pcdDecObject.DefaultValue - SkuInfo =3D SkuInfoClass('DEFAULT', '0', '', '', '', '', S= kuInfoObj.VpdOffset, valuefromDec) - pcd.SkuInfoList['DEFAULT'] =3D SkuInfo - elif 'DEFAULT' not in pcd.SkuInfoList and 'COMMON' in pcd.SkuI= nfoList: - pcd.SkuInfoList['DEFAULT'] =3D pcd.SkuInfoList['COMMON'] - del pcd.SkuInfoList['COMMON'] - elif 'DEFAULT' in pcd.SkuInfoList and 'COMMON' in pcd.SkuInfoL= ist: - del pcd.SkuInfoList['COMMON'] + SkuInfo =3D SkuInfoClass(TAB_DEFAULT, '0', '', '', '', '',= SkuInfoObj.VpdOffset, valuefromDec) + pcd.SkuInfoList[TAB_DEFAULT] =3D SkuInfo + elif TAB_DEFAULT not in pcd.SkuInfoList and TAB_COMMON in pcd.= SkuInfoList: + pcd.SkuInfoList[TAB_DEFAULT] =3D pcd.SkuInfoList[TAB_COMMO= N] + del pcd.SkuInfoList[TAB_COMMON] + elif TAB_DEFAULT in pcd.SkuInfoList and TAB_COMMON in pcd.SkuI= nfoList: + del pcd.SkuInfoList[TAB_COMMON] =20 =20 map(self.FilterSkuSettings,Pcds.values()) diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index ded8f610c9c1..53aa6acf5862 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -17,6 +17,7 @@ from Common.DataType import * from Common.Misc import * from types import * from MetaFileParser import * +from Common.DataType import TAB_ARCH_COMMON,TAB_ARCH_COMMON =20 from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClas= sObject, PcdClassObject ## Module build information from INF file @@ -106,7 +107,7 @@ class InfBuildData(ModuleBuildClassObject): # @param Platform The name of platform employing this mo= dule # @param Macros Macros used for replacement in DSC fil= e # - def __init__(self, FilePath, RawData, BuildDatabase, Arch=3D'COMMON', = Target=3DNone, Toolchain=3DNone): + def __init__(self, FilePath, RawData, BuildDatabase, Arch=3DTAB_ARCH_C= OMMON, Target=3DNone, Toolchain=3DNone): self.MetaFile =3D FilePath self._ModuleDir =3D FilePath.Dir self._RawData =3D RawData @@ -114,7 +115,7 @@ class InfBuildData(ModuleBuildClassObject): self._Arch =3D Arch self._Target =3D Target self._Toolchain =3D Toolchain - self._Platform =3D 'COMMON' + self._Platform =3D TAB_COMMON self._SourceOverridePath =3D None if FilePath.Key in GlobalData.gOverrideDir: self._SourceOverridePath =3D GlobalData.gOverrideDir[FilePath.= Key] @@ -608,7 +609,7 @@ class InfBuildData(ModuleBuildClassObject): for Record in RecordList: FileType =3D Record[0] LineNo =3D Record[-1] - Target =3D 'COMMON' + Target =3D TAB_COMMON FeatureFlag =3D [] if Record[2]: TokenList =3D GetSplitValueList(Record[2], TAB_VALUE_S= PLIT) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index f4c1868483d9..79c10fc9fdc6 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -31,7 +31,7 @@ from Common.Misc import GuidStructureStringToGuidString, = CheckPcdDatum, PathClas from Common.Expression import * from CommonDataClass.Exceptions import * from Common.LongFilePathSupport import OpenLongFilePath as open - +from Common.DataType import TAB_ARCH_COMMON,TAB_ARCH_COMMON from MetaFileTable import MetaFileStorage from MetaFileCommentParser import CheckInfComment =20 @@ -219,7 +219,7 @@ class MetaFileParser(object): NewRecordList =3D [] for Record in RecordList: Arch =3D Record[3] - if Arch =3D=3D 'COMMON' or Arch =3D=3D FilterArch: + if Arch =3D=3D TAB_ARCH_COMMON or Arch =3D=3D FilterArch: NewRecordList.append(Record) return NewRecordList =20 @@ -319,7 +319,7 @@ class MetaFileParser(object): if len(ItemList) > 1: S1 =3D ItemList[1].upper() else: - S1 =3D 'COMMON' + S1 =3D TAB_ARCH_COMMON ArchList.add(S1) =20 # S2 may be Platform or ModuleType @@ -329,15 +329,15 @@ class MetaFileParser(object): else: S2 =3D ItemList[2].upper() else: - S2 =3D 'COMMON' + S2 =3D TAB_COMMON if len(ItemList) > 3: S3 =3D ItemList[3] else: - S3 =3D "COMMON" + S3 =3D TAB_COMMON self._Scope.append([S1, S2, S3]) =20 # 'COMMON' must not be used with specific ARCHs at the same sectio= n - if 'COMMON' in ArchList and len(ArchList) > 1: + if TAB_ARCH_COMMON in ArchList and len(ArchList) > 1: EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must = not be used with specific ARCHs", File=3Dself.MetaFile, Line=3Dself._LineIndex += 1, ExtraData=3Dself._CurrentLine) # If the section information is needed later, it should be stored = in database @@ -455,12 +455,12 @@ class MetaFileParser(object): =20 for ActiveScope in self._Scope: Scope0, Scope1,Scope2 =3D ActiveScope[0], ActiveScope[1],A= ctiveScope[2] - if(Scope0, Scope1,Scope2) not in Scope and (Scope0, "COMMO= N","COMMON") not in Scope and ("COMMON", Scope1,"COMMON") not in Scope: + if(Scope0, Scope1,Scope2) not in Scope and (Scope0, TAB_CO= MMON,TAB_COMMON) not in Scope and (TAB_COMMON, Scope1,TAB_COMMON) not in Sc= ope: break else: ComSpeMacroDict.update(self._SectionsMacroDict[(SectionTyp= e, Scope)]) =20 - if ("COMMON", "COMMON","COMMON") in Scope: + if (TAB_COMMON, TAB_COMMON,TAB_COMMON) in Scope: ComComMacroDict.update(self._SectionsMacroDict[(SectionTyp= e, Scope)]) =20 Macros.update(ComComMacroDict) @@ -568,8 +568,8 @@ class InfParser(MetaFileParser): if Line[0] =3D=3D TAB_SECTION_START and Line[-1] =3D=3D TAB_SE= CTION_END: if not GetHeaderComment: for Cmt, LNo in Comments: - self._Store(MODEL_META_DATA_HEADER_COMMENT, Cmt, '= ', '', 'COMMON', - 'COMMON', self._Owner[-1], LNo, -1, LN= o, -1, 0) + self._Store(MODEL_META_DATA_HEADER_COMMENT, Cmt, '= ', '', TAB_COMMON, + TAB_COMMON, self._Owner[-1], LNo, -1, = LNo, -1, 0) GetHeaderComment =3D True else: TailComments.extend(SectionComments + Comments) @@ -658,8 +658,8 @@ class InfParser(MetaFileParser): =20 # If there are tail comments in INF file, save to database whateve= r the comments are for Comment in TailComments: - self._Store(MODEL_META_DATA_TAIL_COMMENT, Comment[0], '', '', = 'COMMON', - 'COMMON', self._Owner[-1], -1, -1, -1, -1,= 0) + self._Store(MODEL_META_DATA_TAIL_COMMENT, Comment[0], '', '', = TAB_COMMON, + TAB_COMMON, self._Owner[-1], -1, -1, -1, -= 1, 0) self._Done() =20 ## Data parser for the format in which there's path @@ -1022,7 +1022,7 @@ class DscParser(MetaFileParser): ExtraData=3Dself._CurrentLine) =20 ItemType =3D self.DataType[DirectiveName] - Scope =3D [['COMMON', 'COMMON','COMMON']] + Scope =3D [[TAB_COMMON, TAB_COMMON,TAB_COMMON]] if ItemType =3D=3D MODEL_META_DATA_INCLUDE: Scope =3D self._Scope if ItemType =3D=3D MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF: @@ -1832,7 +1832,7 @@ class DecParser(MetaFileParser): if len(ItemList) > 1: S1 =3D ItemList[1].upper() else: - S1 =3D 'COMMON' + S1 =3D TAB_ARCH_COMMON ArchList.add(S1) # S2 may be Platform or ModuleType if len(ItemList) > 2: @@ -1843,18 +1843,18 @@ class DecParser(MetaFileParser): EdkLogger.error("Parser", FORMAT_INVALID, 'Please = use keyword "Private" as section tag modifier.', File=3Dself.MetaFile, Line=3Dself.= _LineIndex + 1, ExtraData=3Dself._CurrentLine) else: - S2 =3D 'COMMON' + S2 =3D TAB_COMMON PrivateList.add(S2) if [S1, S2, self.DataType[self._SectionName]] not in self._Sco= pe: self._Scope.append([S1, S2, self.DataType[self._SectionNam= e]]) =20 # 'COMMON' must not be used with specific ARCHs at the same sectio= n - if 'COMMON' in ArchList and len(ArchList) > 1: + if TAB_ARCH_COMMON in ArchList and len(ArchList) > 1: EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must = not be used with specific ARCHs", File=3Dself.MetaFile, Line=3Dself._LineIndex += 1, ExtraData=3Dself._CurrentLine) =20 # It is not permissible to mix section tags without the Private at= tribute with section tags with the Private attribute - if 'COMMON' in PrivateList and len(PrivateList) > 1: + if TAB_COMMON in PrivateList and len(PrivateList) > 1: EdkLogger.error('Parser', FORMAT_INVALID, "Can't mix section t= ags without the Private attribute with section tags with the Private attrib= ute", File=3Dself.MetaFile, Line=3Dself._LineIndex += 1, ExtraData=3Dself._CurrentLine) =20 diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools= /Source/Python/Workspace/MetaFileTable.py index be3fb3d68856..33d390253b2a 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileTable.py +++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py @@ -1,7 +1,7 @@ ## @file # This file is used to create/update/query/erase a meta file table # -# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License # which accompanies this distribution. The full text of the license may b= e found at @@ -18,7 +18,7 @@ import uuid =20 import Common.EdkLogger as EdkLogger from Common.BuildToolError import FORMAT_INVALID - +from Common.DataType import TAB_ARCH_COMMON,TAB_ARCH_COMMON from MetaDataTable import Table, TableFile from MetaDataTable import ConvertToSqlString from CommonDataClass.DataClass import MODEL_FILE_DSC, MODEL_FILE_DEC, MODE= L_FILE_INF, \ @@ -109,7 +109,7 @@ class ModuleTable(MetaFileTable): # @param EndColumn: EndColumn of a Inf item # @param Enabled: If this item enabled # - def Insert(self, Model, Value1, Value2, Value3, Scope1=3D'COMMON', Sco= pe2=3D'COMMON', + def Insert(self, Model, Value1, Value2, Value3, Scope1=3DTAB_ARCH_COMM= ON, Scope2=3DTAB_COMMON, BelongsToItem=3D-1, StartLine=3D-1, StartColumn=3D-1, EndLi= ne=3D-1, EndColumn=3D-1, Enabled=3D0): (Value1, Value2, Value3, Scope1, Scope2) =3D ConvertToSqlString((V= alue1, Value2, Value3, Scope1, Scope2)) return Table.Insert( @@ -140,9 +140,9 @@ class ModuleTable(MetaFileTable): ConditionString =3D "Model=3D%s AND Enabled>=3D0" % Model ValueString =3D "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine" =20 - if Arch is not None and Arch !=3D 'COMMON': + if Arch is not None and Arch !=3D TAB_ARCH_COMMON: ConditionString +=3D " AND (Scope1=3D'%s' OR Scope1=3D'COMMON'= )" % Arch - if Platform is not None and Platform !=3D 'COMMON': + if Platform is not None and Platform !=3D TAB_COMMON: ConditionString +=3D " AND (Scope2=3D'%s' OR Scope2=3D'COMMON'= OR Scope2=3D'DEFAULT')" % Platform if BelongsToItem is not None: ConditionString +=3D " AND BelongsToItem=3D%s" % BelongsToItem @@ -191,7 +191,7 @@ class PackageTable(MetaFileTable): # @param EndColumn: EndColumn of a Dec item # @param Enabled: If this item enabled # - def Insert(self, Model, Value1, Value2, Value3, Scope1=3D'COMMON', Sco= pe2=3D'COMMON', + def Insert(self, Model, Value1, Value2, Value3, Scope1=3DTAB_ARCH_COMM= ON, Scope2=3DTAB_COMMON, BelongsToItem=3D-1, StartLine=3D-1, StartColumn=3D-1, EndLi= ne=3D-1, EndColumn=3D-1, Enabled=3D0): (Value1, Value2, Value3, Scope1, Scope2) =3D ConvertToSqlString((V= alue1, Value2, Value3, Scope1, Scope2)) return Table.Insert( @@ -221,7 +221,7 @@ class PackageTable(MetaFileTable): ConditionString =3D "Model=3D%s AND Enabled>=3D0" % Model ValueString =3D "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine" =20 - if Arch is not None and Arch !=3D 'COMMON': + if Arch is not None and Arch !=3D TAB_ARCH_COMMON: ConditionString +=3D " AND (Scope1=3D'%s' OR Scope1=3D'COMMON'= )" % Arch =20 SqlCommand =3D "SELECT %s FROM %s WHERE %s" % (ValueString, self.T= able, ConditionString) @@ -306,7 +306,7 @@ class PlatformTable(MetaFileTable): # @param EndColumn: EndColumn of a Dsc item # @param Enabled: If this item enabled # - def Insert(self, Model, Value1, Value2, Value3, Scope1=3D'COMMON', Sco= pe2=3D'COMMON', Scope3=3DTAB_DEFAULT_STORES_DEFAULT,BelongsToItem=3D-1, + def Insert(self, Model, Value1, Value2, Value3, Scope1=3DTAB_ARCH_COMM= ON, Scope2=3DTAB_COMMON, Scope3=3DTAB_DEFAULT_STORES_DEFAULT,BelongsToItem= =3D-1, FromItem=3D-1, StartLine=3D-1, StartColumn=3D-1, EndLine=3D= -1, EndColumn=3D-1, Enabled=3D1): (Value1, Value2, Value3, Scope1, Scope2,Scope3) =3D ConvertToSqlSt= ring((Value1, Value2, Value3, Scope1, Scope2,Scope3)) return Table.Insert( @@ -341,13 +341,13 @@ class PlatformTable(MetaFileTable): ConditionString =3D "Model=3D%s AND Enabled>0" % Model ValueString =3D "Value1,Value2,Value3,Scope1,Scope2,Scope3,ID,Star= tLine" =20 - if Scope1 is not None and Scope1 !=3D 'COMMON': + if Scope1 is not None and Scope1 !=3D TAB_ARCH_COMMON: ConditionString +=3D " AND (Scope1=3D'%s' OR Scope1=3D'COMMON'= )" % Scope1 - if Scope2 is not None and Scope2 !=3D 'COMMON': + if Scope2 is not None and Scope2 !=3D TAB_COMMON: # Cover the case that CodeBase is 'COMMON' for BuildOptions se= ction if '.' in Scope2: Index =3D Scope2.index('.') - NewScope =3D 'COMMON'+ Scope2[Index:] + NewScope =3D TAB_COMMON+ Scope2[Index:] ConditionString +=3D " AND (Scope2=3D'%s' OR Scope2=3D'COM= MON' OR Scope2=3D'DEFAULT' OR Scope2=3D'%s')" % (Scope2, NewScope) else: ConditionString +=3D " AND (Scope2=3D'%s' OR Scope2=3D'COM= MON' OR Scope2=3D'DEFAULT')" % Scope2 diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseT= ools/Source/Python/Workspace/WorkspaceDatabase.py index 2b888c0610c3..6c52817d95b3 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -1,7 +1,7 @@ ## @file # This file is used to create a database used by build tool # -# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License @@ -305,7 +305,7 @@ determine whether database file is out of date!\n") PlatformList =3D [] for PlatformFile in self.TblFile.GetFileList(MODEL_FILE_DSC): try: - Platform =3D self.BuildObject[PathClass(PlatformFile), 'CO= MMON'] + Platform =3D self.BuildObject[PathClass(PlatformFile), TAB= _COMMON] except: Platform =3D None if Platform is not None: @@ -313,7 +313,7 @@ determine whether database file is out of date!\n") return PlatformList =20 def _MapPlatform(self, Dscfile): - Platform =3D self.BuildObject[PathClass(Dscfile), 'COMMON'] + Platform =3D self.BuildObject[PathClass(Dscfile), TAB_COMMON] if Platform is None: EdkLogger.error('build', PARSER_ERROR, "Failed to parser DSC f= ile: %s" % Dscfile) return Platform --=20 2.16.2.windows.1