BaseTools: create and use a standard shared variable for '*'

add a variable for the string '*' and then use it instead of lots of '*'

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by : Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Jaben Carsey
2018-11-16 23:40:04 +08:00
committed by BobCF
parent ea55e37c36
commit bc39c5cbea
13 changed files with 70 additions and 69 deletions

View File

@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
PcdValue = Sku.DefaultValue PcdValue = Sku.DefaultValue
if PcdValue == "": if PcdValue == "":
PcdValue = Pcd.DefaultValue PcdValue = Pcd.DefaultValue
if Sku.VpdOffset != '*': if Sku.VpdOffset != TAB_STAR:
if PcdValue.startswith("{"): if PcdValue.startswith("{"):
Alignment = 8 Alignment = 8
elif PcdValue.startswith("L"): elif PcdValue.startswith("L"):
@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
VpdFile.Add(Pcd, SkuName, Sku.VpdOffset) VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
SkuValueMap[PcdValue].append(Sku) SkuValueMap[PcdValue].append(Sku)
# if the offset of a VPD is *, then it need to be fixed up by third party tool. # if the offset of a VPD is *, then it need to be fixed up by third party tool.
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*": if not NeedProcessVpdMapFile and Sku.VpdOffset == TAB_STAR:
NeedProcessVpdMapFile = True NeedProcessVpdMapFile = True
if self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == '': if self.Platform.VpdToolGuid is None or self.Platform.VpdToolGuid == '':
EdkLogger.error("Build", FILE_NOT_FOUND, \ EdkLogger.error("Build", FILE_NOT_FOUND, \
@ -1522,7 +1522,7 @@ class PlatformAutoGen(AutoGen):
PcdValue = Sku.DefaultValue PcdValue = Sku.DefaultValue
if PcdValue == "": if PcdValue == "":
PcdValue = DscPcdEntry.DefaultValue PcdValue = DscPcdEntry.DefaultValue
if Sku.VpdOffset != '*': if Sku.VpdOffset != TAB_STAR:
if PcdValue.startswith("{"): if PcdValue.startswith("{"):
Alignment = 8 Alignment = 8
elif PcdValue.startswith("L"): elif PcdValue.startswith("L"):
@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
SkuValueMap[PcdValue] = [] SkuValueMap[PcdValue] = []
VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset) VpdFile.Add(DscPcdEntry, SkuName, Sku.VpdOffset)
SkuValueMap[PcdValue].append(Sku) SkuValueMap[PcdValue].append(Sku)
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*": if not NeedProcessVpdMapFile and Sku.VpdOffset == TAB_STAR:
NeedProcessVpdMapFile = True NeedProcessVpdMapFile = True
if DscPcdEntry.DatumType == TAB_VOID and PcdValue.startswith("L"): if DscPcdEntry.DatumType == TAB_VOID and PcdValue.startswith("L"):
UnicodePcdArray.add(DscPcdEntry) UnicodePcdArray.add(DscPcdEntry)
@ -1573,7 +1573,7 @@ class PlatformAutoGen(AutoGen):
if os.path.exists(VpdMapFilePath): if os.path.exists(VpdMapFilePath):
VpdFile.Read(VpdMapFilePath) VpdFile.Read(VpdMapFilePath)
# Fixup "*" offset # Fixup TAB_STAR offset
for pcd in VpdSkuMap: for pcd in VpdSkuMap:
vpdinfo = VpdFile.GetVpdInfo(pcd) vpdinfo = VpdFile.GetVpdInfo(pcd)
if vpdinfo is None: if vpdinfo is None:
@ -2210,15 +2210,15 @@ class PlatformAutoGen(AutoGen):
def CalculatePriorityValue(self, Key): def CalculatePriorityValue(self, Key):
Target, ToolChain, Arch, CommandType, Attr = Key.split('_') Target, ToolChain, Arch, CommandType, Attr = Key.split('_')
PriorityValue = 0x11111 PriorityValue = 0x11111
if Target == "*": if Target == TAB_STAR:
PriorityValue &= 0x01111 PriorityValue &= 0x01111
if ToolChain == "*": if ToolChain == TAB_STAR:
PriorityValue &= 0x10111 PriorityValue &= 0x10111
if Arch == "*": if Arch == TAB_STAR:
PriorityValue &= 0x11011 PriorityValue &= 0x11011
if CommandType == "*": if CommandType == TAB_STAR:
PriorityValue &= 0x11101 PriorityValue &= 0x11101
if Attr == "*": if Attr == TAB_STAR:
PriorityValue &= 0x11110 PriorityValue &= 0x11110
return self.PrioList["0x%0.5x" % PriorityValue] return self.PrioList["0x%0.5x" % PriorityValue]
@ -2253,9 +2253,9 @@ 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 == "*") and\ if (Target == self.BuildTarget or Target == TAB_STAR) and\
(ToolChain == self.ToolChain or ToolChain == "*") and\ (ToolChain == self.ToolChain or ToolChain == TAB_STAR) and\
(Arch == self.Arch or Arch == "*") and\ (Arch == self.Arch or Arch == TAB_STAR) and\
Options[Key].startswith("="): Options[Key].startswith("="):
if OverrideList.get(Key[1]) is not None: if OverrideList.get(Key[1]) is not None:
@ -2276,11 +2276,11 @@ 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 == "*") and\ if (Target1 == Target2 or Target1 == TAB_STAR or Target2 == TAB_STAR) and\
(ToolChain1 == ToolChain2 or ToolChain1 == "*" or ToolChain2 == "*") and\ (ToolChain1 == ToolChain2 or ToolChain1 == TAB_STAR or ToolChain2 == TAB_STAR) and\
(Arch1 == Arch2 or Arch1 == "*" or Arch2 == "*") and\ (Arch1 == Arch2 or Arch1 == TAB_STAR or Arch2 == TAB_STAR) and\
(CommandType1 == CommandType2 or CommandType1 == "*" or CommandType2 == "*") and\ (CommandType1 == CommandType2 or CommandType1 == TAB_STAR or CommandType2 == TAB_STAR) and\
(Attr1 == Attr2 or Attr1 == "*" or Attr2 == "*"): (Attr1 == Attr2 or Attr1 == TAB_STAR or Attr2 == TAB_STAR):
if self.CalculatePriorityValue(NowKey) > self.CalculatePriorityValue(NextKey): if self.CalculatePriorityValue(NowKey) > self.CalculatePriorityValue(NextKey):
if Options.get((self.BuildRuleFamily, NextKey)) is not None: if Options.get((self.BuildRuleFamily, NextKey)) is not None:
@ -2309,9 +2309,9 @@ class PlatformAutoGen(AutoGen):
continue continue
FamilyMatch = True FamilyMatch = True
# expand any wildcard # expand any wildcard
if Target == "*" or Target == self.BuildTarget: if Target == TAB_STAR or Target == self.BuildTarget:
if Tag == "*" or Tag == self.ToolChain: if Tag == TAB_STAR or Tag == self.ToolChain:
if Arch == "*" or Arch == self.Arch: if Arch == TAB_STAR or Arch == self.Arch:
if Tool not in BuildOptions: if Tool not in BuildOptions:
BuildOptions[Tool] = {} BuildOptions[Tool] = {}
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='): if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
@ -2344,9 +2344,9 @@ class PlatformAutoGen(AutoGen):
continue continue
# expand any wildcard # expand any wildcard
if Target == "*" or Target == self.BuildTarget: if Target == TAB_STAR or Target == self.BuildTarget:
if Tag == "*" or Tag == self.ToolChain: if Tag == TAB_STAR or Tag == self.ToolChain:
if Arch == "*" or Arch == self.Arch: if Arch == TAB_STAR or Arch == self.Arch:
if Tool not in BuildOptions: if Tool not in BuildOptions:
BuildOptions[Tool] = {} BuildOptions[Tool] = {}
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='): if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or Options[Key].startswith('='):
@ -2971,8 +2971,8 @@ class ModuleAutoGen(AutoGen):
@cached_property @cached_property
def SourceFileList(self): def SourceFileList(self):
RetVal = [] RetVal = []
ToolChainTagSet = {"", "*", self.ToolChain} ToolChainTagSet = {"", TAB_STAR, self.ToolChain}
ToolChainFamilySet = {"", "*", self.ToolChainFamily, self.BuildRuleFamily} ToolChainFamilySet = {"", TAB_STAR, self.ToolChainFamily, self.BuildRuleFamily}
for F in self.Module.Sources: for F in self.Module.Sources:
# match tool chain # match tool chain
if F.TagName not in ToolChainTagSet: if F.TagName not in ToolChainTagSet:
@ -3047,7 +3047,7 @@ class ModuleAutoGen(AutoGen):
def BinaryFileList(self): def BinaryFileList(self):
RetVal = [] RetVal = []
for F in self.Module.Binaries: for F in self.Module.Binaries:
if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target != self.BuildTarget: if F.Target not in [TAB_ARCH_COMMON, TAB_STAR] and F.Target != self.BuildTarget:
continue continue
RetVal.append(F) RetVal.append(F)
self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal) self._ApplyBuildRule(F, F.Type, BinaryFileList=RetVal)

