BaseTools: Cleanup unneeded code

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>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Jaben Carsey
2018-05-18 08:06:52 +08:00
committed by Yonghong Zhu
parent c14b58614f
commit caf744956d
13 changed files with 245 additions and 283 deletions

View File

@@ -50,6 +50,7 @@ import hashlib
from GenVar import VariableMgr,var_info from GenVar import VariableMgr,var_info
from collections import OrderedDict from collections import OrderedDict
from collections import defaultdict from collections import defaultdict
from Workspace.WorkspaceCommon import OrderedListDict
## Regular expression for splitting Dependency Expression string into tokens ## Regular expression for splitting Dependency Expression string into tokens
gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)") gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)")
@@ -481,7 +482,7 @@ class WorkspaceAutoGen(AutoGen):
'build', 'build',
FORMAT_INVALID, FORMAT_INVALID,
"Building modules from source INFs, following PCD use %s and %s access method. It must be corrected to use only one access method." % (i, j), "Building modules from source INFs, following PCD use %s and %s access method. It must be corrected to use only one access method." % (i, j),
ExtraData="%s" % '\n\t'.join(str(P[1]+'.'+P[0]) for P in Intersections) ExtraData='\n\t'.join(str(P[1]+'.'+P[0]) for P in Intersections)
) )
# #
@@ -723,10 +724,8 @@ class WorkspaceAutoGen(AutoGen):
# #
if self.FdfFile: if self.FdfFile:
AllWorkSpaceMetaFiles.add (self.FdfFile.Path) AllWorkSpaceMetaFiles.add (self.FdfFile.Path)
if self.FdfFile: for f in GlobalData.gFdfParser.GetAllIncludedFile():
FdfFiles = GlobalData.gFdfParser.GetAllIncludedFile() AllWorkSpaceMetaFiles.add (f.FileName)
for f in FdfFiles:
AllWorkSpaceMetaFiles.add (f.FileName)
# #
# add dsc # add dsc
# #
@@ -747,19 +746,16 @@ class WorkspaceAutoGen(AutoGen):
AllWorkSpaceMetaFiles.add(os.path.join(self.BuildDir, 'PcdTokenNumber')) AllWorkSpaceMetaFiles.add(os.path.join(self.BuildDir, 'PcdTokenNumber'))
for Arch in self.ArchList: for Arch in self.ArchList:
Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]
PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)
# #
# add dec # add dec
# #
for Package in PGen.PackageList: for Package in PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch).PackageList:
AllWorkSpaceMetaFiles.add(Package.MetaFile.Path) AllWorkSpaceMetaFiles.add(Package.MetaFile.Path)
# #
# add included dsc # add included dsc
# #
for filePath in Platform._RawData.IncludedFiles: for filePath in self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]._RawData.IncludedFiles:
AllWorkSpaceMetaFiles.add(filePath.Path) AllWorkSpaceMetaFiles.add(filePath.Path)
return AllWorkSpaceMetaFiles return AllWorkSpaceMetaFiles
@@ -890,11 +886,11 @@ class WorkspaceAutoGen(AutoGen):
def _CheckPcdDefineAndType(self): def _CheckPcdDefineAndType(self):
PcdTypeList = [ PcdTypeSet = {TAB_PCDS_FIXED_AT_BUILD,
TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG, TAB_PCDS_PATCHABLE_IN_MODULE,
TAB_PCDS_DYNAMIC, #TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_FEATURE_FLAG,
TAB_PCDS_DYNAMIC_EX, # TAB_PCDS_DYNAMIC_EX_HII, TAB_PCDS_DYNAMIC_EX_VPD TAB_PCDS_DYNAMIC,
] TAB_PCDS_DYNAMIC_EX}
# This dict store PCDs which are not used by any modules with specified arches # This dict store PCDs which are not used by any modules with specified arches
UnusedPcd = OrderedDict() UnusedPcd = OrderedDict()
@@ -917,7 +913,7 @@ class WorkspaceAutoGen(AutoGen):
# Key of DEC's Pcds dictionary is PcdCName, TokenSpaceGuid, PcdType # Key of DEC's Pcds dictionary is PcdCName, TokenSpaceGuid, PcdType
if (Pcd[0], Pcd[1], PcdType) in Package.Pcds: if (Pcd[0], Pcd[1], PcdType) in Package.Pcds:
break break
for Type in PcdTypeList: for Type in PcdTypeSet:
if (Pcd[0], Pcd[1], Type) in Package.Pcds: if (Pcd[0], Pcd[1], Type) in Package.Pcds:
EdkLogger.error( EdkLogger.error(
'build', 'build',
@@ -1075,9 +1071,10 @@ class WorkspaceAutoGen(AutoGen):
# modules will be created as well # modules will be created as well
# #
def CreateMakeFile(self, CreateDepsMakeFile=False): def CreateMakeFile(self, CreateDepsMakeFile=False):
if CreateDepsMakeFile: if not CreateDepsMakeFile:
for Pa in self.AutoGenObjectList: return
Pa.CreateMakeFile(CreateDepsMakeFile) for Pa in self.AutoGenObjectList:
Pa.CreateMakeFile(True)
## Create autogen code for platform and modules ## Create autogen code for platform and modules
# #
@@ -1091,7 +1088,7 @@ class WorkspaceAutoGen(AutoGen):
if not CreateDepsCodeFile: if not CreateDepsCodeFile:
return return
for Pa in self.AutoGenObjectList: for Pa in self.AutoGenObjectList:
Pa.CreateCodeFile(CreateDepsCodeFile) Pa.CreateCodeFile(True)
## Create AsBuilt INF file the platform ## Create AsBuilt INF file the platform
# #
@@ -1396,11 +1393,7 @@ class PlatformAutoGen(AutoGen):
del self.Platform.Pcds[key] del self.Platform.Pcds[key]
self.Platform.Pcds[newkey] = Value self.Platform.Pcds[newkey] = Value
break break
else:
pass
break break
else:
pass
# for gathering error information # for gathering error information
NoDatumTypePcdList = set() NoDatumTypePcdList = set()
@@ -1585,8 +1578,7 @@ class PlatformAutoGen(AutoGen):
PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultValue = vardump PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultValue = vardump
PcdNvStoreDfBuffer.MaxDatumSize = str(len(vardump.split(","))) PcdNvStoreDfBuffer.MaxDatumSize = str(len(vardump.split(",")))
PlatformPcds = self._PlatformPcds.keys() PlatformPcds = sorted(self._PlatformPcds.keys())
PlatformPcds.sort()
# #
# Add VPD type PCD into VpdFile and determine whether the VPD PCD need to be fixed up. # Add VPD type PCD into VpdFile and determine whether the VPD PCD need to be fixed up.
# #
@@ -1892,7 +1884,7 @@ class PlatformAutoGen(AutoGen):
if Flags.startswith('='): if Flags.startswith('='):
self._BuildCommand = [self._BuildCommand[0]] + [Flags[1:]] self._BuildCommand = [self._BuildCommand[0]] + [Flags[1:]]
else: else:
self._BuildCommand += [Flags] self._BuildCommand.append(Flags)
return self._BuildCommand return self._BuildCommand
## Get tool chain definition ## Get tool chain definition
@@ -2087,32 +2079,28 @@ class PlatformAutoGen(AutoGen):
# TokeNumber 11 ~ 20 # TokeNumber 11 ~ 20
# #
for Pcd in self.DynamicPcdList: for Pcd in self.DynamicPcdList:
if Pcd.Phase == "PEI": if Pcd.Phase == "PEI" and Pcd.Type in PCD_DYNAMIC_TYPE_SET:
if Pcd.Type in PCD_DYNAMIC_TYPE_SET: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))
EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber
self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber TokenNumber += 1
TokenNumber += 1
for Pcd in self.DynamicPcdList: for Pcd in self.DynamicPcdList:
if Pcd.Phase == "PEI": if Pcd.Phase == "PEI" and Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))
EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber
self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber TokenNumber += 1
TokenNumber += 1
for Pcd in self.DynamicPcdList: for Pcd in self.DynamicPcdList:
if Pcd.Phase == "DXE": if Pcd.Phase == "DXE" and Pcd.Type in PCD_DYNAMIC_TYPE_SET:
if Pcd.Type in PCD_DYNAMIC_TYPE_SET: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))
EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber
self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber TokenNumber += 1
TokenNumber += 1
for Pcd in self.DynamicPcdList: for Pcd in self.DynamicPcdList:
if Pcd.Phase == "DXE": if Pcd.Phase == "DXE" and Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber))
EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber
self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber TokenNumber += 1
TokenNumber += 1
for Pcd in self.NonDynamicPcdList: for Pcd in self.NonDynamicPcdList:
self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName] = TokenNumber
@@ -2203,8 +2191,8 @@ class PlatformAutoGen(AutoGen):
if FromPcd is not None: if FromPcd is not None:
if ToPcd.Pending and FromPcd.Type: if ToPcd.Pending and FromPcd.Type:
ToPcd.Type = FromPcd.Type ToPcd.Type = FromPcd.Type
elif (ToPcd.Type) and (FromPcd.Type)\ elif ToPcd.Type and FromPcd.Type\
and (ToPcd.Type != FromPcd.Type) and (ToPcd.Type in FromPcd.Type): and ToPcd.Type != FromPcd.Type and ToPcd.Type in FromPcd.Type:
if ToPcd.Type.strip() == TAB_PCDS_DYNAMIC_EX: if ToPcd.Type.strip() == TAB_PCDS_DYNAMIC_EX:
ToPcd.Type = FromPcd.Type ToPcd.Type = FromPcd.Type
elif ToPcd.Type and FromPcd.Type \ elif ToPcd.Type and FromPcd.Type \
@@ -2417,13 +2405,14 @@ class PlatformAutoGen(AutoGen):
if (Key[0] == self.BuildRuleFamily and if (Key[0] == self.BuildRuleFamily and
(ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and Key[2] == ModuleStyle))): (ModuleStyle is None or len(Key) < 3 or (len(Key) > 2 and Key[2] == ModuleStyle))):
Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_') Target, ToolChain, Arch, CommandType, Attr = Key[1].split('_')
if Target == self.BuildTarget or Target == "*": if (Target == self.BuildTarget or Target == "*") and\
if ToolChain == self.ToolChain or ToolChain == "*": (ToolChain == self.ToolChain or ToolChain == "*") and\
if Arch == self.Arch or Arch == "*": (Arch == self.Arch or Arch == "*") and\
if Options[Key].startswith("="): Options[Key].startswith("="):
if OverrideList.get(Key[1]) is not None:
OverrideList.pop(Key[1]) if OverrideList.get(Key[1]) is not None:
OverrideList[Key[1]] = Options[Key] OverrideList.pop(Key[1])
OverrideList[Key[1]] = Options[Key]
# #
# Use the highest priority value. # Use the highest priority value.
@@ -2439,17 +2428,18 @@ class PlatformAutoGen(AutoGen):
# Compare two Key, if one is included by another, choose the higher priority one # Compare two Key, if one is included by another, choose the higher priority one
# #
Target2, ToolChain2, Arch2, CommandType2, Attr2 = NextKey.split("_") Target2, ToolChain2, Arch2, CommandType2, Attr2 = NextKey.split("_")
if Target1 == Target2 or Target1 == "*" or Target2 == "*": if (Target1 == Target2 or Target1 == "*" or Target2 == "*") and\
if ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2 == "*": (ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2 == "*") and\
if Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*": (Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*") and\
if CommandType1 == CommandType2 or CommandType1 == "*" or CommandType2 == "*": (CommandType1 == CommandType2 or CommandType1 == "*" or CommandType2 == "*") and\
if Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*": (Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*"):
if self.CalculatePriorityValue(NowKey) > self.CalculatePriorityValue(NextKey):
if Options.get((self.BuildRuleFamily, NextKey)) is not None: if self.CalculatePriorityValue(NowKey) > self.CalculatePriorityValue(NextKey):
Options.pop((self.BuildRuleFamily, NextKey)) if Options.get((self.BuildRuleFamily, NextKey)) is not None:
else: Options.pop((self.BuildRuleFamily, NextKey))
if Options.get((self.BuildRuleFamily, NowKey)) is not None: else:
Options.pop((self.BuildRuleFamily, NowKey)) if Options.get((self.BuildRuleFamily, NowKey)) is not None:
Options.pop((self.BuildRuleFamily, NowKey))
for Key in Options: for Key in Options:
if ModuleStyle is not None and len (Key) > 2: if ModuleStyle is not None and len (Key) > 2:
@@ -2611,6 +2601,15 @@ class PlatformAutoGen(AutoGen):
LibraryAutoGenList = property(_GetLibraryAutoGenList) LibraryAutoGenList = property(_GetLibraryAutoGenList)
GenFdsCommand = property(_GenFdsCommand) GenFdsCommand = property(_GenFdsCommand)
#
# extend lists contained in a dictionary with lists stored in another dictionary
# if CopyToDict is not derived from DefaultDict(list) then this may raise exception
#
def ExtendCopyDictionaryLists(CopyToDict, CopyFromDict):
for Key in CopyFromDict:
CopyToDict[Key].extend(CopyFromDict[Key])
## ModuleAutoGen class ## ModuleAutoGen class
# #
# This class encapsules the AutoGen behaviors for the build tools. In addition to # This class encapsules the AutoGen behaviors for the build tools. In addition to
@@ -2701,7 +2700,6 @@ class ModuleAutoGen(AutoGen):
self._MakeFileDir = None self._MakeFileDir = None
self._IncludePathList = None self._IncludePathList = None
self._IncludePathLength = 0
self._AutoGenFileList = None self._AutoGenFileList = None
self._UnicodeFileList = None self._UnicodeFileList = None
self._VfrFileList = None self._VfrFileList = None
@@ -2716,16 +2714,16 @@ class ModuleAutoGen(AutoGen):
self._DerivedPackageList = None self._DerivedPackageList = None
self._ModulePcdList = None self._ModulePcdList = None
self._LibraryPcdList = None self._LibraryPcdList = None
self._PcdComments = OrderedDict() self._PcdComments = OrderedListDict()
self._GuidList = None self._GuidList = None
self._GuidsUsedByPcd = None self._GuidsUsedByPcd = None
self._GuidComments = OrderedDict() self._GuidComments = OrderedListDict()
self._ProtocolList = None self._ProtocolList = None
self._ProtocolComments = OrderedDict() self._ProtocolComments = OrderedListDict()
self._PpiList = None self._PpiList = None
self._PpiComments = OrderedDict() self._PpiComments = OrderedListDict()
self._DepexList = None self._DepexDict = None
self._DepexExpressionList = None self._DepexExpressionDict = None
self._BuildOption = None self._BuildOption = None
self._BuildOptionIncPathList = None self._BuildOptionIncPathList = None
self._BuildTargets = None self._BuildTargets = None
@@ -2747,7 +2745,6 @@ class ModuleAutoGen(AutoGen):
# #
self._FixedAtBuildPcds = [] self._FixedAtBuildPcds = []
self.ConstPcd = {} self.ConstPcd = {}
return True
def __repr__(self): def __repr__(self):
return "%s [%s]" % (self.MetaFile, self.Arch) return "%s [%s]" % (self.MetaFile, self.Arch)
@@ -2875,10 +2872,7 @@ class ModuleAutoGen(AutoGen):
## Check if the module is library or not ## Check if the module is library or not
def _IsLibrary(self): def _IsLibrary(self):
if self._LibraryFlag is None: if self._LibraryFlag is None:
if self.Module.LibraryClass is not None and self.Module.LibraryClass != []: self._LibraryFlag = True if self.Module.LibraryClass else False
self._LibraryFlag = True
else:
self._LibraryFlag = False
return self._LibraryFlag return self._LibraryFlag
## Check if the module is binary module or not ## Check if the module is binary module or not
@@ -3030,15 +3024,15 @@ class ModuleAutoGen(AutoGen):
# @retval list The token list of the dependency expression after parsed # @retval list The token list of the dependency expression after parsed
# #
def _GetDepexTokenList(self): def _GetDepexTokenList(self):
if self._DepexList is None: if self._DepexDict is None:
self._DepexList = {} self._DepexDict = {}
if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes: if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
return self._DepexList return self._DepexDict
self._DepexList[self.ModuleType] = [] self._DepexDict[self.ModuleType] = []
for ModuleType in self._DepexList: for ModuleType in self._DepexDict:
DepexList = self._DepexList[ModuleType] DepexList = self._DepexDict[ModuleType]
# #
# Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion # Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion
# #
@@ -3059,43 +3053,43 @@ class ModuleAutoGen(AutoGen):
break break
if len(DepexList) > 0: if len(DepexList) > 0:
EdkLogger.verbose('') EdkLogger.verbose('')
return self._DepexList return self._DepexDict
## Merge dependency expression ## Merge dependency expression
# #
# @retval list The token list of the dependency expression after parsed # @retval list The token list of the dependency expression after parsed
# #
def _GetDepexExpressionTokenList(self): def _GetDepexExpressionTokenList(self):
if self._DepexExpressionList is None: if self._DepexExpressionDict is None:
self._DepexExpressionList = {} self._DepexExpressionDict = {}
if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes: if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
return self._DepexExpressionList return self._DepexExpressionDict
self._DepexExpressionList[self.ModuleType] = '' self._DepexExpressionDict[self.ModuleType] = ''
for ModuleType in self._DepexExpressionList: for ModuleType in self._DepexExpressionDict:
DepexExpressionList = self._DepexExpressionList[ModuleType] DepexExpressionString = self._DepexExpressionDict[ModuleType]
# #
# Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion # Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion
# #
for M in [self.Module] + self.DependentLibraryList: for M in [self.Module] + self.DependentLibraryList:
Inherited = False Inherited = False
for D in M.DepexExpression[self.Arch, ModuleType]: for D in M.DepexExpression[self.Arch, ModuleType]:
if DepexExpressionList != '': if DepexExpressionString != '':
DepexExpressionList += ' AND ' DepexExpressionString += ' AND '
DepexExpressionList += '(' DepexExpressionString += '('
DepexExpressionList += D DepexExpressionString += D
DepexExpressionList = DepexExpressionList.rstrip('END').strip() DepexExpressionString = DepexExpressionString.rstrip('END').strip()
DepexExpressionList += ')' DepexExpressionString += ')'
Inherited = True Inherited = True
if Inherited: if Inherited:
EdkLogger.verbose("DEPEX[%s] (+%s) = %s" % (self.Name, M.BaseName, DepexExpressionList)) EdkLogger.verbose("DEPEX[%s] (+%s) = %s" % (self.Name, M.BaseName, DepexExpressionString))
if 'BEFORE' in DepexExpressionList or 'AFTER' in DepexExpressionList: if 'BEFORE' in DepexExpressionString or 'AFTER' in DepexExpressionString:
break break
if len(DepexExpressionList) > 0: if len(DepexExpressionString) > 0:
EdkLogger.verbose('') EdkLogger.verbose('')
self._DepexExpressionList[ModuleType] = DepexExpressionList self._DepexExpressionDict[ModuleType] = DepexExpressionString
return self._DepexExpressionList return self._DepexExpressionDict
# Get the tiano core user extension, it is contain dependent library. # Get the tiano core user extension, it is contain dependent library.
# @retval: a list contain tiano core userextension. # @retval: a list contain tiano core userextension.
@@ -3163,9 +3157,8 @@ class ModuleAutoGen(AutoGen):
BuildOptionIncPathList = [] BuildOptionIncPathList = []
for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'): for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'):
Attr = 'FLAGS'
try: try:
FlagOption = self.BuildOption[Tool][Attr] FlagOption = self.BuildOption[Tool]['FLAGS']
except KeyError: except KeyError:
FlagOption = '' FlagOption = ''
@@ -3178,13 +3171,13 @@ class ModuleAutoGen(AutoGen):
IncPathList = [] IncPathList = []
for Path in BuildOptIncludeRegEx.findall(FlagOption): for Path in BuildOptIncludeRegEx.findall(FlagOption):
PathList = GetSplitList(Path, TAB_COMMA_SPLIT) PathList = GetSplitList(Path, TAB_COMMA_SPLIT)
IncPathList += [NormPath(PathEntry, self.Macros) for PathEntry in PathList] IncPathList.extend(NormPath(PathEntry, self.Macros) for PathEntry in PathList)
# #
# EDK II modules must not reference header files outside of the packages they depend on or # EDK II modules must not reference header files outside of the packages they depend on or
# within the module's directory tree. Report error if violation. # within the module's directory tree. Report error if violation.
# #
if self.AutoGenVersion >= 0x00010005 and len(IncPathList) > 0: if self.AutoGenVersion >= 0x00010005:
for Path in IncPathList: for Path in IncPathList:
if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir): if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir):
ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption) ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption)
@@ -3338,7 +3331,7 @@ class ModuleAutoGen(AutoGen):
if not os.path.exists(SubDirectory): if not os.path.exists(SubDirectory):
CreateDirectory(SubDirectory) CreateDirectory(SubDirectory)
LastTarget = None LastTarget = None
RuleChain = [] RuleChain = set()
SourceList = [File] SourceList = [File]
Index = 0 Index = 0
# #
@@ -3395,7 +3388,7 @@ class ModuleAutoGen(AutoGen):
if FileType in RuleChain: if FileType in RuleChain:
break break
RuleChain.append(FileType) RuleChain.add(FileType)
SourceList.extend(Target.Outputs) SourceList.extend(Target.Outputs)
LastTarget = Target LastTarget = Target
FileType = TAB_UNKNOWN_FILE FileType = TAB_UNKNOWN_FILE
@@ -3504,12 +3497,6 @@ class ModuleAutoGen(AutoGen):
self._DependentLibraryList = self.PlatformInfo.ApplyLibraryInstance(self.Module) self._DependentLibraryList = self.PlatformInfo.ApplyLibraryInstance(self.Module)
return self._DependentLibraryList return self._DependentLibraryList
@staticmethod
def UpdateComments(Recver, Src):
for Key in Src:
if Key not in Recver:
Recver[Key] = []
Recver[Key].extend(Src[Key])
## Get the list of PCDs from current module ## Get the list of PCDs from current module
# #
# @retval list The list of PCD # @retval list The list of PCD
@@ -3518,7 +3505,7 @@ class ModuleAutoGen(AutoGen):
if self._ModulePcdList is None: if self._ModulePcdList is None:
# apply PCD settings from platform # apply PCD settings from platform
self._ModulePcdList = self.PlatformInfo.ApplyPcdSetting(self.Module, self.Module.Pcds) self._ModulePcdList = self.PlatformInfo.ApplyPcdSetting(self.Module, self.Module.Pcds)
self.UpdateComments(self._PcdComments, self.Module.PcdComments) ExtendCopyDictionaryLists(self._PcdComments, self.Module.PcdComments)
return self._ModulePcdList return self._ModulePcdList
## Get the list of PCDs from dependent libraries ## Get the list of PCDs from dependent libraries
@@ -3533,7 +3520,7 @@ class ModuleAutoGen(AutoGen):
self._LibraryPcdList = [] self._LibraryPcdList = []
for Library in self.DependentLibraryList: for Library in self.DependentLibraryList:
PcdsInLibrary = OrderedDict() PcdsInLibrary = OrderedDict()
self.UpdateComments(self._PcdComments, Library.PcdComments) ExtendCopyDictionaryLists(self._PcdComments, Library.PcdComments)
for Key in Library.Pcds: for Key in Library.Pcds:
# skip duplicated PCDs # skip duplicated PCDs
if Key in self.Module.Pcds or Key in Pcds: if Key in self.Module.Pcds or Key in Pcds:
@@ -3555,8 +3542,8 @@ class ModuleAutoGen(AutoGen):
self._GuidList.update(self.Module.Guids) self._GuidList.update(self.Module.Guids)
for Library in self.DependentLibraryList: for Library in self.DependentLibraryList:
self._GuidList.update(Library.Guids) self._GuidList.update(Library.Guids)
self.UpdateComments(self._GuidComments, Library.GuidComments) ExtendCopyDictionaryLists(self._GuidComments, Library.GuidComments)
self.UpdateComments(self._GuidComments, self.Module.GuidComments) ExtendCopyDictionaryLists(self._GuidComments, self.Module.GuidComments)
return self._GuidList return self._GuidList
def GetGuidsUsedByPcd(self): def GetGuidsUsedByPcd(self):
@@ -3576,8 +3563,8 @@ class ModuleAutoGen(AutoGen):
self._ProtocolList.update(self.Module.Protocols) self._ProtocolList.update(self.Module.Protocols)
for Library in self.DependentLibraryList: for Library in self.DependentLibraryList:
self._ProtocolList.update(Library.Protocols) self._ProtocolList.update(Library.Protocols)
self.UpdateComments(self._ProtocolComments, Library.ProtocolComments) ExtendCopyDictionaryLists(self._ProtocolComments, Library.ProtocolComments)
self.UpdateComments(self._ProtocolComments, self.Module.ProtocolComments) ExtendCopyDictionaryLists(self._ProtocolComments, self.Module.ProtocolComments)
return self._ProtocolList return self._ProtocolList
## Get the PPI value mapping ## Get the PPI value mapping
@@ -3590,8 +3577,8 @@ class ModuleAutoGen(AutoGen):
self._PpiList.update(self.Module.Ppis) self._PpiList.update(self.Module.Ppis)
for Library in self.DependentLibraryList: for Library in self.DependentLibraryList:
self._PpiList.update(Library.Ppis) self._PpiList.update(Library.Ppis)
self.UpdateComments(self._PpiComments, Library.PpiComments) ExtendCopyDictionaryLists(self._PpiComments, Library.PpiComments)
self.UpdateComments(self._PpiComments, self.Module.PpiComments) ExtendCopyDictionaryLists(self._PpiComments, self.Module.PpiComments)
return self._PpiList return self._PpiList
## Get the list of include search path ## Get the list of include search path
@@ -3629,11 +3616,7 @@ class ModuleAutoGen(AutoGen):
return self._IncludePathList return self._IncludePathList
def _GetIncludePathLength(self): def _GetIncludePathLength(self):
self._IncludePathLength = 0 return sum(len(inc)+1 for inc in self._IncludePathList)
if self._IncludePathList:
for inc in self._IncludePathList:
self._IncludePathLength += len(' ' + inc)
return self._IncludePathLength
## Get HII EX PCDs which maybe used by VFR ## Get HII EX PCDs which maybe used by VFR
# #
@@ -3687,12 +3670,11 @@ class ModuleAutoGen(AutoGen):
for Pcd in self.PlatformInfo.Platform.Pcds.values(): for Pcd in self.PlatformInfo.Platform.Pcds.values():
if Pcd.Type != TAB_PCDS_DYNAMIC_EX_HII: if Pcd.Type != TAB_PCDS_DYNAMIC_EX_HII:
continue continue
for SkuName in Pcd.SkuInfoList: for SkuInfo in Pcd.SkuInfoList.values():
SkuInfo = Pcd.SkuInfoList[SkuName]
Name = ConvertStringToByteArray(SkuInfo.VariableName)
Value = GuidValue(SkuInfo.VariableGuid, self.PlatformInfo.PackageList, self.MetaFile.Path) Value = GuidValue(SkuInfo.VariableGuid, self.PlatformInfo.PackageList, self.MetaFile.Path)
if not Value: if not Value:
continue continue
Name = ConvertStringToByteArray(SkuInfo.VariableName)
Guid = GuidStructureStringToGuidString(Value) Guid = GuidStructureStringToGuidString(Value)
if (Name, Guid) in NameGuids and Pcd not in HiiExPcds: if (Name, Guid) in NameGuids and Pcd not in HiiExPcds:
HiiExPcds.append(Pcd) HiiExPcds.append(Pcd)
@@ -3708,13 +3690,13 @@ class ModuleAutoGen(AutoGen):
# search the .map file to find the offset of vfr binary in the PE32+/TE file. # search the .map file to find the offset of vfr binary in the PE32+/TE file.
# #
VfrUniBaseName[SourceFile.BaseName] = (SourceFile.BaseName + "Bin") VfrUniBaseName[SourceFile.BaseName] = (SourceFile.BaseName + "Bin")
if SourceFile.Type.upper() == ".UNI" : elif SourceFile.Type.upper() == ".UNI" :
# #
# search the .map file to find the offset of Uni strings binary in the PE32+/TE file. # search the .map file to find the offset of Uni strings binary in the PE32+/TE file.
# #
VfrUniBaseName["UniOffsetName"] = (self.Name + "Strings") VfrUniBaseName["UniOffsetName"] = (self.Name + "Strings")
if len(VfrUniBaseName) == 0: if not VfrUniBaseName:
return None return None
MapFileName = os.path.join(self.OutputDir, self.Name + ".map") MapFileName = os.path.join(self.OutputDir, self.Name + ".map")
EfiFileName = os.path.join(self.OutputDir, self.Name + ".efi") EfiFileName = os.path.join(self.OutputDir, self.Name + ".efi")
@@ -3773,10 +3755,9 @@ class ModuleAutoGen(AutoGen):
# #
def CreateAsBuiltInf(self, IsOnlyCopy = False): def CreateAsBuiltInf(self, IsOnlyCopy = False):
self.OutputFile = set() self.OutputFile = set()
if IsOnlyCopy: if IsOnlyCopy and GlobalData.gBinCacheDest:
if GlobalData.gBinCacheDest: self.CopyModuleToCache()
self.CopyModuleToCache() return
return
if self.IsAsBuiltInfCreated: if self.IsAsBuiltInfCreated:
return return
@@ -3808,11 +3789,11 @@ class ModuleAutoGen(AutoGen):
PcdTokenSpaceList = [] PcdTokenSpaceList = []
for Pcd in self.ModulePcdList + self.LibraryPcdList: for Pcd in self.ModulePcdList + self.LibraryPcdList:
if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
PatchablePcds += [Pcd] PatchablePcds.append(Pcd)
PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_PATCHABLE_IN_MODULE)) PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_PATCHABLE_IN_MODULE))
elif Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: elif Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
if Pcd not in Pcds: if Pcd not in Pcds:
Pcds += [Pcd] Pcds.append(Pcd)
PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC_EX)) PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC_EX))
PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC)) PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC))
PcdTokenSpaceList.append(Pcd.TokenSpaceGuidCName) PcdTokenSpaceList.append(Pcd.TokenSpaceGuidCName)
@@ -3832,10 +3813,11 @@ class ModuleAutoGen(AutoGen):
for Index in range(len(BeChecked)): for Index in range(len(BeChecked)):
for Item in CheckList[Index]: for Item in CheckList[Index]:
if Item in BeChecked[Index]: if Item in BeChecked[Index]:
Packages += [Package] Packages.append(Package)
Found = True Found = True
break break
if Found: break if Found:
break
VfrPcds = self._GetPcdsMaybeUsedByVfr() VfrPcds = self._GetPcdsMaybeUsedByVfr()
for Pkg in self.PlatformInfo.PackageList: for Pkg in self.PlatformInfo.PackageList:
@@ -3844,17 +3826,11 @@ class ModuleAutoGen(AutoGen):
for VfrPcd in VfrPcds: for VfrPcd in VfrPcds:
if ((VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC_EX) in Pkg.Pcds or if ((VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC_EX) in Pkg.Pcds or
(VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC) in Pkg.Pcds): (VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PCDS_DYNAMIC) in Pkg.Pcds):
Packages += [Pkg] Packages.append(Pkg)
break break
ModuleType = self.ModuleType ModuleType = SUP_MODULE_DXE_DRIVER if self.ModuleType == SUP_MODULE_UEFI_DRIVER and self.DepexGenerated else self.ModuleType
if ModuleType == SUP_MODULE_UEFI_DRIVER and self.DepexGenerated: DriverType = self.PcdIsDriver if self.PcdIsDriver else ''
ModuleType = SUP_MODULE_DXE_DRIVER
DriverType = ''
if self.PcdIsDriver != '':
DriverType = self.PcdIsDriver
Guid = self.Guid Guid = self.Guid
MDefs = self.Module.Defines MDefs = self.Module.Defines
@@ -3880,7 +3856,7 @@ class ModuleAutoGen(AutoGen):
'module_uefi_hii_resource_section' : [MDefs['UEFI_HII_RESOURCE_SECTION']] if 'UEFI_HII_RESOURCE_SECTION' in MDefs else [], 'module_uefi_hii_resource_section' : [MDefs['UEFI_HII_RESOURCE_SECTION']] if 'UEFI_HII_RESOURCE_SECTION' in MDefs else [],
'module_uni_file' : [MDefs['MODULE_UNI_FILE']] if 'MODULE_UNI_FILE' in MDefs else [], 'module_uni_file' : [MDefs['MODULE_UNI_FILE']] if 'MODULE_UNI_FILE' in MDefs else [],
'module_arch' : self.Arch, 'module_arch' : self.Arch,
'package_item' : ['%s' % (Package.MetaFile.File.replace('\\', '/')) for Package in Packages], 'package_item' : [Package.MetaFile.File.replace('\\', '/') for Package in Packages],
'binary_item' : [], 'binary_item' : [],
'patchablepcd_item' : [], 'patchablepcd_item' : [],
'pcd_item' : [], 'pcd_item' : [],
@@ -3902,12 +3878,12 @@ class ModuleAutoGen(AutoGen):
AsBuiltInfDict['module_inf_version'] = gInfSpecVersion AsBuiltInfDict['module_inf_version'] = gInfSpecVersion
if DriverType: if DriverType:
AsBuiltInfDict['pcd_is_driver_string'] += [DriverType] AsBuiltInfDict['pcd_is_driver_string'].append(DriverType)
if 'UEFI_SPECIFICATION_VERSION' in self.Specification: if 'UEFI_SPECIFICATION_VERSION' in self.Specification:
AsBuiltInfDict['module_uefi_specification_version'] += [self.Specification['UEFI_SPECIFICATION_VERSION']] AsBuiltInfDict['module_uefi_specification_version'].append(self.Specification['UEFI_SPECIFICATION_VERSION'])
if 'PI_SPECIFICATION_VERSION' in self.Specification: if 'PI_SPECIFICATION_VERSION' in self.Specification:
AsBuiltInfDict['module_pi_specification_version'] += [self.Specification['PI_SPECIFICATION_VERSION']] AsBuiltInfDict['module_pi_specification_version'].append(self.Specification['PI_SPECIFICATION_VERSION'])
OutputDir = self.OutputDir.replace('\\', '/').strip('/') OutputDir = self.OutputDir.replace('\\', '/').strip('/')
DebugDir = self.DebugDir.replace('\\', '/').strip('/') DebugDir = self.DebugDir.replace('\\', '/').strip('/')
@@ -3917,31 +3893,31 @@ class ModuleAutoGen(AutoGen):
if os.path.isabs(File): if os.path.isabs(File):
File = File.replace('\\', '/').strip('/').replace(OutputDir, '').strip('/') File = File.replace('\\', '/').strip('/').replace(OutputDir, '').strip('/')
if Item.Target.Ext.lower() == '.aml': if Item.Target.Ext.lower() == '.aml':
AsBuiltInfDict['binary_item'] += ['ASL|' + File] AsBuiltInfDict['binary_item'].append('ASL|' + File)
elif Item.Target.Ext.lower() == '.acpi': elif Item.Target.Ext.lower() == '.acpi':
AsBuiltInfDict['binary_item'] += ['ACPI|' + File] AsBuiltInfDict['binary_item'].append('ACPI|' + File)
elif Item.Target.Ext.lower() == '.efi': elif Item.Target.Ext.lower() == '.efi':
AsBuiltInfDict['binary_item'] += ['PE32|' + self.Name + '.efi'] AsBuiltInfDict['binary_item'].append('PE32|' + self.Name + '.efi')
else: else:
AsBuiltInfDict['binary_item'] += ['BIN|' + File] AsBuiltInfDict['binary_item'].append('BIN|' + File)
if self.DepexGenerated: if self.DepexGenerated:
self.OutputFile.add(self.Name + '.depex') self.OutputFile.add(self.Name + '.depex')
if self.ModuleType in [SUP_MODULE_PEIM]: if self.ModuleType in [SUP_MODULE_PEIM]:
AsBuiltInfDict['binary_item'] += ['PEI_DEPEX|' + self.Name + '.depex'] AsBuiltInfDict['binary_item'].append('PEI_DEPEX|' + self.Name + '.depex')
if self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]: elif self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]:
AsBuiltInfDict['binary_item'] += ['DXE_DEPEX|' + self.Name + '.depex'] AsBuiltInfDict['binary_item'].append('DXE_DEPEX|' + self.Name + '.depex')
if self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]: elif self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]:
AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + '.depex'] AsBuiltInfDict['binary_item'].append('SMM_DEPEX|' + self.Name + '.depex')
Bin = self._GenOffsetBin() Bin = self._GenOffsetBin()
if Bin: if Bin:
AsBuiltInfDict['binary_item'] += ['BIN|%s' % Bin] AsBuiltInfDict['binary_item'].append('BIN|%s' % Bin)
self.OutputFile.add(Bin) self.OutputFile.add(Bin)
for Root, Dirs, Files in os.walk(OutputDir): for Root, Dirs, Files in os.walk(OutputDir):
for File in Files: for File in Files:
if File.lower().endswith('.pdb'): if File.lower().endswith('.pdb'):
AsBuiltInfDict['binary_item'] += ['DISPOSABLE|' + File] AsBuiltInfDict['binary_item'].append('DISPOSABLE|' + File)
self.OutputFile.add(File) self.OutputFile.add(File)
HeaderComments = self.Module.HeaderComments HeaderComments = self.Module.HeaderComments
StartPos = 0 StartPos = 0
@@ -3960,12 +3936,8 @@ class ModuleAutoGen(AutoGen):
] ]
for Item in GenList: for Item in GenList:
for CName in Item[0]: for CName in Item[0]:
Comments = '' Comments = '\n '.join(Item[1][CName]) if CName in Item[1] else ''
if CName in Item[1]: Entry = Comments + '\n ' + CName if Comments else CName
Comments = '\n '.join(Item[1][CName])
Entry = CName
if Comments:
Entry = Comments + '\n ' + CName
AsBuiltInfDict[Item[2]].append(Entry) AsBuiltInfDict[Item[2]].append(Entry)
PatchList = parsePcdInfoFromMapFile( PatchList = parsePcdInfoFromMapFile(
os.path.join(self.OutputDir, self.Name + '.map'), os.path.join(self.OutputDir, self.Name + '.map'),
@@ -4056,7 +4028,6 @@ class ModuleAutoGen(AutoGen):
HiiPcds = set() HiiPcds = set()
for Pcd in Pcds + VfrPcds: for Pcd in Pcds + VfrPcds:
PcdComments = ''
PcdCommentList = [] PcdCommentList = []
HiiInfo = '' HiiInfo = ''
SkuId = '' SkuId = ''
@@ -4097,14 +4068,14 @@ class ModuleAutoGen(AutoGen):
PcdEntry = Pcd.TokenSpaceGuidCName + '.' + TokenCName PcdEntry = Pcd.TokenSpaceGuidCName + '.' + TokenCName
if PcdComments: if PcdComments:
PcdEntry = PcdComments + '\n ' + PcdEntry PcdEntry = PcdComments + '\n ' + PcdEntry
AsBuiltInfDict['pcd_item'] += [PcdEntry] AsBuiltInfDict['pcd_item'].append(PcdEntry)
for Item in self.BuildOption: for Item in self.BuildOption:
if 'FLAGS' in self.BuildOption[Item]: if 'FLAGS' in self.BuildOption[Item]:
AsBuiltInfDict['flags_item'] += ['%s:%s_%s_%s_%s_FLAGS = %s' % (self.ToolChainFamily, self.BuildTarget, self.ToolChain, self.Arch, Item, self.BuildOption[Item]['FLAGS'].strip())] AsBuiltInfDict['flags_item'].append('%s:%s_%s_%s_%s_FLAGS = %s' % (self.ToolChainFamily, self.BuildTarget, self.ToolChain, self.Arch, Item, self.BuildOption[Item]['FLAGS'].strip()))
# Generated LibraryClasses section in comments. # Generated LibraryClasses section in comments.
for Library in self.LibraryAutoGenList: for Library in self.LibraryAutoGenList:
AsBuiltInfDict['libraryclasses_item'] += [Library.MetaFile.File.replace('\\', '/')] AsBuiltInfDict['libraryclasses_item'].append(Library.MetaFile.File.replace('\\', '/'))
# Generated UserExtensions TianoCore section. # Generated UserExtensions TianoCore section.
# All tianocore user extensions are copied. # All tianocore user extensions are copied.
@@ -4117,10 +4088,8 @@ class ModuleAutoGen(AutoGen):
AsBuiltInfDict['userextension_tianocore_item'] = UserExtStr AsBuiltInfDict['userextension_tianocore_item'] = UserExtStr
# Generated depex expression section in comments. # Generated depex expression section in comments.
AsBuiltInfDict['depexsection_item'] = ''
DepexExpresion = self._GetDepexExpresionString() DepexExpresion = self._GetDepexExpresionString()
if DepexExpresion: AsBuiltInfDict['depexsection_item'] = DepexExpresion if DepexExpresion else ''
AsBuiltInfDict['depexsection_item'] = DepexExpresion
AsBuiltInf = TemplateString() AsBuiltInf = TemplateString()
AsBuiltInf.Append(gAsBuiltInfHeaderString.Replace(AsBuiltInfDict)) AsBuiltInf.Append(gAsBuiltInfHeaderString.Replace(AsBuiltInfDict))
@@ -4339,8 +4308,7 @@ class ModuleAutoGen(AutoGen):
if self.Name not in GlobalData.gModuleHash[self.Arch]: if self.Name not in GlobalData.gModuleHash[self.Arch]:
GlobalData.gModuleHash[self.Arch][self.Name] = m.hexdigest() GlobalData.gModuleHash[self.Arch][self.Name] = m.hexdigest()
if GlobalData.gBinCacheSource: if GlobalData.gBinCacheSource:
CacheValid = self.AttemptModuleCacheCopy() if self.AttemptModuleCacheCopy():
if CacheValid:
return False return False
return SaveFileOnChange(ModuleHashFile, m.hexdigest(), True) return SaveFileOnChange(ModuleHashFile, m.hexdigest(), True)
@@ -4379,9 +4347,7 @@ class ModuleAutoGen(AutoGen):
return self._TimeStampPath return self._TimeStampPath
def CreateTimeStamp(self, Makefile): def CreateTimeStamp(self, Makefile):
FileSet = set() FileSet = {self.MetaFile.Path}
FileSet.add (self.MetaFile.Path)
for SourceFile in self.Module.Sources: for SourceFile in self.Module.Sources:
FileSet.add (SourceFile.Path) FileSet.add (SourceFile.Path)
@@ -4445,7 +4411,7 @@ class ModuleAutoGen(AutoGen):
PpiList = property(_GetPpiList) PpiList = property(_GetPpiList)
DepexList = property(_GetDepexTokenList) DepexList = property(_GetDepexTokenList)
DxsFile = property(_GetDxsFile) DxsFile = property(_GetDxsFile)
DepexExpressionList = property(_GetDepexExpressionTokenList) DepexExpressionDict = property(_GetDepexExpressionTokenList)
BuildOption = property(_GetModuleBuildOption) BuildOption = property(_GetModuleBuildOption)
BuildOptionIncPathList = property(_GetBuildOptionIncPathList) BuildOptionIncPathList = property(_GetBuildOptionIncPathList)
BuildCommand = property(_GetBuildCommand) BuildCommand = property(_GetBuildCommand)

View File

@@ -1655,7 +1655,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
TokenSpaceList = [] TokenSpaceList = []
for Pcd in Info.ModulePcdList: for Pcd in Info.ModulePcdList:
if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenSpaceGuidCName not in TokenSpaceList: if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenSpaceGuidCName not in TokenSpaceList:
TokenSpaceList += [Pcd.TokenSpaceGuidCName] TokenSpaceList.append(Pcd.TokenSpaceGuidCName)
SkuMgr = Info.Workspace.Platform.SkuIdMgr SkuMgr = Info.Workspace.Platform.SkuIdMgr
AutoGenH.Append("\n// Definition of SkuId Array\n") AutoGenH.Append("\n// Definition of SkuId Array\n")

View File

@@ -698,7 +698,7 @@ cleanlib:
Src = self.ReplaceMacro(Src) Src = self.ReplaceMacro(Src)
Dst = self.ReplaceMacro(Dst) Dst = self.ReplaceMacro(Dst)
if Dst not in self.ResultFileList: if Dst not in self.ResultFileList:
self.ResultFileList.append('%s' % Dst) self.ResultFileList.append(Dst)
if '%s :' %(Dst) not in self.BuildTargetList: if '%s :' %(Dst) not in self.BuildTargetList:
self.BuildTargetList.append("%s :" %(Dst)) self.BuildTargetList.append("%s :" %(Dst))
self.BuildTargetList.append('\t' + self._CP_TEMPLATE_[self._FileType] %{'Src': Src, 'Dst': Dst}) self.BuildTargetList.append('\t' + self._CP_TEMPLATE_[self._FileType] %{'Src': Src, 'Dst': Dst})
@@ -716,7 +716,7 @@ cleanlib:
if DepsFileString == '': if DepsFileString == '':
continue continue
OutputFile = self.ReplaceMacro(OutputFile) OutputFile = self.ReplaceMacro(OutputFile)
self.ResultFileList.append('%s' % OutputFile) self.ResultFileList.append(OutputFile)
DepsFileString = self.ReplaceMacro(DepsFileString) DepsFileString = self.ReplaceMacro(DepsFileString)
self.BuildTargetList.append('%s : %s' % (OutputFile, DepsFileString)) self.BuildTargetList.append('%s : %s' % (OutputFile, DepsFileString))
CmdString = ' '.join(FfsCmdList).strip() CmdString = ' '.join(FfsCmdList).strip()

View File

@@ -1115,7 +1115,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
TokenSpaceGuid = GuidStructureStringToGuidValueName(TokenSpaceGuidStructure) TokenSpaceGuid = GuidStructureStringToGuidValueName(TokenSpaceGuidStructure)
if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET:
if TokenSpaceGuid not in GuidList: if TokenSpaceGuid not in GuidList:
GuidList += [TokenSpaceGuid] GuidList.append(TokenSpaceGuid)
Dict['GUID_STRUCTURE'].append(TokenSpaceGuidStructure) Dict['GUID_STRUCTURE'].append(TokenSpaceGuidStructure)
NumberOfExTokens += 1 NumberOfExTokens += 1
@@ -1140,7 +1140,6 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
Pcd.TokenTypeList = ['PCD_DATUM_TYPE_' + Pcd.DatumType] Pcd.TokenTypeList = ['PCD_DATUM_TYPE_' + Pcd.DatumType]
if len(Pcd.SkuInfoList) > 1: if len(Pcd.SkuInfoList) > 1:
# Pcd.TokenTypeList += ['PCD_TYPE_SKU_ENABLED']
NumberOfSkuEnabledPcd += 1 NumberOfSkuEnabledPcd += 1
SkuIdIndex = 1 SkuIdIndex = 1
@@ -1178,7 +1177,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
else: else:
EdkLogger.error("build", PCD_VALIDATION_INFO_ERROR, EdkLogger.error("build", PCD_VALIDATION_INFO_ERROR,
"The PCD '%s.%s' Validation information defined in DEC file has incorrect format." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) "The PCD '%s.%s' Validation information defined in DEC file has incorrect format." % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName))
Pcd.TokenTypeList += ['PCD_TYPE_HII'] Pcd.TokenTypeList.append('PCD_TYPE_HII')
Pcd.InitString = 'INIT' Pcd.InitString = 'INIT'
# Store all variable names of one HII PCD under different SKU to stringTable # Store all variable names of one HII PCD under different SKU to stringTable
# and calculate the VariableHeadStringIndex # and calculate the VariableHeadStringIndex
@@ -1209,7 +1208,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
# store VariableGuid to GuidTable and get the VariableHeadGuidIndex # store VariableGuid to GuidTable and get the VariableHeadGuidIndex
if VariableGuid not in GuidList: if VariableGuid not in GuidList:
GuidList += [VariableGuid] GuidList.append(VariableGuid)
Dict['GUID_STRUCTURE'].append(VariableGuidStructure) Dict['GUID_STRUCTURE'].append(VariableGuidStructure)
VariableHeadGuidIndex = GuidList.index(VariableGuid) VariableHeadGuidIndex = GuidList.index(VariableGuid)
@@ -1261,7 +1260,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
VariableDbValueList.append([VariableHeadGuidIndex, VariableHeadStringIndex, Sku.VariableOffset, VariableOffset, VariableRefTable, Sku.VariableAttribute]) VariableDbValueList.append([VariableHeadGuidIndex, VariableHeadStringIndex, Sku.VariableOffset, VariableOffset, VariableRefTable, Sku.VariableAttribute])
elif Sku.VpdOffset != '': elif Sku.VpdOffset != '':
Pcd.TokenTypeList += ['PCD_TYPE_VPD'] Pcd.TokenTypeList.append('PCD_TYPE_VPD')
Pcd.InitString = 'INIT' Pcd.InitString = 'INIT'
VpdHeadOffsetList.append(str(Sku.VpdOffset) + 'U') VpdHeadOffsetList.append(str(Sku.VpdOffset) + 'U')
VpdDbOffsetList.append(Sku.VpdOffset) VpdDbOffsetList.append(Sku.VpdOffset)
@@ -1273,7 +1272,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
continue continue
if Pcd.DatumType == TAB_VOID: if Pcd.DatumType == TAB_VOID:
Pcd.TokenTypeList += ['PCD_TYPE_STRING'] Pcd.TokenTypeList.append('PCD_TYPE_STRING')
Pcd.InitString = 'INIT' Pcd.InitString = 'INIT'
if Sku.HiiDefaultValue != '' and Sku.DefaultValue == '': if Sku.HiiDefaultValue != '' and Sku.DefaultValue == '':
Sku.DefaultValue = Sku.HiiDefaultValue Sku.DefaultValue = Sku.HiiDefaultValue
@@ -1322,7 +1321,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
StringTableSize += (StringTabLen) StringTableSize += (StringTabLen)
else: else:
if "PCD_TYPE_HII" not in Pcd.TokenTypeList: if "PCD_TYPE_HII" not in Pcd.TokenTypeList:
Pcd.TokenTypeList += ['PCD_TYPE_DATA'] Pcd.TokenTypeList.append('PCD_TYPE_DATA')
if Sku.DefaultValue == 'TRUE': if Sku.DefaultValue == 'TRUE':
Pcd.InitString = 'INIT' Pcd.InitString = 'INIT'
else: else:

View File

@@ -75,7 +75,7 @@ class VariableMgr(object):
data = value_list[0] data = value_list[0]
value_list = [] value_list = []
for data_byte in pack(data_flag,int(data,16) if data.upper().startswith('0X') else int(data)): for data_byte in pack(data_flag,int(data,16) if data.upper().startswith('0X') else int(data)):
value_list += [hex(unpack("B",data_byte)[0])] value_list.append(hex(unpack("B",data_byte)[0]))
newvalue[int(item.var_offset,16) if item.var_offset.upper().startswith("0X") else int(item.var_offset)] = value_list newvalue[int(item.var_offset,16) if item.var_offset.upper().startswith("0X") else int(item.var_offset)] = value_list
try: try:
newvaluestr = "{" + ",".join(VariableMgr.assemble_variable(newvalue)) +"}" newvaluestr = "{" + ",".join(VariableMgr.assemble_variable(newvalue)) +"}"

View File

@@ -258,7 +258,7 @@ def GetFilteredLanguage(UniLanguageList, LanguageFilterList):
# first check for exact match # first check for exact match
if Language in UniLanguageList: if Language in UniLanguageList:
if Language not in UniLanguageListFiltered: if Language not in UniLanguageListFiltered:
UniLanguageListFiltered += [Language] UniLanguageListFiltered.append(Language)
# find the first one with the same/equivalent primary tag # find the first one with the same/equivalent primary tag
else: else:
if Language.find('-') != -1: if Language.find('-') != -1:
@@ -280,7 +280,7 @@ def GetFilteredLanguage(UniLanguageList, LanguageFilterList):
if PrimaryTag == UniLanguagePrimaryTag: if PrimaryTag == UniLanguagePrimaryTag:
if UniLanguage not in UniLanguageListFiltered: if UniLanguage not in UniLanguageListFiltered:
UniLanguageListFiltered += [UniLanguage] UniLanguageListFiltered.append(UniLanguage)
break break
else: else:
# Here is rule 3 for "get best language" # Here is rule 3 for "get best language"
@@ -292,10 +292,10 @@ def GetFilteredLanguage(UniLanguageList, LanguageFilterList):
for UniLanguage in UniLanguageList: for UniLanguage in UniLanguageList:
if UniLanguage.startswith('en-') or UniLanguage.startswith('eng-'): if UniLanguage.startswith('en-') or UniLanguage.startswith('eng-'):
if UniLanguage not in UniLanguageListFiltered: if UniLanguage not in UniLanguageListFiltered:
UniLanguageListFiltered += [UniLanguage] UniLanguageListFiltered.append(UniLanguage)
break break
else: else:
UniLanguageListFiltered += [DefaultTag] UniLanguageListFiltered.append(DefaultTag)
return UniLanguageListFiltered return UniLanguageListFiltered

View File

@@ -1328,7 +1328,7 @@ def ParseFieldValue (Value):
try: try:
Value = "'" + uuid.UUID(Value).get_bytes_le() + "'" Value = "'" + uuid.UUID(Value).get_bytes_le() + "'"
except ValueError, Message: except ValueError, Message:
raise BadExpression('%s' % Message) raise BadExpression(Message)
Value, Size = ParseFieldValue(Value) Value, Size = ParseFieldValue(Value)
return Value, 16 return Value, 16
if Value.startswith('L"') and Value.endswith('"'): if Value.startswith('L"') and Value.endswith('"'):

View File

@@ -447,7 +447,7 @@ def GetMultipleValuesOfKeyFromLines(Lines, Key, KeyValues, CommentCharacter):
for Line in LineList: for Line in LineList:
Line = CleanString(Line, CommentCharacter) Line = CleanString(Line, CommentCharacter)
if Line != '' and Line[0] != CommentCharacter: if Line != '' and Line[0] != CommentCharacter:
KeyValues += [Line] KeyValues.append(Line)
return True return True

View File

@@ -246,7 +246,7 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName):
stderr= subprocess.PIPE, stderr= subprocess.PIPE,
shell=True) shell=True)
except Exception, X: except Exception, X:
EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData="%s" % (str(X))) EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData=str(X))
(out, error) = PopenObject.communicate() (out, error) = PopenObject.communicate()
print out print out
while PopenObject.returncode is None : while PopenObject.returncode is None :

