import Common.GlobalData as GlobalData\r
from Common.Expression import *\r
from Common import GlobalData\r
+from Common.String import ReplaceMacro\r
+\r
+from Common.Misc import tdict\r
\r
import re\r
import os\r
RegionSizeGuidPattern = re.compile("\s*(?P<base>\w+\.\w+)\s*\|\s*(?P<size>\w+\.\w+)\s*")\r
\r
IncludeFileList = []\r
-# Macro passed from command line, which has greatest priority and can NOT be overridden by those in FDF\r
-InputMacroDict = {}\r
-# All Macro values when parsing file, not replace existing Macro\r
-AllMacroList = []\r
\r
def GetRealFileLine (File, Line):\r
\r
\r
self.PcdDict = {}\r
self.InfList = []\r
-\r
+ # ECC will use this Dict and List information\r
+ self.PcdFileLineDict = {}\r
+ self.InfFileLineList = []\r
+ \r
self.FdDict = {}\r
self.FdNameNotSet = False\r
self.FvDict = {}\r
self.__Token = ""\r
self.__SkippedChars = ""\r
\r
+ # Used to section info\r
+ self.__CurSection = []\r
+ # Key: [section name, UI name, arch]\r
+ # Value: {MACRO_NAME : MACRO_VALUE}\r
+ self.__MacroDict = tdict(True, 3)\r
+ self.__PcdDict = {}\r
+\r
self.__WipeOffArea = []\r
if GenFdsGlobalVariable.WorkSpaceDir == '':\r
GenFdsGlobalVariable.WorkSpaceDir = os.getenv("WORKSPACE")\r
\r
- InputMacroDict.update(GlobalData.gPlatformDefines)\r
- InputMacroDict.update(GlobalData.gGlobalDefines)\r
- InputMacroDict.update(GlobalData.gCommandLineDefines)\r
-\r
## __IsWhiteSpace() method\r
#\r
# Whether char at current FileBufferPos is whitespace\r
self.Profile.FileLinesList = [list(s) for s in self.Profile.FileLinesList]\r
self.Profile.FileLinesList[-1].append(' ')\r
\r
- def __ReplaceMacros(self, Str, File, Line):\r
- MacroEnd = 0\r
- while Str.find('$(', MacroEnd) >= 0:\r
- MacroStart = Str.find('$(', MacroEnd)\r
- if Str.find(')', MacroStart) > 0:\r
- MacroEnd = Str.find(')', MacroStart)\r
- Name = Str[MacroStart + 2 : MacroEnd]\r
- Value = None\r
- if Name in InputMacroDict:\r
- Value = InputMacroDict[Name]\r
-\r
- else:\r
- for Profile in AllMacroList:\r
- if Profile.FileName == File and Profile.MacroName == Name and Profile.DefinedAtLine <= Line:\r
- Value = Profile.MacroValue\r
-\r
- if Value != None:\r
- Str = Str.replace('$(' + Name + ')', Value)\r
- MacroEnd = MacroStart + len(Value)\r
-\r
- else:\r
- raise Warning("Macro not complete", self.FileName, self.CurrentLineNumber)\r
- return Str\r
-\r
def __ReplaceFragment(self, StartPos, EndPos, Value = ' '):\r
if StartPos[0] == EndPos[0]:\r
Offset = StartPos[1]\r
self.FileName, self.CurrentLineNumber)\r
MacroName = MacroName[2:-1]\r
return MacroName, NotFlag\r
- \r
+\r
+ def __SetMacroValue(self, Macro, Value):\r
+ if not self.__CurSection:\r
+ return\r
+\r
+ MacroDict = {}\r
+ if not self.__MacroDict[self.__CurSection[0], self.__CurSection[1], self.__CurSection[2]]:\r
+ self.__MacroDict[self.__CurSection[0], self.__CurSection[1], self.__CurSection[2]] = MacroDict\r
+ else:\r
+ MacroDict = self.__MacroDict[self.__CurSection[0], self.__CurSection[1], self.__CurSection[2]]\r
+ MacroDict[Macro] = Value\r
+\r
+ def __GetMacroValue(self, Macro):\r
+ # Highest priority\r
+ if Macro in GlobalData.gCommandLineDefines:\r
+ return GlobalData.gCommandLineDefines[Macro]\r
+ if Macro in GlobalData.gGlobalDefines:\r
+ return GlobalData.gGlobalDefines[Macro]\r
+\r
+ if self.__CurSection:\r
+ MacroDict = self.__MacroDict[\r
+ self.__CurSection[0],\r
+ self.__CurSection[1],\r
+ self.__CurSection[2]\r
+ ]\r
+ if MacroDict and Macro in MacroDict:\r
+ return MacroDict[Macro]\r
+\r
+ # Lowest priority\r
+ if Macro in GlobalData.gPlatformDefines:\r
+ return GlobalData.gPlatformDefines[Macro]\r
+ return None\r
+\r
+ def __SectionHeaderParser(self, Section):\r
+ # [Defines]\r
+ # [FD.UiName]: use dummy instead if UI name is optional\r
+ # [FV.UiName]\r
+ # [Capsule.UiName]\r
+ # [Rule]: don't take rule section into account, macro is not allowed in this section\r
+ # [VTF.arch.UiName, arch]\r
+ # [OptionRom.DriverName]\r
+ self.__CurSection = []\r
+ Section = Section.strip()[1:-1].upper().replace(' ', '').strip('.')\r
+ ItemList = Section.split('.')\r
+ Item = ItemList[0]\r
+ if Item == '' or Item == 'RULE':\r
+ return\r
+\r
+ if Item == 'DEFINES':\r
+ self.__CurSection = ['COMMON', 'COMMON', 'COMMON']\r
+ elif Item == 'VTF' and len(ItemList) == 3:\r
+ UiName = ItemList[2]\r
+ Pos = UiName.find(',')\r
+ if Pos != -1:\r
+ UiName = UiName[:Pos]\r
+ self.__CurSection = ['VTF', UiName, ItemList[1]]\r
+ elif len(ItemList) > 1:\r
+ self.__CurSection = [ItemList[0], ItemList[1], 'COMMON']\r
+ elif len(ItemList) > 0:\r
+ self.__CurSection = [ItemList[0], 'DUMMY', 'COMMON']\r
+\r
## PreprocessFile() method\r
#\r
# Preprocess file contents, replace comments with spaces.\r
if not self.__GetNextToken():\r
raise Warning("expected include file name", self.FileName, self.CurrentLineNumber)\r
IncFileName = self.__Token\r
- if not os.path.isabs(IncFileName):\r
- if IncFileName.startswith('$(WORKSPACE)'):\r
- Str = IncFileName.replace('$(WORKSPACE)', os.environ.get('WORKSPACE'))\r
- if os.path.exists(Str):\r
- if not os.path.isabs(Str):\r
- Str = os.path.abspath(Str)\r
- IncFileName = Str\r
- else:\r
- # file is in the same dir with FDF file\r
- FullFdf = self.FileName\r
- if not os.path.isabs(self.FileName):\r
- FullFdf = os.path.join(os.environ.get('WORKSPACE'), self.FileName)\r
-\r
- IncFileName = os.path.join(os.path.dirname(FullFdf), IncFileName)\r
-\r
- if not os.path.exists(os.path.normpath(IncFileName)):\r
- raise Warning("Include file not exists", self.FileName, self.CurrentLineNumber)\r
+ __IncludeMacros = {}\r
+ for Macro in ['WORKSPACE', 'ECP_SOURCE', 'EFI_SOURCE', 'EDK_SOURCE']:\r
+ MacroVal = self.__GetMacroValue(Macro)\r
+ if MacroVal:\r
+ __IncludeMacros[Macro] = MacroVal\r
+\r
+ try:\r
+ IncludedFile = NormPath(ReplaceMacro(IncFileName, __IncludeMacros, RaiseError=True))\r
+ except:\r
+ raise Warning("only these system environment variables are permitted to start the path of the included file: "\r
+ "$(WORKSPACE), $(ECP_SOURCE), $(EFI_SOURCE), $(EDK_SOURCE)",\r
+ self.FileName, self.CurrentLineNumber)\r
+ #\r
+ # First search the include file under the same directory as FDF file\r
+ #\r
+ IncludedFile1 = PathClass(IncludedFile, os.path.dirname(self.FileName))\r
+ ErrorCode = IncludedFile1.Validate()[0]\r
+ if ErrorCode != 0:\r
+ #\r
+ # Then search the include file under the same directory as DSC file\r
+ #\r
+ PlatformDir = ''\r
+ if GenFdsGlobalVariable.ActivePlatform:\r
+ PlatformDir = GenFdsGlobalVariable.ActivePlatform.Dir\r
+ elif GlobalData.gActivePlatform:\r
+ PlatformDir = GlobalData.gActivePlatform.MetaFile.Dir\r
+ IncludedFile1 = PathClass(IncludedFile, PlatformDir)\r
+ ErrorCode = IncludedFile1.Validate()[0]\r
+ if ErrorCode != 0:\r
+ #\r
+ # Also search file under the WORKSPACE directory\r
+ #\r
+ IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace)\r
+ ErrorCode = IncludedFile1.Validate()[0]\r
+ if ErrorCode != 0:\r
+ raise Warning("The include file does not exist under below directories: \n%s\n%s\n%s\n"%(os.path.dirname(self.FileName), PlatformDir, GlobalData.gWorkspace), \r
+ self.FileName, self.CurrentLineNumber)\r
\r
- IncFileProfile = IncludeFileProfile(os.path.normpath(IncFileName))\r
+ IncFileProfile = IncludeFileProfile(IncludedFile1.Path)\r
\r
CurrentLine = self.CurrentLineNumber\r
CurrentOffset = self.CurrentOffsetWithinLine\r
# IfList is a stack of if branches with elements of list [Pos, CondSatisfied, BranchDetermined]\r
IfList = []\r
RegionLayoutLine = 0\r
+ ReplacedLine = -1\r
while self.__GetNextToken():\r
+ # Determine section name and the location dependent macro\r
+ if self.__GetIfListCurrentItemStat(IfList):\r
+ if self.__Token.startswith('['):\r
+ Header = self.__Token\r
+ if not self.__Token.endswith(']'):\r
+ self.__SkipToToken(']')\r
+ Header += self.__SkippedChars\r
+ if Header.find('$(') != -1:\r
+ raise Warning("macro cannot be used in section header", self.FileName, self.CurrentLineNumber)\r
+ self.__SectionHeaderParser(Header)\r
+ continue\r
+ # Replace macros except in RULE section or out of section\r
+ elif self.__CurSection and ReplacedLine != self.CurrentLineNumber:\r
+ ReplacedLine = self.CurrentLineNumber\r
+ self.__UndoToken()\r
+ CurLine = self.Profile.FileLinesList[ReplacedLine - 1]\r
+ PreIndex = 0\r
+ StartPos = CurLine.find('$(', PreIndex)\r
+ EndPos = CurLine.find(')', StartPos+2)\r
+ while StartPos != -1 and EndPos != -1 and not (self.__Token == '!ifdef' or self.__Token == '!ifndef'):\r
+ MacroName = CurLine[StartPos+2 : EndPos]\r
+ MacorValue = self.__GetMacroValue(MacroName)\r
+ if MacorValue != None:\r
+ CurLine = CurLine.replace('$(' + MacroName + ')', MacorValue, 1)\r
+ if MacorValue.find('$(') != -1:\r
+ PreIndex = StartPos\r
+ else:\r
+ PreIndex = StartPos + len(MacorValue)\r
+ else:\r
+ PreIndex = EndPos + 1\r
+ StartPos = CurLine.find('$(', PreIndex)\r
+ EndPos = CurLine.find(')', StartPos+2)\r
+ self.Profile.FileLinesList[ReplacedLine - 1] = CurLine\r
+ continue\r
+\r
if self.__Token == 'DEFINE':\r
- if self.__GetIfListCurrentItemStat(IfList): \r
+ if self.__GetIfListCurrentItemStat(IfList):\r
+ if not self.__CurSection:\r
+ raise Warning("macro cannot be defined in Rule section or out of section", self.FileName, self.CurrentLineNumber)\r
DefineLine = self.CurrentLineNumber - 1\r
DefineOffset = self.CurrentOffsetWithinLine - len('DEFINE')\r
if not self.__GetNextToken():\r
if not self.__IsToken( "="):\r
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
\r
- if not self.__GetNextToken():\r
- raise Warning("expected value", self.FileName, self.CurrentLineNumber)\r
- \r
- if self.__GetStringData():\r
- pass\r
- Value = self.__Token\r
- if not Macro in InputMacroDict:\r
- FileLineTuple = GetRealFileLine(self.FileName, DefineLine + 1)\r
- MacProfile = MacroProfile(FileLineTuple[0], FileLineTuple[1])\r
- MacProfile.MacroName = Macro\r
- MacProfile.MacroValue = Value\r
- AllMacroList.append(MacProfile)\r
- InputMacroDict[MacProfile.MacroName] = MacProfile.MacroValue\r
+ Value = self.__GetExpression()\r
+ self.__SetMacroValue(Macro, Value)\r
self.__WipeOffArea.append(((DefineLine, DefineOffset), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))\r
elif self.__Token == 'SET':\r
PcdPair = self.__GetNextPcdName()\r
if not self.__IsToken( "="):\r
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
\r
- if not self.__GetNextToken():\r
- raise Warning("expected value", self.FileName, self.CurrentLineNumber)\r
-\r
- Value = self.__Token\r
- if Value.startswith("{"):\r
- # deal with value with {}\r
- if not self.__SkipToToken( "}"):\r
- raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)\r
- Value += self.__SkippedChars\r
+ Value = self.__GetExpression()\r
+ Value = self.__EvaluateConditional(Value, self.CurrentLineNumber, 'eval', True)\r
\r
- InputMacroDict[PcdName] = Value\r
+ self.__PcdDict[PcdName] = Value\r
elif self.__Token in ('!ifdef', '!ifndef', '!if'):\r
IfStartPos = (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len(self.__Token))\r
IfList.append([IfStartPos, None, None])\r
IfList[-1][2] = True\r
self.__WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))\r
elif self.__Token == '!endif':\r
+ if len(IfList) <= 0:\r
+ raise Warning("Missing !if statement", self.FileName, self.CurrentLineNumber)\r
if IfList[-1][1]:\r
self.__WipeOffArea.append(((self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len('!endif')), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))\r
else:\r
if not RegionSizeGuid:\r
RegionLayoutLine = self.CurrentLineNumber + 1\r
continue\r
- InputMacroDict[RegionSizeGuid.group('base')] = RegionSize.group('base')\r
- InputMacroDict[RegionSizeGuid.group('size')] = RegionSize.group('size')\r
+ self.__PcdDict[RegionSizeGuid.group('base')] = RegionSize.group('base')\r
+ self.__PcdDict[RegionSizeGuid.group('size')] = RegionSize.group('size')\r
RegionLayoutLine = self.CurrentLineNumber + 1\r
\r
if IfList:\r
raise Warning("Missing !endif", self.FileName, self.CurrentLineNumber)\r
self.Rewind()\r
\r
+ def __CollectMacroPcd(self):\r
+ MacroDict = {}\r
+\r
+ # PCD macro\r
+ MacroDict.update(self.__PcdDict)\r
+\r
+ # Lowest priority\r
+ MacroDict.update(GlobalData.gPlatformDefines)\r
+\r
+ if self.__CurSection:\r
+ # Defines macro\r
+ ScopeMacro = self.__MacroDict['COMMON', 'COMMON', 'COMMON']\r
+ if ScopeMacro:\r
+ MacroDict.update(ScopeMacro)\r
+ \r
+ # Section macro\r
+ ScopeMacro = self.__MacroDict[\r
+ self.__CurSection[0],\r
+ self.__CurSection[1],\r
+ self.__CurSection[2]\r
+ ]\r
+ if ScopeMacro:\r
+ MacroDict.update(ScopeMacro)\r
+\r
+ MacroDict.update(GlobalData.gGlobalDefines)\r
+ MacroDict.update(GlobalData.gCommandLineDefines)\r
+ # Highest priority\r
+\r
+ return MacroDict\r
+\r
def __EvaluateConditional(self, Expression, Line, Op = None, Value = None):\r
FileLineTuple = GetRealFileLine(self.FileName, Line)\r
+ MacroPcdDict = self.__CollectMacroPcd()\r
if Op == 'eval':\r
try:\r
- return ValueExpression(Expression, InputMacroDict)()\r
- except SymbolNotFound:\r
- return False\r
+ if Value:\r
+ return ValueExpression(Expression, MacroPcdDict)(True)\r
+ else:\r
+ return ValueExpression(Expression, MacroPcdDict)()\r
except WrnExpression, Excpt:\r
# \r
# Catch expression evaluation warning here. We need to report\r
else:\r
if Expression.startswith('$(') and Expression[-1] == ')':\r
Expression = Expression[2:-1] \r
- return Expression in InputMacroDict\r
+ return Expression in MacroPcdDict\r
\r
## __IsToken() method\r
#\r
# Record the token start position, the position of the first non-space char.\r
StartPos = self.CurrentOffsetWithinLine\r
StartLine = self.CurrentLineNumber\r
- while not self.__EndOfLine():\r
+ while StartLine == self.CurrentLineNumber:\r
TempChar = self.__CurrentChar()\r
# Try to find the end char that is not a space and not in seperator tuple.\r
# That is, when we got a space or any char in the tuple, we got the end of token.\r
# That is, when we got a space or any char in the tuple, we got the end of token.\r
if not str(TempChar).isspace() and not TempChar in SEPERATOR_TUPLE:\r
if not self.__UndoOneChar():\r
- break\r
+ return\r
# if we happen to meet a seperator as the first char, we must proceed to get it.\r
# That is, we get a token that is a seperator char. nomally it is the boundary of other tokens.\r
elif StartPos == self.CurrentOffsetWithinLine and TempChar in SEPERATOR_TUPLE:\r
def SetFileBufferPos(self, Pos):\r
(self.CurrentLineNumber, self.CurrentOffsetWithinLine) = Pos\r
\r
+ ## Preprocess() method\r
+ #\r
+ # Preprocess comment, conditional directive, include directive, replace macro.\r
+ # Exception will be raised if syntax error found\r
+ #\r
+ # @param self The object pointer\r
+ #\r
+ def Preprocess(self):\r
+ self.__StringToList()\r
+ self.PreprocessFile()\r
+ self.PreprocessIncludeFile()\r
+ self.__StringToList()\r
+ self.PreprocessFile()\r
+ self.PreprocessConditionalStatement()\r
+ self.__StringToList()\r
+ for Pos in self.__WipeOffArea:\r
+ self.__ReplaceFragment(Pos[0], Pos[1])\r
+ self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]\r
+\r
+ while self.__GetDefines():\r
+ pass\r
+\r
## ParseFile() method\r
#\r
# Parse the file profile buffer to extract fd, fv ... information\r
def ParseFile(self):\r
\r
try:\r
- self.__StringToList()\r
- self.PreprocessFile()\r
- self.PreprocessIncludeFile()\r
- self.__StringToList()\r
- self.PreprocessFile()\r
- self.PreprocessConditionalStatement()\r
- self.__StringToList()\r
- for Pos in self.__WipeOffArea:\r
- self.__ReplaceFragment(Pos[0], Pos[1])\r
- self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]\r
-\r
- while self.__GetDefines():\r
- pass\r
- \r
- Index = 0\r
- while Index < len(self.Profile.FileLinesList):\r
- FileLineTuple = GetRealFileLine(self.FileName, Index + 1)\r
- self.Profile.FileLinesList[Index] = self.__ReplaceMacros(self.Profile.FileLinesList[Index], FileLineTuple[0], FileLineTuple[1])\r
- Index += 1\r
-\r
+ self.Preprocess()\r
while self.__GetFd():\r
pass\r
\r
if not self.__GetNextToken() or self.__Token.startswith('['):\r
raise Warning("expected MACRO value", self.FileName, self.CurrentLineNumber)\r
Value = self.__Token\r
- FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
- MacProfile = MacroProfile(FileLineTuple[0], FileLineTuple[1])\r
- MacProfile.MacroName = Macro\r
- MacProfile.MacroValue = Value\r
- AllMacroList.append(MacProfile)\r
\r
return False\r
\r
if FdName == "":\r
if len (self.Profile.FdDict) == 0:\r
FdName = GenFdsGlobalVariable.PlatformName\r
+ if FdName == "" and GlobalData.gActivePlatform:\r
+ FdName = GlobalData.gActivePlatform.PlatformName\r
self.Profile.FdNameNotSet = True\r
else:\r
raise Warning("expected FdName in [FD.] section", self.FileName, self.CurrentLineNumber)\r
pcdPair = self.__GetNextPcdName()\r
Obj.BaseAddressPcd = pcdPair\r
self.Profile.PcdDict[pcdPair] = Obj.BaseAddress\r
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
+ self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple\r
\r
if not self.__IsKeyword( "Size"):\r
raise Warning("Size missing", self.FileName, self.CurrentLineNumber)\r
pcdPair = self.__GetNextPcdName()\r
Obj.SizePcd = pcdPair\r
self.Profile.PcdDict[pcdPair] = Size\r
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
+ self.Profile.PcdFileLineDict[pcdPair] = FileLineTuple\r
Obj.Size = long(Size, 0)\r
\r
if not self.__IsKeyword( "ErasePolarity"):\r
PcdPair = self.__GetNextPcdName()\r
BlockSizePcd = PcdPair\r
self.Profile.PcdDict[PcdPair] = BlockSize\r
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
+ self.Profile.PcdFileLineDict[PcdPair] = FileLineTuple\r
BlockSize = long(BlockSize, 0)\r
\r
BlockNumber = None\r
if not self.__IsToken( "="):\r
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
\r
- if not self.__GetNextToken():\r
- raise Warning("expected value", self.FileName, self.CurrentLineNumber)\r
-\r
- Value = self.__Token\r
- if Value.startswith("{"):\r
- # deal with value with {}\r
- if not self.__SkipToToken( "}"):\r
- raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)\r
- Value += self.__SkippedChars\r
+ Value = self.__GetExpression()\r
+ Value = self.__EvaluateConditional(Value, self.CurrentLineNumber, 'eval', True)\r
\r
if Obj:\r
Obj.SetVarDict[PcdPair] = Value\r
self.Profile.PcdDict[PcdPair] = Value\r
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
+ self.Profile.PcdFileLineDict[PcdPair] = FileLineTuple\r
return True\r
\r
return False\r
self.__UndoToken()\r
RegionObj.PcdOffset = self.__GetNextPcdName()\r
self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + long(Fd.BaseAddress, 0))\r
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
+ self.Profile.PcdFileLineDict[RegionObj.PcdOffset] = FileLineTuple\r
if self.__IsToken( "|"):\r
RegionObj.PcdSize = self.__GetNextPcdName()\r
self.Profile.PcdDict[RegionObj.PcdSize] = "0x%08X" % RegionObj.Size\r
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
+ self.Profile.PcdFileLineDict[RegionObj.PcdSize] = FileLineTuple\r
\r
if not self.__GetNextWord():\r
return True\r
\r
if not ffsInf.InfFileName in self.Profile.InfList:\r
self.Profile.InfList.append(ffsInf.InfFileName)\r
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
+ self.Profile.InfFileLineList.append(FileLineTuple)\r
\r
if self.__IsToken('|'):\r
if self.__IsKeyword('RELOCS_STRIPPED'):\r
if ErrorCode != 0:\r
EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)\r
else:\r
- if not InputMacroDict["OUTPUT_DIRECTORY"] in FfsFileObj.FileName:\r
+ if not self.__GetMacroValue("OUTPUT_DIRECTORY") in FfsFileObj.FileName:\r
#do case sensitive check for file path\r
ErrorCode, ErrorInfo = PathClass(NormPath(FfsFileObj.FileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()\r
if ErrorCode != 0:\r
if not self.__GetNextToken():\r
raise Warning("expected FV name", self.FileName, self.CurrentLineNumber)\r
\r
+ if self.__Token.upper() not in self.Profile.FvDict.keys():\r
+ raise Warning("FV name does not exist", self.FileName, self.CurrentLineNumber)\r
+\r
CapsuleFv = CapsuleData.CapsuleFv()\r
CapsuleFv.FvName = self.__Token\r
CapsuleObj.CapsuleDataList.append(CapsuleFv)\r
if not self.__GetNextToken():\r
raise Warning("expected FD name", self.FileName, self.CurrentLineNumber)\r
\r
+ if self.__Token.upper() not in self.Profile.FdDict.keys():\r
+ raise Warning("FD name does not exist", self.FileName, self.CurrentLineNumber)\r
+\r
CapsuleFd = CapsuleData.CapsuleFd()\r
CapsuleFd.FdName = self.__Token\r
CapsuleObj.CapsuleDataList.append(CapsuleFd)\r
\r
if not ffsInf.InfFileName in self.Profile.InfList:\r
self.Profile.InfList.append(ffsInf.InfFileName)\r
+ FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
+ self.Profile.InfFileLineList.append(FileLineTuple)\r
\r
\r
self.__GetOptRomOverrides (ffsInf)\r