summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/GenFds
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-25 06:21:03 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-25 06:21:03 +0000
commit2bcc713e74b944bb5aefb433ef33fb4002a62d76 (patch)
tree7aa002279415c1fafbedbf287d256177746e0a4a /BaseTools/Source/Python/GenFds
parentc32dcd284c19bbb0b1db3606a243d9d69d37d6ab (diff)
Sync BaseTool trunk (version r2423) into EDKII BaseTools. The change mainly includes:
1. Fix !include issues 2. Fix Trim to skip the postfix 'U' for hexadecimal and decimal numbers 3. Fix building error C2733 when building C++ code. 4. Add GCC46 tool chain definition 5. Add new RVCT and RVCTLINUX tool chains Signed-off-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12782 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/GenFds')
-rw-r--r--BaseTools/Source/Python/GenFds/FdfParser.py53
1 files changed, 35 insertions, 18 deletions
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index 358215d66..d3d50b638 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -50,6 +50,7 @@ from Common.String import NormPath
import Common.GlobalData as GlobalData
from Common.Expression import *
from Common import GlobalData
+from Common.String import ReplaceMacro
import re
import os
@@ -528,25 +529,35 @@ class FdfParser:
if not self.__GetNextToken():
raise Warning("expected include file name", self.FileName, self.CurrentLineNumber)
IncFileName = self.__Token
- if not os.path.isabs(IncFileName):
- if IncFileName.startswith('$(WORKSPACE)'):
- Str = IncFileName.replace('$(WORKSPACE)', os.environ.get('WORKSPACE'))
- if os.path.exists(Str):
- if not os.path.isabs(Str):
- Str = os.path.abspath(Str)
- IncFileName = Str
- else:
- # file is in the same dir with FDF file
- FullFdf = self.FileName
- if not os.path.isabs(self.FileName):
- FullFdf = os.path.join(os.environ.get('WORKSPACE'), self.FileName)
-
- IncFileName = os.path.join(os.path.dirname(FullFdf), IncFileName)
-
- if not os.path.exists(os.path.normpath(IncFileName)):
- raise Warning("Include file not exists", self.FileName, self.CurrentLineNumber)
+ __IncludeMacros = {}
+ __IncludeMacros['WORKSPACE'] = InputMacroDict['WORKSPACE']
+ __IncludeMacros['ECP_SOURCE'] = InputMacroDict['ECP_SOURCE']
+ __IncludeMacros['EFI_SOURCE'] = InputMacroDict['EFI_SOURCE']
+ __IncludeMacros['EDK_SOURCE'] = InputMacroDict['EDK_SOURCE']
+
+ IncludedFile = NormPath(ReplaceMacro(IncFileName, __IncludeMacros, RaiseError=True))
+ #
+ # First search the include file under the same directory as FDF file
+ #
+ IncludedFile1 = PathClass(IncludedFile, os.path.dirname(self.FileName))
+ ErrorCode = IncludedFile1.Validate()[0]
+ if ErrorCode != 0:
+ #
+ # Then search the include file under the same directory as DSC file
+ #
+ IncludedFile1 = PathClass(IncludedFile, GenFdsGlobalVariable.ActivePlatform.Dir)
+ ErrorCode = IncludedFile1.Validate()[0]
+ if ErrorCode != 0:
+ #
+ # Also search file under the WORKSPACE directory
+ #
+ IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace)
+ ErrorCode = IncludedFile1.Validate()[0]
+ if ErrorCode != 0:
+ raise Warning("The include file does not exist under below directories: \n%s\n%s\n%s\n"%(os.path.dirname(self.FileName), GenFdsGlobalVariable.ActivePlatform.Dir, GlobalData.gWorkspace),
+ self.FileName, self.CurrentLineNumber)
- IncFileProfile = IncludeFileProfile(os.path.normpath(IncFileName))
+ IncFileProfile = IncludeFileProfile(IncludedFile1.Path)
CurrentLine = self.CurrentLineNumber
CurrentOffset = self.CurrentOffsetWithinLine
@@ -2942,6 +2953,9 @@ class FdfParser:
if not self.__GetNextToken():
raise Warning("expected FV name", self.FileName, self.CurrentLineNumber)
+ if self.__Token.upper() not in self.Profile.FvDict.keys():
+ raise Warning("FV name does not exist", self.FileName, self.CurrentLineNumber)
+
CapsuleFv = CapsuleData.CapsuleFv()
CapsuleFv.FvName = self.__Token
CapsuleObj.CapsuleDataList.append(CapsuleFv)
@@ -2967,6 +2981,9 @@ class FdfParser:
if not self.__GetNextToken():
raise Warning("expected FD name", self.FileName, self.CurrentLineNumber)
+ if self.__Token.upper() not in self.Profile.FdDict.keys():
+ raise Warning("FD name does not exist", self.FileName, self.CurrentLineNumber)
+
CapsuleFd = CapsuleData.CapsuleFd()
CapsuleFd.FdName = self.__Token
CapsuleObj.CapsuleDataList.append(CapsuleFd)