View File

@@ -2328,7 +2328,7 @@ class FdfParser:
if not self.__GetNextHexNumber() and not self.__GetNextDecimalNumber(): if not self.__GetNextHexNumber() and not self.__GetNextDecimalNumber():
raise Warning("expected Hex FV extension entry type value At Line ", self.FileName, self.CurrentLineNumber) raise Warning("expected Hex FV extension entry type value At Line ", self.FileName, self.CurrentLineNumber)
FvObj.FvExtEntryTypeValue += [self.__Token] FvObj.FvExtEntryTypeValue.append(self.__Token)
if not self.__IsToken( "{"): if not self.__IsToken( "{"):
raise Warning("expected '{'", self.FileName, self.CurrentLineNumber) raise Warning("expected '{'", self.FileName, self.CurrentLineNumber)
@@ -2336,7 +2336,7 @@ class FdfParser:
if not self.__IsKeyword ("FILE") and not self.__IsKeyword ("DATA"): if not self.__IsKeyword ("FILE") and not self.__IsKeyword ("DATA"):
raise Warning("expected 'FILE' or 'DATA'", self.FileName, self.CurrentLineNumber) raise Warning("expected 'FILE' or 'DATA'", self.FileName, self.CurrentLineNumber)
FvObj.FvExtEntryType += [self.__Token] FvObj.FvExtEntryType.append(self.__Token)
if self.__Token == 'DATA': if self.__Token == 'DATA':
@@ -2370,7 +2370,7 @@ class FdfParser:
raise Warning("expected '}'", self.FileName, self.CurrentLineNumber) raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)
DataString = DataString.rstrip(",") DataString = DataString.rstrip(",")
FvObj.FvExtEntryData += [DataString] FvObj.FvExtEntryData.append(DataString)
if self.__Token == 'FILE': if self.__Token == 'FILE':
@@ -2380,7 +2380,7 @@ class FdfParser:
if not self.__GetNextToken(): if not self.__GetNextToken():
raise Warning("expected FV Extension Entry file path At Line ", self.FileName, self.CurrentLineNumber) raise Warning("expected FV Extension Entry file path At Line ", self.FileName, self.CurrentLineNumber)
FvObj.FvExtEntryData += [self.__Token] FvObj.FvExtEntryData.append(self.__Token)
if not self.__IsToken( "}"): if not self.__IsToken( "}"):
raise Warning("expected '}'", self.FileName, self.CurrentLineNumber) raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)

View File

@@ -439,36 +439,33 @@ class GenFdsGlobalVariable:
@staticmethod @staticmethod
def GenerateSection(Output, Input, Type=None, CompressionType=None, Guid=None, def GenerateSection(Output, Input, Type=None, CompressionType=None, Guid=None,
GuidHdrLen=None, GuidAttr=[], Ui=None, Ver=None, InputAlign=None, BuildNumber=None, DummyFile=None, IsMakefile=False): GuidHdrLen=None, GuidAttr=[], Ui=None, Ver=None, InputAlign=[], BuildNumber=None, DummyFile=None, IsMakefile=False):
Cmd = ["GenSec"] Cmd = ["GenSec"]
if Type: if Type:
Cmd += ["-s", Type] Cmd += ("-s", Type)
if CompressionType: if CompressionType:
Cmd += ["-c", CompressionType] Cmd += ("-c", CompressionType)
if Guid is not None: if Guid is not None:
Cmd += ["-g", Guid] Cmd += ("-g", Guid)
if DummyFile is not None: if DummyFile is not None:
Cmd += ["--dummy", DummyFile] Cmd += ("--dummy", DummyFile)
if GuidHdrLen: if GuidHdrLen:
Cmd += ["-l", GuidHdrLen] Cmd += ("-l", GuidHdrLen)
if len(GuidAttr) != 0: #Add each guided attribute
#Add each guided attribute for Attr in GuidAttr:
for Attr in GuidAttr: Cmd += ("-r", Attr)
Cmd += ["-r", Attr] #Section Align is only for dummy section without section type
if InputAlign is not None: for SecAlign in InputAlign:
#Section Align is only for dummy section without section type Cmd += ("--sectionalign", SecAlign)
for SecAlign in InputAlign:
Cmd += ["--sectionalign", SecAlign]
CommandFile = Output + '.txt' CommandFile = Output + '.txt'
if Ui: if Ui:
#Cmd += ["-n", '"' + Ui + '"']
if IsMakefile: if IsMakefile:
if Ui == "$(MODULE_NAME)": if Ui == "$(MODULE_NAME)":
Cmd += ['-n', Ui] Cmd += ('-n', Ui)
else: else:
Cmd += ["-n", '"' + Ui + '"'] Cmd += ("-n", '"' + Ui + '"')
Cmd += ["-o", Output] Cmd += ("-o", Output)
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList: if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip()) GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())
else: else:
@@ -481,10 +478,10 @@ class GenFdsGlobalVariable:
SaveFileOnChange(Output, SectionData.tostring()) SaveFileOnChange(Output, SectionData.tostring())
elif Ver: elif Ver:
Cmd += ["-n", Ver] Cmd += ("-n", Ver)
if BuildNumber: if BuildNumber:
Cmd += ["-j", BuildNumber] Cmd += ("-j", BuildNumber)
Cmd += ["-o", Output] Cmd += ("-o", Output)
SaveFileOnChange(CommandFile, ' '.join(Cmd), False) SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
if IsMakefile: if IsMakefile:
@@ -495,7 +492,7 @@ class GenFdsGlobalVariable:
return return
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section") GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
else: else:
Cmd += ["-o", Output] Cmd += ("-o", Output)
Cmd += Input Cmd += Input
SaveFileOnChange(CommandFile, ' '.join(Cmd), False) SaveFileOnChange(CommandFile, ' '.join(Cmd), False)
@@ -526,9 +523,9 @@ class GenFdsGlobalVariable:
Cmd = ["GenFfs", "-t", Type, "-g", Guid] Cmd = ["GenFfs", "-t", Type, "-g", Guid]
mFfsValidAlign = ["0", "8", "16", "128", "512", "1K", "4K", "32K", "64K", "128K", "256K", "512K", "1M", "2M", "4M", "8M", "16M"] mFfsValidAlign = ["0", "8", "16", "128", "512", "1K", "4K", "32K", "64K", "128K", "256K", "512K", "1M", "2M", "4M", "8M", "16M"]
if Fixed == True: if Fixed == True:
Cmd += ["-x"] Cmd.append("-x")
if CheckSum: if CheckSum:
Cmd += ["-s"] Cmd.append("-s")
if Align: if Align:
if Align not in mFfsValidAlign: if Align not in mFfsValidAlign:
Align = GenFdsGlobalVariable.GetAlignment (Align) Align = GenFdsGlobalVariable.GetAlignment (Align)
@@ -536,9 +533,9 @@ class GenFdsGlobalVariable:
if ((Align > GenFdsGlobalVariable.GetAlignment(mFfsValidAlign[index])) and (Align <= GenFdsGlobalVariable.GetAlignment(mFfsValidAlign[index + 1]))): if ((Align > GenFdsGlobalVariable.GetAlignment(mFfsValidAlign[index])) and (Align <= GenFdsGlobalVariable.GetAlignment(mFfsValidAlign[index + 1]))):
break break
Align = mFfsValidAlign[index + 1] Align = mFfsValidAlign[index + 1]
Cmd += ["-a", Align] Cmd += ("-a", Align)
Cmd += ["-o", Output] Cmd += ("-o", Output)
for I in range(0, len(Input)): for I in range(0, len(Input)):
Cmd += ("-i", Input[I]) Cmd += ("-i", Input[I])
if SectionAlign and SectionAlign[I]: if SectionAlign and SectionAlign[I]:
@@ -567,26 +564,26 @@ class GenFdsGlobalVariable:
Cmd = ["GenFv"] Cmd = ["GenFv"]
if BaseAddress: if BaseAddress:
Cmd += ["-r", BaseAddress] Cmd += ("-r", BaseAddress)
if ForceRebase == False: if ForceRebase == False:
Cmd += ["-F", "FALSE"] Cmd += ("-F", "FALSE")
elif ForceRebase == True: elif ForceRebase == True:
Cmd += ["-F", "TRUE"] Cmd += ("-F", "TRUE")
if Capsule: if Capsule:
Cmd += ["-c"] Cmd.append("-c")
if Dump: if Dump:
Cmd += ["-p"] Cmd.append("-p")
if AddressFile: if AddressFile:
Cmd += ["-a", AddressFile] Cmd += ("-a", AddressFile)
if MapFile: if MapFile:
Cmd += ["-m", MapFile] Cmd += ("-m", MapFile)
if FileSystemGuid: if FileSystemGuid:
Cmd += ["-g", FileSystemGuid] Cmd += ("-g", FileSystemGuid)
Cmd += ["-o", Output] Cmd += ("-o", Output)
for I in Input: for I in Input:
Cmd += ["-i", I] Cmd += ("-i", I)
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FV") GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FV")
@@ -600,10 +597,10 @@ class GenFdsGlobalVariable:
if BaseAddress and FvSize \ if BaseAddress and FvSize \
and len(BaseAddress) == len(FvSize): and len(BaseAddress) == len(FvSize):
for I in range(0, len(BaseAddress)): for I in range(0, len(BaseAddress)):
Cmd += ["-r", BaseAddress[I], "-s", FvSize[I]] Cmd += ("-r", BaseAddress[I], "-s", FvSize[I])
Cmd += ["-o", Output] Cmd += ("-o", Output)
for F in Input: for F in Input:
Cmd += ["-f", F] Cmd += ("-f", F)
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate VTF") GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate VTF")
@@ -617,26 +614,26 @@ class GenFdsGlobalVariable:
Cmd = ["GenFw"] Cmd = ["GenFw"]
if Type.lower() == "te": if Type.lower() == "te":
Cmd += ["-t"] Cmd.append("-t")
if SubType: if SubType:
Cmd += ["-e", SubType] Cmd += ("-e", SubType)
if TimeStamp: if TimeStamp:
Cmd += ["-s", TimeStamp] Cmd += ("-s", TimeStamp)
if Align: if Align:
Cmd += ["-a", Align] Cmd += ("-a", Align)
if Padding: if Padding:
Cmd += ["-p", Padding] Cmd += ("-p", Padding)
if Zero: if Zero:
Cmd += ["-z"] Cmd.append("-z")
if Strip: if Strip:
Cmd += ["-l"] Cmd.append("-l")
if Replace: if Replace:
Cmd += ["-r"] Cmd.append("-r")
if Join: if Join:
Cmd += ["-j"] Cmd.append("-j")
if Convert: if Convert:
Cmd += ["-m"] Cmd.append("-m")
Cmd += ["-o", Output] Cmd += ("-o", Output)
Cmd += Input Cmd += Input
if IsMakefile: if IsMakefile:
if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList: if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
@@ -652,18 +649,18 @@ class GenFdsGlobalVariable:
if len(EfiInput) > 0: if len(EfiInput) > 0:
if Compress: if Compress:
Cmd += ["-ec"] Cmd.append("-ec")
else: else:
Cmd += ["-e"] Cmd.append("-e")
for EfiFile in EfiInput: for EfiFile in EfiInput:
Cmd += [EfiFile] Cmd.append(EfiFile)
InputList.append (EfiFile) InputList.append (EfiFile)
if len(BinaryInput) > 0: if len(BinaryInput) > 0:
Cmd += ["-b"] Cmd.append("-b")
for BinFile in BinaryInput: for BinFile in BinaryInput:
Cmd += [BinFile] Cmd.append(BinFile)
InputList.append (BinFile) InputList.append (BinFile)
# Check List # Check List
@@ -672,15 +669,15 @@ class GenFdsGlobalVariable:
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList)) GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))
if ClassCode is not None: if ClassCode is not None:
Cmd += ["-l", ClassCode] Cmd += ("-l", ClassCode)
if Revision is not None: if Revision is not None:
Cmd += ["-r", Revision] Cmd += ("-r", Revision)
if DeviceId is not None: if DeviceId is not None:
Cmd += ["-i", DeviceId] Cmd += ("-i", DeviceId)
if VendorId is not None: if VendorId is not None:
Cmd += ["-f", VendorId] Cmd += ("-f", VendorId)
Cmd += ["-o", Output] Cmd += ("-o", Output)
if IsMakefile: if IsMakefile:
if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList: if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:
GenFdsGlobalVariable.SecCmdList.append(" ".join(Cmd).strip()) GenFdsGlobalVariable.SecCmdList.append(" ".join(Cmd).strip())
@@ -695,7 +692,7 @@ class GenFdsGlobalVariable:
Cmd = [ToolPath, ] Cmd = [ToolPath, ]
Cmd += Options.split(' ') Cmd += Options.split(' ')
Cmd += ["-o", Output] Cmd += ("-o", Output)
Cmd += Input Cmd += Input
if IsMakefile: if IsMakefile:
if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList: if " ".join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:

View File

@@ -420,7 +420,7 @@ class DepexReport(object):
self.Source = "DXS" self.Source = "DXS"
break break
else: else:
self.Depex = M.DepexExpressionList.get(M.ModuleType, "") self.Depex = M.DepexExpressionDict.get(M.ModuleType, "")
self.ModuleDepex = " ".join(M.Module.DepexExpression[M.Arch, M.ModuleType]) self.ModuleDepex = " ".join(M.Module.DepexExpression[M.Arch, M.ModuleType])
if not self.ModuleDepex: if not self.ModuleDepex:
self.ModuleDepex = "(None)" self.ModuleDepex = "(None)"
@@ -461,12 +461,12 @@ class DepexReport(object):
FileWrite(File, "Dependency Expression (DEPEX) from %s" % self.Source) FileWrite(File, "Dependency Expression (DEPEX) from %s" % self.Source)
if self.Source == "INF": if self.Source == "INF":
FileWrite(File, "%s" % self.Depex, True) FileWrite(File, self.Depex, True)
FileWrite(File, gSubSectionSep) FileWrite(File, gSubSectionSep)
FileWrite(File, "From Module INF: %s" % self.ModuleDepex, True) FileWrite(File, "From Module INF: %s" % self.ModuleDepex, True)
FileWrite(File, "From Library INF: %s" % self.LibraryDepex, True) FileWrite(File, "From Library INF: %s" % self.LibraryDepex, True)
else: else:
FileWrite(File, "%s" % self.Depex) FileWrite(File, self.Depex)
FileWrite(File, gSubSectionEnd) FileWrite(File, gSubSectionEnd)
## ##
@@ -1112,7 +1112,7 @@ class PcdReport(object):
if IsByteArray: if IsByteArray:
FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, '{')) FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, '{'))
for Array in ArrayList: for Array in ArrayList:
FileWrite(File, '%s' % (Array)) FileWrite(File, Array)
else: else:
FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, ModuleDefault.strip())) FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, ModuleDefault.strip()))
@@ -1138,7 +1138,7 @@ class PcdReport(object):
if IsByteArray: if IsByteArray:
FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', "{")) FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', "{"))
for Array in ArrayList: for Array in ArrayList:
FileWrite(File, '%s' % (Array)) FileWrite(File, Array)
else: else:
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
if Value.startswith(('0x', '0X')): if Value.startswith(('0x', '0X')):
@@ -1152,7 +1152,7 @@ class PcdReport(object):
if IsByteArray: if IsByteArray:
FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', "{")) FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', "{"))
for Array in ArrayList: for Array in ArrayList:
FileWrite(File, '%s' % (Array)) FileWrite(File, Array)
else: else:
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
if Value.startswith(('0x', '0X')): if Value.startswith(('0x', '0X')):
@@ -1167,7 +1167,7 @@ class PcdReport(object):
if IsByteArray: if IsByteArray:
FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', "{")) FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', "{"))
for Array in ArrayList: for Array in ArrayList:
FileWrite(File, '%s' % (Array)) FileWrite(File, Array)
else: else:
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
if Value.startswith(('0x', '0X')): if Value.startswith(('0x', '0X')):
@@ -1187,7 +1187,7 @@ class PcdReport(object):
if IsByteArray: if IsByteArray:
FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '{')) FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '{'))
for Array in ArrayList: for Array in ArrayList:
FileWrite(File, '%s' % (Array)) FileWrite(File, Array)
else: else:
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
if Value.startswith(('0x','0X')): if Value.startswith(('0x','0X')):
@@ -1228,7 +1228,7 @@ class PcdReport(object):
else: else:
FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', '{')) FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', '{'))
for Array in ArrayList: for Array in ArrayList:
FileWrite(File, '%s' % (Array)) FileWrite(File, Array)
else: else:
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
if Value.startswith(('0x', '0X')): if Value.startswith(('0x', '0X')):
@@ -1254,7 +1254,7 @@ class PcdReport(object):
else: else:
FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', '{')) FileWrite(File, ' %-*s : %6s %10s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', '(' + DefaultStore + ')', '{'))
for Array in ArrayList: for Array in ArrayList:
FileWrite(File, '%s' % (Array)) FileWrite(File, Array)
else: else:
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
if Value.startswith(('0x', '0X')): if Value.startswith(('0x', '0X')):
@@ -1286,7 +1286,7 @@ class PcdReport(object):
else: else:
FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', "{")) FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', "{"))
for Array in ArrayList: for Array in ArrayList:
FileWrite(File, '%s' % (Array)) FileWrite(File, Array)
else: else:
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
if Value.startswith(('0x', '0X')): if Value.startswith(('0x', '0X')):
@@ -1304,7 +1304,7 @@ class PcdReport(object):
else: else:
FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', "{")) FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ' , TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', "{"))
for Array in ArrayList: for Array in ArrayList:
FileWrite(File, '%s' % (Array)) FileWrite(File, Array)
else: else:
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
if Value.startswith(('0x', '0X')): if Value.startswith(('0x', '0X')):
@@ -1976,7 +1976,7 @@ class FdReport(object):
ValueList[-1] = ' {' ValueList[-1] = ' {'
FileWrite(File, '|'.join(ValueList)) FileWrite(File, '|'.join(ValueList))
for Array in ArrayList: for Array in ArrayList:
FileWrite(File, '%s' % (Array)) FileWrite(File, Array)
else: else:
FileWrite(File, item) FileWrite(File, item)
FileWrite(File, gSubSectionEnd) FileWrite(File, gSubSectionEnd)

View File

@@ -105,7 +105,7 @@ def CheckEnvVariable():
WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"])) WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"]))
if not os.path.exists(WorkspaceDir): if not os.path.exists(WorkspaceDir):
EdkLogger.error("build", FILE_NOT_FOUND, "WORKSPACE doesn't exist", ExtraData="%s" % WorkspaceDir) EdkLogger.error("build", FILE_NOT_FOUND, "WORKSPACE doesn't exist", ExtraData=WorkspaceDir)
elif ' ' in WorkspaceDir: elif ' ' in WorkspaceDir:
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in WORKSPACE path", EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in WORKSPACE path",
ExtraData=WorkspaceDir) ExtraData=WorkspaceDir)
@@ -117,7 +117,7 @@ def CheckEnvVariable():
if mws.PACKAGES_PATH: if mws.PACKAGES_PATH:
for Path in mws.PACKAGES_PATH: for Path in mws.PACKAGES_PATH:
if not os.path.exists(Path): if not os.path.exists(Path):
EdkLogger.error("build", FILE_NOT_FOUND, "One Path in PACKAGES_PATH doesn't exist", ExtraData="%s" % Path) EdkLogger.error("build", FILE_NOT_FOUND, "One Path in PACKAGES_PATH doesn't exist", ExtraData=Path)
elif ' ' in Path: elif ' ' in Path:
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in PACKAGES_PATH", ExtraData=Path) EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in PACKAGES_PATH", ExtraData=Path)
@@ -1543,7 +1543,7 @@ class Build():
GuidString = MatchGuid.group() GuidString = MatchGuid.group()
if GuidString.upper() in ModuleList: if GuidString.upper() in ModuleList:
Line = Line.replace(GuidString, ModuleList[GuidString.upper()].Name) Line = Line.replace(GuidString, ModuleList[GuidString.upper()].Name)
MapBuffer.write('%s' % (Line)) MapBuffer.write(Line)
# #
# Add the debug image full path. # Add the debug image full path.
# #