* [PATCH v2 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts [not found] <cover.1524837705.git.jaben.carsey@intel.com> @ 2018-04-27 14:04 ` Jaben Carsey 2018-05-02 6:44 ` Zhu, Yonghong 2018-04-27 14:04 ` [PATCH v3 16/27] BaseTools: Replace EDK Component strings with predefined constant Jaben Carsey 1 sibling, 1 reply; 4+ messages in thread From: Jaben Carsey @ 2018-04-27 14:04 UTC (permalink / raw) To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu make defaultdict to avoid initialize inner items to empty the dict, call clear instead of making a new object v2 - to empty the dict, dont re-run constructor, just call .clear() in post process API also. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> --- BaseTools/Source/Python/Workspace/MetaFileParser.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 550359f9abb2..51126d710b2b 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 collections import defaultdict from MetaFileTable import MetaFileStorage from MetaFileCommentParser import CheckInfComment @@ -163,7 +163,7 @@ class MetaFileParser(object): self._FileDir = self.MetaFile.Dir self._Defines = {} self._FileLocalMacros = {} - self._SectionsMacroDict = {} + self._SectionsMacroDict = defaultdict(dict) # for recursive parsing self._Owner = [Owner] @@ -421,17 +421,16 @@ class MetaFileParser(object): def _ConstructSectionMacroDict(self, Name, Value): ScopeKey = [(Scope[0], Scope[1],Scope[2]) for Scope in self._Scope] ScopeKey = tuple(ScopeKey) - SectionDictKey = self._SectionType, ScopeKey # # DecParser SectionType is a list, will contain more than one item only in Pcd Section # As Pcd section macro usage is not alllowed, so here it is safe # if type(self) == DecParser: SectionDictKey = self._SectionType[0], ScopeKey - if SectionDictKey not in self._SectionsMacroDict: - self._SectionsMacroDict[SectionDictKey] = {} - SectionLocalMacros = self._SectionsMacroDict[SectionDictKey] - SectionLocalMacros[Name] = Value + else: + SectionDictKey = self._SectionType, ScopeKey + + self._SectionsMacroDict[SectionDictKey][Name] = Value ## Get section Macros that are applicable to current line, which may come from other sections ## that share the same name while scope is wider @@ -936,7 +935,7 @@ class DscParser(MetaFileParser): self._SubsectionType = MODEL_UNKNOWN self._SubsectionName = '' self._Owner[-1] = -1 - OwnerId = {} + OwnerId.clear() continue # subsection header elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END: @@ -1296,7 +1295,7 @@ class DscParser(MetaFileParser): self._DirectiveEvalStack = [] self._FileWithError = self.MetaFile self._FileLocalMacros = {} - self._SectionsMacroDict = {} + self._SectionsMacroDict.clear() GlobalData.gPlatformDefines = {} # Get all macro and PCD which has straitforward value -- 2.16.2.windows.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts 2018-04-27 14:04 ` [PATCH v2 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts Jaben Carsey @ 2018-05-02 6:44 ` Zhu, Yonghong 0 siblings, 0 replies; 4+ messages in thread From: Zhu, Yonghong @ 2018-05-02 6:44 UTC (permalink / raw) To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben Sent: Friday, April 27, 2018 10:04 PM To: edk2-devel@lists.01.org Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com> Subject: [PATCH v2 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts make defaultdict to avoid initialize inner items to empty the dict, call clear instead of making a new object v2 - to empty the dict, dont re-run constructor, just call .clear() in post process API also. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> --- BaseTools/Source/Python/Workspace/MetaFileParser.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 550359f9abb2..51126d710b2b 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 collections import defaultdict from MetaFileTable import MetaFileStorage from MetaFileCommentParser import CheckInfComment @@ -163,7 +163,7 @@ class MetaFileParser(object): self._FileDir = self.MetaFile.Dir self._Defines = {} self._FileLocalMacros = {} - self._SectionsMacroDict = {} + self._SectionsMacroDict = defaultdict(dict) # for recursive parsing self._Owner = [Owner] @@ -421,17 +421,16 @@ class MetaFileParser(object): def _ConstructSectionMacroDict(self, Name, Value): ScopeKey = [(Scope[0], Scope[1],Scope[2]) for Scope in self._Scope] ScopeKey = tuple(ScopeKey) - SectionDictKey = self._SectionType, ScopeKey # # DecParser SectionType is a list, will contain more than one item only in Pcd Section # As Pcd section macro usage is not alllowed, so here it is safe # if type(self) == DecParser: SectionDictKey = self._SectionType[0], ScopeKey - if SectionDictKey not in self._SectionsMacroDict: - self._SectionsMacroDict[SectionDictKey] = {} - SectionLocalMacros = self._SectionsMacroDict[SectionDictKey] - SectionLocalMacros[Name] = Value + else: + SectionDictKey = self._SectionType, ScopeKey + + self._SectionsMacroDict[SectionDictKey][Name] = Value ## Get section Macros that are applicable to current line, which may come from other sections ## that share the same name while scope is wider @@ -936,7 +935,7 @@ class DscParser(MetaFileParser): self._SubsectionType = MODEL_UNKNOWN self._SubsectionName = '' self._Owner[-1] = -1 - OwnerId = {} + OwnerId.clear() continue # subsection header elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END: @@ -1296,7 +1295,7 @@ class DscParser(MetaFileParser): self._DirectiveEvalStack = [] self._FileWithError = self.MetaFile self._FileLocalMacros = {} - self._SectionsMacroDict = {} + self._SectionsMacroDict.clear() GlobalData.gPlatformDefines = {} # Get all macro and PCD which has straitforward value -- 2.16.2.windows.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 16/27] BaseTools: Replace EDK Component strings with predefined constant [not found] <cover.1524837705.git.jaben.carsey@intel.com> 2018-04-27 14:04 ` [PATCH v2 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts Jaben Carsey @ 2018-04-27 14:04 ` Jaben Carsey 2018-05-02 6:45 ` Zhu, Yonghong 1 sibling, 1 reply; 4+ messages in thread From: Jaben Carsey @ 2018-04-27 14:04 UTC (permalink / raw) To: edk2-devel; +Cc: Liming Gao, Yonghong Zhu EDK_COMPONENT_TYPE_LIBRARY was 'LIBRARY' EDK_COMPONENT_TYPE_SECURITY_CORE was 'SECURITY_CORE' EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER was 'COMBINED_PEIM_DRIVER' EDK_COMPONENT_TYPE_PIC_PEIM was 'PIC_PEIM' EDK_COMPONENT_TYPE_RELOCATABLE_PEIM was 'RELOCATABLE_PEIM' EDK_COMPONENT_TYPE_BS_DRIVER was 'BS_DRIVER' EDK_COMPONENT_TYPE_RT_DRIVER was 'RT_DRIVER' EDK_COMPONENT_TYPE_SAL_RT_DRIVER was 'SAL_RT_DRIVER' EDK_COMPONENT_TYPE_APPLICATION was 'APPLICATION' v2 - revert 2 files. will update later in own patches. v3 - fix v2 Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> --- BaseTools/Source/Python/Common/DataType.py | 28 ++++++++++---------- BaseTools/Source/Python/GenFds/FdfParser.py | 6 ++--- BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +- BaseTools/Source/Python/build/build.py | 8 +++--- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py index cac455f9f7cf..ffd73d6852d1 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -84,7 +84,7 @@ SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST) SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE} EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY' -EDK_COMPONENT_TYPE_SECUARITY_CORE = 'SECUARITY_CORE' +EDK_COMPONENT_TYPE_SECURITY_CORE = 'SECURITY_CORE' EDK_COMPONENT_TYPE_PEI_CORE = SUP_MODULE_PEI_CORE EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER' EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM' @@ -97,18 +97,18 @@ EDK_NAME = 'EDK' EDKII_NAME = 'EDKII' COMPONENT_TO_MODULE_MAP_DICT = { - "LIBRARY" : SUP_MODULE_BASE, - "SECURITY_CORE" : SUP_MODULE_SEC, - SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE, - "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM, - "PIC_PEIM" : SUP_MODULE_PEIM, - "RELOCATABLE_PEIM" : SUP_MODULE_PEIM, - "PE32_PEIM" : SUP_MODULE_PEIM, - "BS_DRIVER" : SUP_MODULE_DXE_DRIVER, - "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER, - "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER, - "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, - "LOGO" : SUP_MODULE_BASE, + EDK_COMPONENT_TYPE_LIBRARY : SUP_MODULE_BASE, + EDK_COMPONENT_TYPE_SECURITY_CORE : SUP_MODULE_SEC, + EDK_COMPONENT_TYPE_PEI_CORE : SUP_MODULE_PEI_CORE, + EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER : SUP_MODULE_PEIM, + EDK_COMPONENT_TYPE_PIC_PEIM : SUP_MODULE_PEIM, + EDK_COMPONENT_TYPE_RELOCATABLE_PEIM : SUP_MODULE_PEIM, + "PE32_PEIM" : SUP_MODULE_PEIM, + EDK_COMPONENT_TYPE_BS_DRIVER : SUP_MODULE_DXE_DRIVER, + EDK_COMPONENT_TYPE_RT_DRIVER : SUP_MODULE_DXE_RUNTIME_DRIVER, + EDK_COMPONENT_TYPE_SAL_RT_DRIVER : SUP_MODULE_DXE_SAL_DRIVER, + EDK_COMPONENT_TYPE_APPLICATION : SUP_MODULE_UEFI_APPLICATION, + "LOGO" : SUP_MODULE_BASE, } BINARY_FILE_TYPE_FW = 'FW' @@ -129,7 +129,7 @@ BINARY_FILE_TYPE_UI = 'UI' BINARY_FILE_TYPE_BIN = 'BIN' BINARY_FILE_TYPE_FV = 'FV' -PLATFORM_COMPONENT_TYPE_LIBRARY = 'LIBRARY' +PLATFORM_COMPONENT_TYPE_LIBRARY = EDK_COMPONENT_TYPE_LIBRARY PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS = 'LIBRARY_CLASS' PLATFORM_COMPONENT_TYPE_MODULE = 'MODULE' diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index db8947e4b453..d15656c5fc6c 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -3630,8 +3630,8 @@ class FdfParser: SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, \ SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, \ SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \ - "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \ - "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): + EDK_COMPONENT_TYPE_SECURITY_CORE, EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, \ + "PE32_PEIM", EDK_COMPONENT_TYPE_BS_DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER, EDK_COMPONENT_TYPE_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 @@ -3674,7 +3674,7 @@ class FdfParser: Type = self.__Token.strip().upper() if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,\ - "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): + "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, EDK_COMPONENT_TYPE_APPLICATION, "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) if not self.__IsToken("="): diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index d64a281a98f7..27ef163eb40c 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -344,7 +344,7 @@ class InfBuildData(ModuleBuildClassObject): self._BuildType = self._ComponentType.upper() if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT: self._ModuleType = COMPONENT_TO_MODULE_MAP_DICT[self._ComponentType] - if self._ComponentType == 'LIBRARY': + if self._ComponentType == EDK_COMPONENT_TYPE_LIBRARY: self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)] # make use some [nmake] section macros Macros = self._Macros diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 81d59dd3eedf..29ad0c7228c7 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1587,13 +1587,13 @@ class Build(): if not ImageClass.IsValid: EdkLogger.error("build", FILE_PARSE_FAILURE, ExtraData=ImageClass.ErrorInfo) ImageInfo = PeImageInfo(Module.Name, Module.Guid, Module.Arch, Module.OutputDir, Module.DebugDir, ImageClass) - if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', SUP_MODULE_DXE_CORE]: + if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, SUP_MODULE_DXE_CORE]: PeiModuleList[Module.MetaFile] = ImageInfo PeiSize += ImageInfo.Image.Size - elif Module.ModuleType in ['BS_DRIVER', SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]: + elif Module.ModuleType in [EDK_COMPONENT_TYPE_BS_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]: BtModuleList[Module.MetaFile] = ImageInfo BtSize += ImageInfo.Image.Size - elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, 'RT_DRIVER', SUP_MODULE_DXE_SAL_DRIVER, 'SAL_RT_DRIVER']: + elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER]: RtModuleList[Module.MetaFile] = ImageInfo #IPF runtime driver needs to be at 2 page alignment. if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0: @@ -2356,7 +2356,7 @@ def MyOptionParser(): Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".") Parser.add_option("-y", "--report-file", action="store", dest="ReportFile", help="Create/overwrite the report to the specified filename.") - Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['PCD','LIBRARY','FLASH','DEPEX','BUILD_FLAGS','FIXED_ADDRESS','HASH','EXECUTION_ORDER'], dest="ReportType", default=[], + Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['PCD',EDK_COMPONENT_TYPE_LIBRARY,'FLASH','DEPEX','BUILD_FLAGS','FIXED_ADDRESS','HASH','EXECUTION_ORDER'], dest="ReportType", default=[], help="Flags that control the type of build report to generate. Must be one of: [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS, HASH, EXECUTION_ORDER]. "\ "To specify more than one flag, repeat this option on the command line and the default flag set is [PCD, LIBRARY, FLASH, DEPEX, HASH, BUILD_FLAGS, FIXED_ADDRESS]") Parser.add_option("-F", "--flag", action="store", type="string", dest="Flag", -- 2.16.2.windows.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 16/27] BaseTools: Replace EDK Component strings with predefined constant 2018-04-27 14:04 ` [PATCH v3 16/27] BaseTools: Replace EDK Component strings with predefined constant Jaben Carsey @ 2018-05-02 6:45 ` Zhu, Yonghong 0 siblings, 0 replies; 4+ messages in thread From: Zhu, Yonghong @ 2018-05-02 6:45 UTC (permalink / raw) To: Carsey, Jaben, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben Sent: Friday, April 27, 2018 10:04 PM To: edk2-devel@lists.01.org Cc: Gao, Liming <liming.gao@intel.com>; Zhu, Yonghong <yonghong.zhu@intel.com> Subject: [PATCH v3 16/27] BaseTools: Replace EDK Component strings with predefined constant EDK_COMPONENT_TYPE_LIBRARY was 'LIBRARY' EDK_COMPONENT_TYPE_SECURITY_CORE was 'SECURITY_CORE' EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER was 'COMBINED_PEIM_DRIVER' EDK_COMPONENT_TYPE_PIC_PEIM was 'PIC_PEIM' EDK_COMPONENT_TYPE_RELOCATABLE_PEIM was 'RELOCATABLE_PEIM' EDK_COMPONENT_TYPE_BS_DRIVER was 'BS_DRIVER' EDK_COMPONENT_TYPE_RT_DRIVER was 'RT_DRIVER' EDK_COMPONENT_TYPE_SAL_RT_DRIVER was 'SAL_RT_DRIVER' EDK_COMPONENT_TYPE_APPLICATION was 'APPLICATION' v2 - revert 2 files. will update later in own patches. v3 - fix v2 Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> --- BaseTools/Source/Python/Common/DataType.py | 28 ++++++++++---------- BaseTools/Source/Python/GenFds/FdfParser.py | 6 ++--- BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +- BaseTools/Source/Python/build/build.py | 8 +++--- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py index cac455f9f7cf..ffd73d6852d1 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -84,7 +84,7 @@ SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST) SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE} EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY' -EDK_COMPONENT_TYPE_SECUARITY_CORE = 'SECUARITY_CORE' +EDK_COMPONENT_TYPE_SECURITY_CORE = 'SECURITY_CORE' EDK_COMPONENT_TYPE_PEI_CORE = SUP_MODULE_PEI_CORE EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER' EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM' @@ -97,18 +97,18 @@ EDK_NAME = 'EDK' EDKII_NAME = 'EDKII' COMPONENT_TO_MODULE_MAP_DICT = { - "LIBRARY" : SUP_MODULE_BASE, - "SECURITY_CORE" : SUP_MODULE_SEC, - SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE, - "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM, - "PIC_PEIM" : SUP_MODULE_PEIM, - "RELOCATABLE_PEIM" : SUP_MODULE_PEIM, - "PE32_PEIM" : SUP_MODULE_PEIM, - "BS_DRIVER" : SUP_MODULE_DXE_DRIVER, - "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER, - "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER, - "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, - "LOGO" : SUP_MODULE_BASE, + EDK_COMPONENT_TYPE_LIBRARY : SUP_MODULE_BASE, + EDK_COMPONENT_TYPE_SECURITY_CORE : SUP_MODULE_SEC, + EDK_COMPONENT_TYPE_PEI_CORE : SUP_MODULE_PEI_CORE, + EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER : SUP_MODULE_PEIM, + EDK_COMPONENT_TYPE_PIC_PEIM : SUP_MODULE_PEIM, + EDK_COMPONENT_TYPE_RELOCATABLE_PEIM : SUP_MODULE_PEIM, + "PE32_PEIM" : SUP_MODULE_PEIM, + EDK_COMPONENT_TYPE_BS_DRIVER : SUP_MODULE_DXE_DRIVER, + EDK_COMPONENT_TYPE_RT_DRIVER : SUP_MODULE_DXE_RUNTIME_DRIVER, + EDK_COMPONENT_TYPE_SAL_RT_DRIVER : SUP_MODULE_DXE_SAL_DRIVER, + EDK_COMPONENT_TYPE_APPLICATION : SUP_MODULE_UEFI_APPLICATION, + "LOGO" : SUP_MODULE_BASE, } BINARY_FILE_TYPE_FW = 'FW' @@ -129,7 +129,7 @@ BINARY_FILE_TYPE_UI = 'UI' BINARY_FILE_TYPE_BIN = 'BIN' BINARY_FILE_TYPE_FV = 'FV' -PLATFORM_COMPONENT_TYPE_LIBRARY = 'LIBRARY' +PLATFORM_COMPONENT_TYPE_LIBRARY = EDK_COMPONENT_TYPE_LIBRARY PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS = 'LIBRARY_CLASS' PLATFORM_COMPONENT_TYPE_MODULE = 'MODULE' diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index db8947e4b453..d15656c5fc6c 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -3630,8 +3630,8 @@ class FdfParser: SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, \ SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, \ SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \ - "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \ - "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): + EDK_COMPONENT_TYPE_SECURITY_CORE, EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, \ + "PE32_PEIM", EDK_COMPONENT_TYPE_BS_DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER, EDK_COMPONENT_TYPE_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 @@ -3674,7 +3674,7 @@ class FdfParser: Type = self.__Token.strip().upper() if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,\ - "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): + "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_CORE, EDK_COMPONENT_TYPE_APPLICATION, "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) if not self.__IsToken("="): diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index d64a281a98f7..27ef163eb40c 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -344,7 +344,7 @@ class InfBuildData(ModuleBuildClassObject): self._BuildType = self._ComponentType.upper() if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT: self._ModuleType = COMPONENT_TO_MODULE_MAP_DICT[self._ComponentType] - if self._ComponentType == 'LIBRARY': + if self._ComponentType == EDK_COMPONENT_TYPE_LIBRARY: self._LibraryClass = [LibraryClassObject(self._BaseName, SUP_MODULE_LIST)] # make use some [nmake] section macros Macros = self._Macros diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 81d59dd3eedf..29ad0c7228c7 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1587,13 +1587,13 @@ class Build(): if not ImageClass.IsValid: EdkLogger.error("build", FILE_PARSE_FAILURE, ExtraData=ImageClass.ErrorInfo) ImageInfo = PeImageInfo(Module.Name, Module.Guid, Module.Arch, Module.OutputDir, Module.DebugDir, ImageClass) - if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', SUP_MODULE_DXE_CORE]: + if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, SUP_MODULE_DXE_CORE]: PeiModuleList[Module.MetaFile] = ImageInfo PeiSize += ImageInfo.Image.Size - elif Module.ModuleType in ['BS_DRIVER', SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]: + elif Module.ModuleType in [EDK_COMPONENT_TYPE_BS_DRIVER, SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]: BtModuleList[Module.MetaFile] = ImageInfo BtSize += ImageInfo.Image.Size - elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, 'RT_DRIVER', SUP_MODULE_DXE_SAL_DRIVER, 'SAL_RT_DRIVER']: + elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER]: RtModuleList[Module.MetaFile] = ImageInfo #IPF runtime driver needs to be at 2 page alignment. if IsIpfPlatform and ImageInfo.Image.Size % 0x2000 != 0: @@ -2356,7 +2356,7 @@ def MyOptionParser(): Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".") Parser.add_option("-y", "--report-file", action="store", dest="ReportFile", help="Create/overwrite the report to the specified filename.") - Parser.add_option("-Y", "--report-type", action="append", type="choice", choices=['PCD','LIBRARY','FLASH','DEPEX','BUILD_FLAGS','FIXED_ADDRESS','HASH','EXECUTION_ORDER'], dest="ReportType", default=[], + Parser.add_option("-Y", "--report-type", action="append", + type="choice", + choices=['PCD',EDK_COMPONENT_TYPE_LIBRARY,'FLASH','DEPEX','BUILD_FLAGS + ','FIXED_ADDRESS','HASH','EXECUTION_ORDER'], dest="ReportType", + default=[], help="Flags that control the type of build report to generate. Must be one of: [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS, HASH, EXECUTION_ORDER]. "\ "To specify more than one flag, repeat this option on the command line and the default flag set is [PCD, LIBRARY, FLASH, DEPEX, HASH, BUILD_FLAGS, FIXED_ADDRESS]") Parser.add_option("-F", "--flag", action="store", type="string", dest="Flag", -- 2.16.2.windows.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-02 6:45 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <cover.1524837705.git.jaben.carsey@intel.com> 2018-04-27 14:04 ` [PATCH v2 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts Jaben Carsey 2018-05-02 6:44 ` Zhu, Yonghong 2018-04-27 14:04 ` [PATCH v3 16/27] BaseTools: Replace EDK Component strings with predefined constant Jaben Carsey 2018-05-02 6:45 ` Zhu, Yonghong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox