import Common.GlobalData as GlobalData\r
from Common.Expression import *\r
from Common import GlobalData\r
+from Common.String import ReplaceMacro\r
\r
import re\r
import os\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
+ __IncludeMacros['WORKSPACE'] = InputMacroDict['WORKSPACE']\r
+ __IncludeMacros['ECP_SOURCE'] = InputMacroDict['ECP_SOURCE']\r
+ __IncludeMacros['EFI_SOURCE'] = InputMacroDict['EFI_SOURCE']\r
+ __IncludeMacros['EDK_SOURCE'] = InputMacroDict['EDK_SOURCE']\r
+ \r
+ IncludedFile = NormPath(ReplaceMacro(IncFileName, __IncludeMacros, RaiseError=True))\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
+ IncludedFile1 = PathClass(IncludedFile, GenFdsGlobalVariable.ActivePlatform.Dir)\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), GenFdsGlobalVariable.ActivePlatform.Dir, 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
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