View File

@ -110,7 +110,7 @@ class FileBuildRule:
self.IncListFileMacro = self.INC_LIST_MACRO self.IncListFileMacro = self.INC_LIST_MACRO
self.SourceFileType = Type self.SourceFileType = Type
# source files listed not in "*" or "?" pattern format # source files listed not in TAB_STAR or "?" pattern format
if not ExtraDependency: if not ExtraDependency:
self.ExtraSourceFileList = [] self.ExtraSourceFileList = []
else: else:
@ -150,12 +150,12 @@ class FileBuildRule:
self.SourceFileExtList = set() self.SourceFileExtList = set()
for File in Input: for File in Input:
Base, Ext = os.path.splitext(File) Base, Ext = os.path.splitext(File)
if Base.find("*") >= 0: if Base.find(TAB_STAR) >= 0:
# There's "*" in the file name # There's TAB_STAR in the file name
self.IsMultipleInput = True self.IsMultipleInput = True
self.GenFileListMacro = True self.GenFileListMacro = True
elif Base.find("?") < 0: elif Base.find("?") < 0:
# There's no "*" and "?" in file name # There's no TAB_STAR and "?" in file name
self.ExtraSourceFileList.append(File) self.ExtraSourceFileList.append(File)
continue continue
self.SourceFileExtList.add(Ext) self.SourceFileExtList.add(Ext)
@ -553,7 +553,7 @@ class BuildRule:
# #
# @param FileExt The extension of a file # @param FileExt The extension of a file
# @param ToolChainFamily The tool chain family name # @param ToolChainFamily The tool chain family name
# @param BuildVersion The build version number. "*" means any rule # @param BuildVersion The build version number. TAB_STAR means any rule
# is applicalbe. # is applicalbe.
# #
# @retval FileType The file type string # @retval FileType The file type string

View File

@ -21,7 +21,7 @@ import array
import re import re
from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import OpenLongFilePath as open
from struct import * from struct import *
from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE from Common.DataType import MAX_SIZE_TYPE, MAX_VAL_TYPE, TAB_STAR
import Common.EdkLogger as EdkLogger import Common.EdkLogger as EdkLogger
import Common.BuildToolError as BuildToolError import Common.BuildToolError as BuildToolError
@ -87,7 +87,7 @@ class PcdEntry:
# for both hexadecimal and decimal. # for both hexadecimal and decimal.
# #
def _GenOffsetValue(self): def _GenOffsetValue(self):
if self.PcdOffset != "*" : if self.PcdOffset != TAB_STAR:
try: try:
self.PcdBinOffset = int (self.PcdOffset) self.PcdBinOffset = int (self.PcdOffset)
except: except:
@ -423,7 +423,7 @@ class GenVPD :
Alignment = 1 Alignment = 1
PCD.Alignment = Alignment PCD.Alignment = Alignment
if PCD.PcdOffset != '*': if PCD.PcdOffset != TAB_STAR:
if PCD.PcdOccupySize % Alignment != 0: if PCD.PcdOccupySize % Alignment != 0:
if PCD.PcdUnpackValue.startswith("{"): if PCD.PcdUnpackValue.startswith("{"):
EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-byte aligned!" %(PCD.PcdCName), File=self.InputFileName) EdkLogger.warn("BPDG", "The offset value of PCD %s is not 8-byte aligned!" %(PCD.PcdCName), File=self.InputFileName)
@ -469,7 +469,7 @@ class GenVPD :
def FormatFileLine (self) : def FormatFileLine (self) :
for eachPcd in self.FileLinesList : for eachPcd in self.FileLinesList :
if eachPcd.PcdOffset != '*' : if eachPcd.PcdOffset != TAB_STAR :
# Use pcd's Offset value as key, and pcd's Value as value # Use pcd's Offset value as key, and pcd's Value as value
self.PcdFixedOffsetSizeList.append(eachPcd) self.PcdFixedOffsetSizeList.append(eachPcd)
else : else :
@ -484,7 +484,7 @@ class GenVPD :
def FixVpdOffset (self): def FixVpdOffset (self):
# At first, the offset should start at 0 # At first, the offset should start at 0
# Sort fixed offset list in order to find out where has free spaces for the pcd's offset # Sort fixed offset list in order to find out where has free spaces for the pcd's offset
# value is "*" to insert into. # value is TAB_STAR to insert into.
self.PcdFixedOffsetSizeList.sort(key=lambda x: x.PcdBinOffset) self.PcdFixedOffsetSizeList.sort(key=lambda x: x.PcdBinOffset)
@ -502,7 +502,7 @@ class GenVPD :
self.PcdUnknownOffsetList[index+i -1 ], self.PcdUnknownOffsetList[index+i] = self.PcdUnknownOffsetList[index+i], self.PcdUnknownOffsetList[index+i -1] self.PcdUnknownOffsetList[index+i -1 ], self.PcdUnknownOffsetList[index+i] = self.PcdUnknownOffsetList[index+i], self.PcdUnknownOffsetList[index+i -1]
# #
# Process all Offset value are "*" # Process all Offset value are TAB_STAR
# #
if (len(self.PcdFixedOffsetSizeList) == 0) and (len(self.PcdUnknownOffsetList) != 0) : if (len(self.PcdFixedOffsetSizeList) == 0) and (len(self.PcdUnknownOffsetList) != 0) :
# The offset start from 0 # The offset start from 0
@ -571,7 +571,7 @@ class GenVPD :
eachUnfixedPcd = self.PcdUnknownOffsetList[countOfUnfixedList] eachUnfixedPcd = self.PcdUnknownOffsetList[countOfUnfixedList]
needFixPcdSize = eachUnfixedPcd.PcdOccupySize needFixPcdSize = eachUnfixedPcd.PcdOccupySize
# Not been fixed # Not been fixed
if eachUnfixedPcd.PcdOffset == '*' : if eachUnfixedPcd.PcdOffset == TAB_STAR :
if LastOffset % eachUnfixedPcd.Alignment != 0: if LastOffset % eachUnfixedPcd.Alignment != 0:
LastOffset = (LastOffset / eachUnfixedPcd.Alignment + 1) * eachUnfixedPcd.Alignment LastOffset = (LastOffset / eachUnfixedPcd.Alignment + 1) * eachUnfixedPcd.Alignment
# The offset un-fixed pcd can write into this free space # The offset un-fixed pcd can write into this free space

View File

@ -31,6 +31,7 @@ TAB_OPTION_START = '<'
TAB_OPTION_END = '>' TAB_OPTION_END = '>'
TAB_SLASH = '\\' TAB_SLASH = '\\'
TAB_BACK_SLASH = '/' TAB_BACK_SLASH = '/'
TAB_STAR = '*'
TAB_LINE_BREAK = '\n' TAB_LINE_BREAK = '\n'
TAB_PRINTCHAR_VT = '\x0b' TAB_PRINTCHAR_VT = '\x0b'
TAB_PRINTCHAR_BS = '\b' TAB_PRINTCHAR_BS = '\b'

View File

@ -244,7 +244,7 @@ class ValueExpression(BaseExpression):
'IN' : 'in' 'IN' : 'in'
} }
NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':'] NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', '<<', '>>', '!', '=', '>', '<', '?', ':']
SymbolPattern = re.compile("(" SymbolPattern = re.compile("("
@ -498,7 +498,7 @@ class ValueExpression(BaseExpression):
# A [ * B]* # A [ * B]*
def _MulExpr(self): def _MulExpr(self):
return self._ExprFuncTemplate(self._UnaryExpr, {"*", "/", "%"}) return self._ExprFuncTemplate(self._UnaryExpr, {TAB_STAR, "/", "%"})
# [!]*A # [!]*A
def _UnaryExpr(self): def _UnaryExpr(self):

View File

@ -1088,7 +1088,7 @@ class tdict:
_ListType = type([]) _ListType = type([])
_TupleType = type(()) _TupleType = type(())
_Wildcard = 'COMMON' _Wildcard = 'COMMON'
_ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', '*', 'PLATFORM'] _ValidWildcardList = ['COMMON', 'DEFAULT', 'ALL', TAB_STAR, 'PLATFORM']
def __init__(self, _Single_=False, _Level_=2): def __init__(self, _Single_=False, _Level_=2):
self._Level_ = _Level_ self._Level_ = _Level_

View File

@ -29,7 +29,8 @@ from Common import GlobalData
from Common.MultipleWorkspace import MultipleWorkspace as mws from Common.MultipleWorkspace import MultipleWorkspace as mws
from .DataType import TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\ from .DataType import TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG,\
TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE\ TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE\
, TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY , TAB_TOD_DEFINES_FAMILY, TAB_TOD_DEFINES_BUILDRULEFAMILY,\
TAB_STAR, TAB_TAT_DEFINES_TOOL_CHAIN_CONF
## ##
@ -97,7 +98,7 @@ class ToolDefClassObject(object):
# adding/removing items from the original dict. # adding/removing items from the original dict.
for Key in list(self.ToolsDefTxtDictionary.keys()): for Key in list(self.ToolsDefTxtDictionary.keys()):
List = Key.split('_') List = Key.split('_')
if List[Index] == '*': if List[Index] == TAB_STAR:
for String in self.ToolsDefTxtDatabase[KeyList[Index]]: for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
List[Index] = String List[Index] = String
NewKey = '%s_%s_%s_%s_%s' % tuple(List) NewKey = '%s_%s_%s_%s_%s' % tuple(List)
@ -202,20 +203,20 @@ class ToolDefClassObject(object):
if len(List) != 5: if len(List) != 5:
EdkLogger.verbose("Line %d: Not a valid name of definition: %s" % ((Index + 1), Name)) EdkLogger.verbose("Line %d: Not a valid name of definition: %s" % ((Index + 1), Name))
continue continue
elif List[4] == '*': elif List[4] == TAB_STAR:
EdkLogger.verbose("Line %d: '*' is not allowed in last field: %s" % ((Index + 1), Name)) EdkLogger.verbose("Line %d: '*' is not allowed in last field: %s" % ((Index + 1), Name))
continue continue
else: else:
self.ToolsDefTxtDictionary[Name] = Value self.ToolsDefTxtDictionary[Name] = Value
if List[0] != '*': if List[0] != TAB_STAR:
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] += [List[0]] self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] += [List[0]]
if List[1] != '*': if List[1] != TAB_STAR:
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] += [List[1]] self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] += [List[1]]
if List[2] != '*': if List[2] != TAB_STAR:
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] += [List[2]] self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] += [List[2]]
if List[3] != '*': if List[3] != TAB_STAR:
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] += [List[3]] self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] += [List[3]]
if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and List[3] == '*': if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase: if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {} self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value
@ -226,7 +227,7 @@ class ToolDefClassObject(object):
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value
elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] != Value: elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] != Value:
EdkLogger.verbose("Line %d: No override allowed for the family of a tool chain: %s" % ((Index + 1), Name)) EdkLogger.verbose("Line %d: No override allowed for the family of a tool chain: %s" % ((Index + 1), Name))
if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == '*' and List[3] == '*': if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == TAB_STAR and List[3] == TAB_STAR:
if TAB_TOD_DEFINES_BUILDRULEFAMILY not in self.ToolsDefTxtDatabase \ if TAB_TOD_DEFINES_BUILDRULEFAMILY not in self.ToolsDefTxtDatabase \
or List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]: or List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:
EdkLogger.verbose("Line %d: The family is not specified, but BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name)) EdkLogger.verbose("Line %d: The family is not specified, but BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name))
@ -270,8 +271,8 @@ class ToolDefClassObject(object):
def ToolDefDict(ConfDir): def ToolDefDict(ConfDir):
Target = TargetTxtDict(ConfDir) Target = TargetTxtDict(ConfDir)
ToolDef = ToolDefClassObject() ToolDef = ToolDefClassObject()
if DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary: if TAB_TAT_DEFINES_TOOL_CHAIN_CONF in Target.TargetTxtDictionary:
ToolsDefFile = Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF] ToolsDefFile = Target.TargetTxtDictionary[TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
if ToolsDefFile: if ToolsDefFile:
ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile)) ToolDef.LoadToolDefFile(os.path.normpath(ToolsDefFile))
else: else:

View File

@ -57,7 +57,7 @@ FILE_COMMENT_TEMPLATE = \
# <PcdName> ::= <TokenSpaceCName> "." <PcdCName> # <PcdName> ::= <TokenSpaceCName> "." <PcdCName>
# <TokenSpaceCName> ::= C Variable Name of the Token Space GUID # <TokenSpaceCName> ::= C Variable Name of the Token Space GUID
# <PcdCName> ::= C Variable Name of the PCD # <PcdCName> ::= C Variable Name of the PCD
# <Offset> ::= {"*"} {<HexNumber>} # <Offset> ::= {TAB_STAR} {<HexNumber>}
# <HexNumber> ::= "0x" (a-fA-F0-9){1,8} # <HexNumber> ::= "0x" (a-fA-F0-9){1,8}
# <Size> ::= <HexNumber> # <Size> ::= <HexNumber>
# <Value> ::= {<HexNumber>} {<NonNegativeInt>} {<QString>} {<Array>} # <Value> ::= {<HexNumber>} {<NonNegativeInt>} {<QString>} {<Array>}
@ -92,7 +92,7 @@ class VpdInfoFile:
if (Vpd is None): if (Vpd is None):
EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.") EdkLogger.error("VpdInfoFile", BuildToolError.ATTRIBUTE_UNKNOWN_ERROR, "Invalid VPD PCD entry.")
if not (Offset >= 0 or Offset == "*"): if not (Offset >= 0 or Offset == TAB_STAR):
EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." % Offset) EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." % Offset)
if Vpd.DatumType == TAB_VOID: if Vpd.DatumType == TAB_VOID:
@ -186,8 +186,8 @@ class VpdInfoFile:
VpdObjectTokenCName = PcdItem[0] VpdObjectTokenCName = PcdItem[0]
for sku in VpdObject.SkuInfoList: for sku in VpdObject.SkuInfoList:
if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId: if VpdObject.TokenSpaceGuidCName == TokenSpaceName and VpdObjectTokenCName == PcdTokenName.strip() and sku == SkuId:
if self._VpdArray[VpdObject][sku] == "*": if self._VpdArray[VpdObject][sku] == TAB_STAR:
if Offset == "*": if Offset == TAB_STAR:
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName) EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID, "The offset of %s has not been fixed up by third-party BPDG tool." % PcdName)
self._VpdArray[VpdObject][sku] = Offset self._VpdArray[VpdObject][sku] = Offset
Found = True Found = True

View File

@ -64,7 +64,6 @@ T_CHAR_CR = '\r'
T_CHAR_TAB = '\t' T_CHAR_TAB = '\t'
T_CHAR_DOUBLE_QUOTE = '\"' T_CHAR_DOUBLE_QUOTE = '\"'
T_CHAR_SINGLE_QUOTE = '\'' T_CHAR_SINGLE_QUOTE = '\''
T_CHAR_STAR = '*'
T_CHAR_BRACE_R = '}' T_CHAR_BRACE_R = '}'
SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{', T_CHAR_BRACE_R} SEPARATORS = {TAB_EQUAL_SPLIT, TAB_VALUE_SPLIT, TAB_COMMA_SPLIT, '{', T_CHAR_BRACE_R}
@ -533,7 +532,7 @@ class FdfParser:
InComment = False InComment = False
HashComment = False HashComment = False
# check for */ comment end # check for */ comment end
elif InComment and not DoubleSlashComment and not HashComment and self._CurrentChar() == T_CHAR_STAR and self._NextChar() == TAB_BACK_SLASH: elif InComment and not DoubleSlashComment and not HashComment and self._CurrentChar() == TAB_STAR and self._NextChar() == TAB_BACK_SLASH:
self._SetCurrentCharValue(TAB_SPACE_SPLIT) self._SetCurrentCharValue(TAB_SPACE_SPLIT)
self._GetOneChar() self._GetOneChar()
self._SetCurrentCharValue(TAB_SPACE_SPLIT) self._SetCurrentCharValue(TAB_SPACE_SPLIT)
@ -552,7 +551,7 @@ class FdfParser:
InComment = True InComment = True
HashComment = True HashComment = True
# check for /* comment start # check for /* comment start
elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() == T_CHAR_STAR: elif self._CurrentChar() == TAB_BACK_SLASH and self._NextChar() == TAB_STAR:
self._SetCurrentCharValue(TAB_SPACE_SPLIT) self._SetCurrentCharValue(TAB_SPACE_SPLIT)
self._GetOneChar() self._GetOneChar()
self._SetCurrentCharValue(TAB_SPACE_SPLIT) self._SetCurrentCharValue(TAB_SPACE_SPLIT)

View File

@ -653,7 +653,7 @@ class GenFds(object):
FileGuidList.append(FileStatementGuid) FileGuidList.append(FileStatementGuid)
Name = [] Name = []
FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs') FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')
FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + '*') FfsPath = glob(os.path.join(FfsPath, FileStatementGuid) + TAB_STAR)
if not FfsPath: if not FfsPath:
continue continue
if not os.path.exists(FfsPath[0]): if not os.path.exists(FfsPath[0]):

View File

@ -217,12 +217,12 @@ class GenFdsGlobalVariable:
if not Inf.IsBinaryModule: if not Inf.IsBinaryModule:
for File in Inf.Sources: for File in Inf.Sources:
if File.TagName in {"", "*", GenFdsGlobalVariable.ToolChainTag} and \ if File.TagName in {"", DataType.TAB_STAR, GenFdsGlobalVariable.ToolChainTag} and \
File.ToolChainFamily in {"", "*", GenFdsGlobalVariable.ToolChainFamily}: File.ToolChainFamily in {"", DataType.TAB_STAR, GenFdsGlobalVariable.ToolChainFamily}:
FileList.append((File, DataType.TAB_UNKNOWN_FILE)) FileList.append((File, DataType.TAB_UNKNOWN_FILE))
for File in Inf.Binaries: for File in Inf.Binaries:
if File.Target in {DataType.TAB_COMMON, '*', GenFdsGlobalVariable.TargetName}: if File.Target in {DataType.TAB_COMMON, DataType.TAB_STAR, GenFdsGlobalVariable.TargetName}:
FileList.append((File, File.Type)) FileList.append((File, File.Type))
for File, FileType in FileList: for File, FileType in FileList:
@ -893,7 +893,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, NameGuid):
for Index in range(2, -1, -1): for Index in range(2, -1, -1):
for Key in list(BuildOption.keys()): for Key in list(BuildOption.keys()):
List = Key.split('_') List = Key.split('_')
if List[Index] == '*': if List[Index] == DataType.TAB_STAR:
for String in ToolDb[ToolList[Index]]: for String in ToolDb[ToolList[Index]]:
if String in [Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]: if String in [Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]:
List[Index] = String List[Index] = String

View File

@ -131,7 +131,7 @@ class Section (SectionClassObject):
if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \ if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A \
and FileType == 'DXE_DPEX' and File.Type == BINARY_FILE_TYPE_SMM_DEPEX) \ and FileType == 'DXE_DPEX' and File.Type == BINARY_FILE_TYPE_SMM_DEPEX) \
or (FileType == BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32): or (FileType == BINARY_FILE_TYPE_TE and File.Type == BINARY_FILE_TYPE_PE32):
if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []: if TAB_STAR in FfsInf.TargetOverrideList or File.Target == TAB_STAR or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type)) FileList.append(FfsInf.PatchEfiFile(File.Path, File.Type))
else: else:
GenFdsGlobalVariable.InfLogger ("\nBuild Target \'%s\' of File %s is not in the Scope of %s specified by INF %s in FDF" %(File.Target, File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName)) GenFdsGlobalVariable.InfLogger ("\nBuild Target \'%s\' of File %s is not in the Scope of %s specified by INF %s in FDF" %(File.Target, File.File, FfsInf.TargetOverrideList, FfsInf.InfFileName))

View File

@ -2315,11 +2315,11 @@ class DscBuildData(PlatformBuildClassObject):
continue continue
if Attr != "FLAGS": if Attr != "FLAGS":
continue continue
if Target == "*" or Target == self._Target: if Target == TAB_STAR or Target == self._Target:
if Tag == "*" or Tag == self._Toolchain: if Tag == TAB_STAR or Tag == self._Toolchain:
if 'COMMON' not in BuildOptions: if 'COMMON' not in BuildOptions:
BuildOptions['COMMON'] = set() BuildOptions['COMMON'] = set()
if Arch == "*": if Arch == TAB_STAR:
BuildOptions['COMMON'].add(self.BuildOptions[Options]) BuildOptions['COMMON'].add(self.BuildOptions[Options])
if Arch in self.SupArchList: if Arch in self.SupArchList:
if Arch not in BuildOptions: if Arch not in BuildOptions: