Replaced all "raise Exception" with EdkLogger.error() in order to make sure the outpu...
authorjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 9 May 2008 06:03:00 +0000 (06:03 +0000)
committerjwang36 <jwang36@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 9 May 2008 06:03:00 +0000 (06:03 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1201 7335b38e-4728-0410-8992-fb3ffe349368

13 files changed:
Source/Python/GenFds/AprioriSection.py
Source/Python/GenFds/DataSection.py
Source/Python/GenFds/DepexSection.py
Source/Python/GenFds/EfiSection.py
Source/Python/GenFds/Fd.py
Source/Python/GenFds/FfsFileStatement.py
Source/Python/GenFds/FfsInfStatement.py
Source/Python/GenFds/FvImageSection.py
Source/Python/GenFds/GenFds.py
Source/Python/GenFds/GenFdsGlobalVariable.py
Source/Python/GenFds/GuidSection.py
Source/Python/GenFds/Region.py
Source/Python/GenFds/Section.py

index 8d7c127..f1e60ec 100755 (executable)
@@ -22,6 +22,8 @@ import FfsFileStatement
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 from CommonDataClass.FdfClass import AprioriSectionClassObject\r
 from Common.String import *\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
 \r
 ## process APRIORI file data and generate PEI/DXE APRIORI file\r
 #\r
@@ -34,7 +36,7 @@ class AprioriSection (AprioriSectionClassObject):
     def __init__(self):\r
         AprioriSectionClassObject.__init__(self)\r
         self.AprioriType = ""\r
-    \r
+\r
     ## GenFfs() method\r
     #\r
     #   Generate FFS for APRIORI file\r
@@ -56,16 +58,16 @@ class AprioriSection (AprioriSectionClassObject):
                                    AprioriFileGuid + FvName)\r
         if not os.path.exists(OutputAprFilePath) :\r
             os.makedirs(OutputAprFilePath)\r
-            \r
+\r
         OutputAprFileName = os.path.join( OutputAprFilePath, \\r
                                        AprioriFileGuid + FvName + '.Apri' )\r
         AprFfsFileName = os.path.join (OutputAprFilePath,\\r
                                     AprioriFileGuid + FvName + '.Ffs')\r
-                                   \r
+\r
         OutputAprFile = open(OutputAprFileName, 'w+b')\r
-        \r
+\r
         Dict.update(self.DefineVarDict)\r
-        \r
+\r
         for FfsObj in self.FfsList :\r
             Guid = ""\r
             if isinstance(FfsObj, FfsFileStatement.FileStatement):\r
@@ -73,7 +75,7 @@ class AprioriSection (AprioriSectionClassObject):
             else:\r
                 InfFileName = NormPath(FfsObj.InfFileName)\r
                 Arch = FfsObj.GetCurrentArch()\r
-                \r
+\r
                 if Arch != None:\r
                     Dict['$(ARCH)'] = Arch\r
                 InfFileName = GenFdsGlobalVariable.MacroExtend(InfFileName, Dict, Arch)\r
@@ -81,44 +83,45 @@ class AprioriSection (AprioriSectionClassObject):
                 if Arch != None:\r
                     Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[InfFileName, Arch]\r
                     Guid = Inf.Guid\r
-        \r
+\r
                 else:\r
                     Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[InfFileName, 'COMMON']\r
                     Guid = Inf.Guid\r
-                    \r
+\r
                     self.BinFileList = Inf.Module.Binaries\r
                     if self.BinFileList == []:\r
-                        raise Exception ("INF %s not found in build ARCH %s!" % (InfFileName, GenFdsGlobalVariable.ArchList))\r
-                        sys.exit(1)\r
-            \r
-                \r
+                        EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE,\r
+                                        "INF %s not found in build ARCH %s!" \\r
+                                        % (InfFileName, GenFdsGlobalVariable.ArchList))\r
+\r
+\r
             GuidPart = Guid.split('-')\r
             Buffer.write(pack('I', long(GuidPart[0], 16)))\r
             Buffer.write(pack('H', int(GuidPart[1], 16)))\r
             Buffer.write(pack('H', int(GuidPart[2], 16)))\r
-            \r
+\r
             for Num in range(2):\r
                 Char = GuidPart[3][Num*2:Num*2+2]\r
                 Buffer.write(pack('B', int(Char, 16)))\r
-            \r
+\r
             for Num in range(6):\r
                 Char = GuidPart[4][Num*2:Num*2+2]\r
                 Buffer.write(pack('B', int(Char, 16)))\r
-    \r
+\r
         OutputAprFile.write(Buffer.getvalue())\r
         OutputAprFile.close()\r
         RawSectionFileName = os.path.join( OutputAprFilePath, \\r
                                        AprioriFileGuid + FvName + '.raw' )\r
-        \r
+\r
         GenSectionCmd = (\r
             'GenSec',\r
             '-o', RawSectionFileName,\r
             '-s', 'EFI_SECTION_RAW',\r
             OutputAprFileName,\r
             )\r
-        \r
+\r
         GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
-        \r
+\r
         GenFfsCmd = (\r
             'GenFfs',\r
             '-t', 'EFI_FV_FILETYPE_FREEFORM',\r
@@ -126,7 +129,7 @@ class AprioriSection (AprioriSectionClassObject):
             '-o', AprFfsFileName,\r
             '-i', RawSectionFileName,\r
             )\r
-        \r
+\r
         GenFdsGlobalVariable.CallExternalTool(GenFfsCmd,"GenFfs Failed !")\r
         return AprFfsFileName\r
-            \r
+\r
index 210a796..d7bc8c3 100644 (file)
@@ -33,7 +33,7 @@ class DataSection (DataSectionClassObject):
     #\r
     def __init__(self):\r
         DataSectionClassObject.__init__(self)\r
-    \r
+\r
     ## GenSection() method\r
     #\r
     #   Generate compressed section\r
@@ -46,7 +46,7 @@ class DataSection (DataSectionClassObject):
     #   @param  FfsInf      FfsInfStatement object that contains this section data\r
     #   @param  Dict        dictionary contains macro and its value\r
     #   @retval tuple       (Generated file name list, section alignment)\r
-    #    \r
+    #\r
     def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}):\r
         #\r
         # Prepare the parameter of GenSection\r
@@ -57,16 +57,15 @@ class DataSection (DataSectionClassObject):
             self.SectFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.SectFileName)\r
             self.SectFileName = GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict, FfsFile.CurrentArch)\r
         else:\r
-#            raise Exception ("Module %s GenDataSection for None!" %ModuleName)\r
             self.SectFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.SectFileName)\r
             self.SectFileName = GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)\r
-        \r
+\r
         """Check Section file exist or not !"""\r
 \r
         if not os.path.exists(self.SectFileName):\r
             self.SectFileName = os.path.join (GenFdsGlobalVariable.WorkSpaceDir,\r
                                               self.SectFileName)\r
-        \r
+\r
         """Copy Map file to Ffs output"""\r
         Filename = GenFdsGlobalVariable.MacroExtend(self.SectFileName)\r
         if Filename[(len(Filename)-4):] == '.efi':\r
@@ -75,13 +74,13 @@ class DataSection (DataSectionClassObject):
                 CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')\r
                 if os.path.exists(CopyMapFile):\r
                     os.remove(CopyMapFile)\r
-                shutil.copyfile(MapFile, CopyMapFile) \r
-        \r
+                shutil.copyfile(MapFile, CopyMapFile)\r
+\r
         NoStrip = True\r
         if self.SecType in ('TE', 'PE32'):\r
             if self.KeepReloc != None:\r
                 NoStrip = self.KeepReloc\r
-        \r
+\r
         if not NoStrip:\r
             FileBeforeStrip = os.path.join(OutputPath, ModuleName + '.efi')\r
             if os.path.exists(FileBeforeStrip):\r
@@ -96,7 +95,7 @@ class DataSection (DataSectionClassObject):
                 )\r
             GenFdsGlobalVariable.CallExternalTool(StripCmd, "Strip Failed !")\r
             self.SectFileName = StrippedFile\r
-        \r
+\r
         if self.SecType == 'TE':\r
             TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')\r
             GenTeCmd = (\r
@@ -106,22 +105,22 @@ class DataSection (DataSectionClassObject):
                 GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict),\r
                 )\r
             GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
-            self.SectFileName = TeFile    \r
-                 \r
+            self.SectFileName = TeFile\r
+\r
         OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get(self.SecType))\r
         OutputFile = os.path.normpath(OutputFile)\r
-        \r
+\r
         GenSectionCmd = (\r
             'GenSec',\r
              '-o', OutputFile,\r
              '-s', Section.Section.SectionType.get (self.SecType),\r
              self.SectFileName,\r
             )\r
-                         \r
+\r
         #\r
         # Call GenSection\r
         #\r
-        \r
+\r
         GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
         FileList = [OutputFile]\r
         return FileList, self.Alignment\r
index 0b18d60..bf57aff 100644 (file)
@@ -23,6 +23,8 @@ import os
 from CommonDataClass.FdfClass import DepexSectionClassObject\r
 from AutoGen.GenDepex import DependencyExpression\r
 import shutil\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
 \r
 ## generate data section\r
 #\r
@@ -34,7 +36,7 @@ class DepexSection (DepexSectionClassObject):
     #\r
     def __init__(self):\r
         DepexSectionClassObject.__init__(self)\r
-    \r
+\r
     def __FindGuidValue(self, CName):\r
         for Arch in GenFdsGlobalVariable.ArchList:\r
             for PkgDb in GenFdsGlobalVariable.WorkSpace.PackageList:\r
@@ -45,7 +47,7 @@ class DepexSection (DepexSectionClassObject):
                 if CName in PkgDb.Guids:\r
                     return PkgDb.Guids[CName]\r
         return None\r
-    \r
+\r
     ## GenSection() method\r
     #\r
     #   Generate compressed section\r
@@ -58,48 +60,48 @@ class DepexSection (DepexSectionClassObject):
     #   @param  FfsInf      FfsInfStatement object that contains this section data\r
     #   @param  Dict        dictionary contains macro and its value\r
     #   @retval tuple       (Generated file name list, section alignment)\r
-    #    \r
+    #\r
     def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}):\r
-        \r
+\r
         self.Expression = self.Expression.replace("\n", " ").replace("\r", " ")\r
         ExpList = self.Expression.split()\r
         ExpGuidDict = {}\r
-        \r
+\r
         for Exp in ExpList:\r
             if Exp.upper() not in ('AND', 'OR', 'NOT', 'TRUE', 'FALSE', 'SOR', 'BEFORE', 'AFTER', 'END'):\r
                 GuidStr = self.__FindGuidValue(Exp)\r
                 if GuidStr == None:\r
-                    raise Exception ("Depex GUID %s could not be found in build DB! (ModuleName: %s)" % (Exp, ModuleName))\r
-                    sys.exit(1)\r
-                    \r
+                    EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE,\r
+                                    "Depex GUID %s could not be found in build DB! (ModuleName: %s)" % (Exp, ModuleName))\r
+\r
                 ExpGuidDict[Exp] = GuidStr\r
-                \r
+\r
         for Item in ExpGuidDict:\r
             self.Expression = self.Expression.replace(Item, ExpGuidDict[Item])\r
-            \r
+\r
         self.Expression = self.Expression.strip()\r
         ModuleType = (self.DepexType.startswith('PEI') and ['PEIM'] or ['DXE_DRIVER'])[0]\r
         InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')\r
         InputFile = os.path.normpath(InputFile)\r
-        \r
+\r
         Dpx = DependencyExpression(self.Expression, ModuleType)\r
         Dpx.Generate(InputFile)\r
-        \r
+\r
         OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex')\r
         OutputFile = os.path.normpath(OutputFile)\r
         SecType = (self.DepexType.startswith('PEI') and ['PEI_DEPEX'] or ['DXE_DEPEX'])[0]\r
-        \r
+\r
         GenSectionCmd = (\r
             'GenSec',\r
              '-o', OutputFile,\r
              '-s', Section.Section.SectionType.get (SecType),\r
              InputFile,\r
             )\r
-                         \r
+\r
         #\r
         # Call GenSection\r
         #\r
-        \r
+\r
         GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
         FileList = [OutputFile]\r
         return FileList, self.Alignment\r
index 0bf1211..b2eb47d 100644 (file)
@@ -22,12 +22,14 @@ from Ffs import Ffs
 import os\r
 from CommonDataClass.FdfClass import EfiSectionClassObject\r
 import shutil\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
 \r
 ## generate rule section\r
 #\r
 #\r
 class EfiSection (EfiSectionClassObject):\r
-    \r
+\r
     ## The constructor\r
     #\r
     #   @param  self        The object pointer\r
@@ -67,15 +69,15 @@ class EfiSection (EfiSectionClassObject):
                 elif FfsInf.ShadowFromInfFile != None:\r
                     NoStrip = FfsInf.ShadowFromInfFile\r
         else:\r
-            raise Exception ("Module %s apply rule for None!" %ModuleName)\r
-        \r
-        """If the file name was pointed out, add it in FileList"""     \r
+            EdkLogger.error("GenFds", GENFDS_ERROR, "Module %s apply rule for None!" %ModuleName)\r
+\r
+        """If the file name was pointed out, add it in FileList"""\r
         FileList = []\r
         if Filename != None:\r
             Filename = GenFdsGlobalVariable.MacroExtend(Filename, Dict)\r
             if not self.Optional:\r
                 FileList.append(Filename)\r
-            elif os.path.exists(Filename):                 \r
+            elif os.path.exists(Filename):\r
                 FileList.append(Filename)\r
         else:\r
             FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict)\r
@@ -83,16 +85,16 @@ class EfiSection (EfiSectionClassObject):
                 return FileList, self.Alignment\r
 \r
         Index = 0\r
-              \r
+\r
         """ If Section type is 'VERSION'"""\r
         OutputFileList = []\r
         if SectionType == 'VERSION':\r
-            \r
+\r
             InfOverrideVerString = False\r
             if FfsInf.Version != None:\r
                 StringData = FfsInf.Version\r
                 InfOverrideVerString = True\r
-            \r
+\r
             if InfOverrideVerString:\r
                 VerTuple = ('-n', '"' + StringData + '"')\r
                 if BuildNum != None and BuildNum != '':\r
@@ -108,8 +110,8 @@ class EfiSection (EfiSectionClassObject):
                     '-s', 'EFI_SECTION_VERSION',\r
                     ) + VerTuple + BuildNumTuple\r
                 GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
-                OutputFileList.append(OutputFile)    \r
-                \r
+                OutputFileList.append(OutputFile)\r
+\r
             elif FileList != []:\r
                 for File in FileList:\r
                     Index = Index + 1\r
@@ -128,7 +130,7 @@ class EfiSection (EfiSectionClassObject):
                         ) + VerTuple + BuildNumTuple\r
                     GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
                     OutputFileList.append(OutputFile)\r
-                    \r
+\r
             else:\r
                 if StringData != None and len(StringData) > 0:\r
                     VerTuple = ('-n', '"' + StringData + '"')\r
@@ -147,7 +149,7 @@ class EfiSection (EfiSectionClassObject):
                         GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")\r
                         return [], None\r
                     else:\r
-                        raise Exception ("File: %s miss Version Section value" %InfFileName)\r
+                        EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss Version Section value" %InfFileName)\r
                 Num = SecNum\r
                 OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
                 GenSectionCmd = (\r
@@ -162,12 +164,12 @@ class EfiSection (EfiSectionClassObject):
         # If Section Type is 'UI'\r
         #\r
         elif SectionType == 'UI':\r
-            \r
+\r
             InfOverrideUiString = False\r
             if FfsInf.Ui != None:\r
                 StringData = FfsInf.Ui\r
                 InfOverrideUiString = True\r
-            \r
+\r
             if InfOverrideUiString:\r
                 Num = SecNum\r
                 OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
@@ -180,7 +182,7 @@ class EfiSection (EfiSectionClassObject):
 \r
                 GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
                 OutputFileList.append(OutputFile)\r
-                \r
+\r
             elif FileList != []:\r
                 for File in FileList:\r
                     Index = Index + 1\r
@@ -195,7 +197,7 @@ class EfiSection (EfiSectionClassObject):
                         '-s', 'EFI_SECTION_USER_INTERFACE',\r
                         '-n', '"' + UiString + '"',\r
                         )\r
-                                 \r
+\r
                     GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
                     OutputFileList.append(OutputFile)\r
             else:\r
@@ -208,7 +210,7 @@ class EfiSection (EfiSectionClassObject):
                         GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")\r
                         return '', None\r
                     else:\r
-                        raise Exception ("File: %s miss UI Section value" %InfFileName)\r
+                        EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss UI Section value" %InfFileName)\r
 \r
                 Num = SecNum\r
                 OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + Ffs.SectionSuffix.get(SectionType))\r
@@ -221,7 +223,7 @@ class EfiSection (EfiSectionClassObject):
                 GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
                 OutputFileList.append(OutputFile)\r
 \r
-                \r
+\r
         else:\r
             """If File List is empty"""\r
             if FileList == [] :\r
@@ -229,8 +231,8 @@ class EfiSection (EfiSectionClassObject):
                      GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")\r
                      return [], None\r
                 else:\r
-                     raise Exception("Output file for %s section could not be found for %s" % (SectionType, InfFileName))\r
-            \r
+                     EdkLogger.error("GenFds", GENFDS_ERROR, "Output file for %s section could not be found for %s" % (SectionType, InfFileName))\r
+\r
             else:\r
                 """Convert the File to Section file one by one """\r
                 for File in FileList:\r
@@ -281,8 +283,9 @@ class EfiSection (EfiSectionClassObject):
                         '-s', Section.Section.SectionType.get (SectionType),\r
                         GenFdsGlobalVariable.MacroExtend(File)\r
                         )\r
-                        \r
+\r
                     GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
                     OutputFileList.append(OutputFile)\r
-            \r
+\r
         return OutputFileList, self.Alignment\r
+\r
index c95e82b..ffc957b 100644 (file)
@@ -22,8 +22,9 @@ import StringIO
 import sys\r
 from struct import *\r
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
-T_CHAR_LF = '\n'\r
 from CommonDataClass.FdfClass import FDClassObject\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
 \r
 ## generate FD\r
 #\r
@@ -53,22 +54,26 @@ class FD(FDClassObject):
         for item in self.BlockSizeList:\r
             Offset = Offset + item[0]  * item[1]\r
         if Offset != self.Size:\r
-            raise Exception ('FD %s Size not consistent with block array', self.FdUiName)\r
+            EdkLogger.error("GenFds", GENFDS_ERROR, 'FD %s Size not consistent with block array' % self.FdUiName)\r
         GenFdsGlobalVariable.VerboseLogger('Following Fv will be add to Fd !!!')\r
         for FvObj in GenFdsGlobalVariable.FdfParser.Profile.FvDict:\r
             GenFdsGlobalVariable.VerboseLogger(FvObj)\r
 \r
         GenFdsGlobalVariable.VerboseLogger('################### Gen VTF ####################')\r
         self.GenVtfFile()\r
-        \r
+\r
         FdBuffer = StringIO.StringIO('')\r
         PreviousRegionStart = -1\r
         PreviousRegionSize = 1\r
         for RegionObj in self.RegionList :\r
             if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart:\r
-                raise Exception ('Region offset 0x%X in wrong order with Region starting from 0x%X, size 0x%X\nRegions in FDF must have offsets appear in ascending order.' % (RegionObj.Offset, PreviousRegionStart, PreviousRegionSize))\r
+                EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                'Region offset 0x%X in wrong order with Region starting from 0x%X, size 0x%X\nRegions in FDF must have offsets appear in ascending order.'\\r
+                                % (RegionObj.Offset, PreviousRegionStart, PreviousRegionSize))\r
             elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize):\r
-                raise Exception ('Region offset 0x%X overlaps with Region starting from 0x%X, size 0x%X' % (RegionObj.Offset, PreviousRegionStart, PreviousRegionSize))\r
+                EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                'Region offset 0x%X overlaps with Region starting from 0x%X, size 0x%X' \\r
+                                % (RegionObj.Offset, PreviousRegionStart, PreviousRegionSize))\r
             elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:\r
                 GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))\r
                 PadRegion = Region.Region()\r
@@ -78,10 +83,10 @@ class FD(FDClassObject):
             PreviousRegionStart = RegionObj.Offset\r
             PreviousRegionSize = RegionObj.Size\r
             #\r
-            # Call each region's AddToBuffer function \r
+            # Call each region's AddToBuffer function\r
             #\r
             if PreviousRegionSize > self.Size:\r
-                raise Exception ('FD %s size too small' % self.FdUiName)\r
+                EdkLogger.error("GenFds", GENFDS_ERROR, 'FD %s size too small' % self.FdUiName)\r
             GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')\r
             RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, FvBinDict, self.vtfRawDict, self.DefineVarDict)\r
         #\r
@@ -91,7 +96,7 @@ class FD(FDClassObject):
         FdFileName = os.path.join(GenFdsGlobalVariable.FvDir,\r
                                   self.FdUiName + '.fd')\r
         FdFile = open(FdFileName, 'wb')\r
-       \r
+\r
         #\r
         # Write the buffer contents to Fd file\r
         #\r
@@ -100,11 +105,11 @@ class FD(FDClassObject):
         FdFile.close();\r
         FdBuffer.close();\r
         return FdFileName\r
-    \r
+\r
     ## generate VTF\r
     #\r
     #   @param  self        The object pointer\r
-    #    \r
+    #\r
     def GenVtfFile (self) :\r
         #\r
         # Get this Fd's all Fv name\r
@@ -124,7 +129,9 @@ class FD(FDClassObject):
                         FvList.append(RegionData.upper())\r
                         FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())\r
                         if len(FvObj.BlockSizeList) < 1:\r
-                            raise Exception ('FV.%s must point out FVs blocksize and Fv BlockNum' %FvObj.UiFvName)\r
+                            EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                            'FV.%s must point out FVs blocksize and Fv BlockNum' \\r
+                                            % FvObj.UiFvName)\r
                         else:\r
                             Size = 0\r
                             for blockStatement in FvObj.BlockSizeList:\r
@@ -147,14 +154,14 @@ class FD(FDClassObject):
     ## generate flash map file\r
     #\r
     #   @param  self        The object pointer\r
-    #  \r
+    #\r
     def GenFlashMap (self):\r
         pass\r
-        \r
-        \r
 \r
 \r
 \r
-                \r
-                \r
-            \r
+\r
+\r
+\r
+\r
+\r
index f461cc2..3167d38 100755 (executable)
@@ -22,6 +22,8 @@ import os
 import StringIO\r
 import subprocess\r
 from CommonDataClass.FdfClass import FileStatementClassObject\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
 \r
 ## generate FFS from FILE\r
 #\r
@@ -33,7 +35,7 @@ class FileStatement (FileStatementClassObject) :
     #\r
     def __init__(self):\r
         FileStatementClassObject.__init__(self)\r
-    \r
+\r
     ## GenFfs() method\r
     #\r
     #   Generate FFS\r
@@ -41,34 +43,34 @@ class FileStatement (FileStatementClassObject) :
     #   @param  self        The object pointer\r
     #   @param  Dict        dictionary contains macro and value pair\r
     #   @retval string      Generated FFS file name\r
-    #    \r
+    #\r
     def GenFfs(self, Dict = {}):\r
         OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, self.NameGuid)\r
         if not os.path.exists(OutputDir):\r
              os.makedirs(OutputDir)\r
 \r
         Dict.update(self.DefineVarDict)\r
-        \r
+\r
         if self.FvName != None :\r
             Buffer = StringIO.StringIO('')\r
             if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
-                raise Exception ("FV (%s) is NOT described in FDF file!" % (self.FvName))\r
+                EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (self.FvName))\r
             Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())\r
             FileName = Fv.AddToBuffer(Buffer)\r
             SectionFiles = ('-i', FileName)\r
-            \r
+\r
         elif self.FdName != None:\r
             if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
-                raise Exception ("FD (%s) is NOT described in FDF file!" % (self.FdName))\r
+                EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NOT described in FDF file!" % (self.FdName))\r
             Fd = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())\r
             FvBin = {}\r
             FileName = Fd.GenFd(FvBin)\r
             SectionFiles = ('-i', FileName)\r
-        \r
+\r
         elif self.FileName != None:\r
             self.FileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FileName)\r
             SectionFiles = ('-i', GenFdsGlobalVariable.MacroExtend(self.FileName, Dict))\r
-            \r
+\r
         else:\r
             SectionFiles = tuple()\r
             Index = 0\r
@@ -81,7 +83,7 @@ class FileStatement (FileStatementClassObject) :
                         SectionFiles += ('-i', sect)\r
                         if align != None:\r
                             SectionFiles += ('-n', align)\r
-                               \r
+\r
         #\r
         # Prepare the parameter\r
         #\r
@@ -106,6 +108,6 @@ class FileStatement (FileStatementClassObject) :
 \r
         GenFdsGlobalVariable.CallExternalTool(GenFfsCmd,"GenFfs Failed !")\r
         return FfsFileOutput\r
-        \r
+\r
 \r
 \r
index 18007a0..66c6311 100644 (file)
@@ -27,6 +27,8 @@ import RuleSimpleFile
 import RuleComplexFile\r
 from CommonDataClass.FdfClass import FfsInfStatementClassObject\r
 from Common.String import *\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
 \r
 ## generate FFS from INF\r
 #\r
@@ -48,7 +50,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #\r
     #   @param  self        The object pointer\r
     #   @param  Dict        dictionary contains macro and value pair\r
-    #    \r
+    #\r
     def __InfParse__(self, Dict = {}):\r
         self.CurrentArch = self.GetCurrentArch()\r
         #\r
@@ -59,7 +61,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         self.InfFileName = GenFdsGlobalVariable.MacroExtend(self.InfFileName, Dict, self.CurrentArch)\r
         (self.SourceDir, InfName) = os.path.split(self.InfFileName)\r
         if self.CurrentArch != None:\r
-            \r
+\r
             Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[self.InfFileName, self.CurrentArch]\r
             #\r
             # Set Ffs BaseName, MdouleGuid, ModuleType, Version, OutputPath\r
@@ -73,7 +75,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
             self.BinFileList = Inf.Binaries\r
             if self.KeepReloc == None and Inf.Shadow:\r
                 self.ShadowFromInfFile = Inf.Shadow\r
-        \r
+\r
         else:\r
             Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[self.InfFileName, 'COMMON']\r
             self.BaseName = Inf.BaseName\r
@@ -82,15 +84,16 @@ class FfsInfStatement(FfsInfStatementClassObject):
             self.VersionString = Inf.Version\r
             self.BinFileList = Inf.Binaries\r
             if self.BinFileList == []:\r
-                raise Exception ("INF %s specified in FDF could not be found in build ARCH %s!" % (self.InfFileName, GenFdsGlobalVariable.ArchList))\r
-                sys.exit(1)\r
-        \r
+                EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                "INF %s specified in FDF could not be found in build ARCH %s!" \\r
+                                % (self.InfFileName, GenFdsGlobalVariable.ArchList))\r
+\r
         GenFdsGlobalVariable.VerboseLogger( "BaseName : %s" %self.BaseName)\r
         GenFdsGlobalVariable.VerboseLogger("ModuleGuid : %s" %self.ModuleGuid)\r
         GenFdsGlobalVariable.VerboseLogger("ModuleType : %s" %self.ModuleType)\r
         GenFdsGlobalVariable.VerboseLogger("VersionString : %s" %self.VersionString)\r
         GenFdsGlobalVariable.VerboseLogger("InfFileName :%s"  %self.InfFileName)\r
-        \r
+\r
         #\r
         # Set OutputPath = ${WorkSpace}\Build\Fv\Ffs\${ModuleGuid}+ ${MdouleName}\\r
         #\r
@@ -99,10 +102,10 @@ class FfsInfStatement(FfsInfStatementClassObject):
                                        self.ModuleGuid + self.BaseName)\r
         if not os.path.exists(self.OutputPath) :\r
             os.makedirs(self.OutputPath)\r
-            \r
+\r
         self.EfiOutputPath = self.__GetEFIOutPutPath__()\r
         GenFdsGlobalVariable.VerboseLogger( "ModuelEFIPath: " + self.EfiOutputPath)\r
-    \r
+\r
     ## GenFfs() method\r
     #\r
     #   Generate FFS\r
@@ -110,18 +113,18 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #   @param  self        The object pointer\r
     #   @param  Dict        dictionary contains macro and value pair\r
     #   @retval string      Generated FFS file name\r
-    #                          \r
+    #\r
     def GenFfs(self, Dict = {}):\r
         #\r
         # Parse Inf file get Module related information\r
         #\r
         GenFdsGlobalVariable.VerboseLogger( " Begine parsing INf file : %s" %self.InfFileName)\r
-        \r
+\r
         self.InfFileName = self.InfFileName.replace('$(WORKSPACE)', '')\r
         if self.InfFileName[0] == '\\' or self.InfFileName[0] == '/' :\r
             self.InfFileName = self.InfFileName[1:]\r
-        \r
\r
+\r
+\r
         self.__InfParse__(Dict)\r
         #\r
         # Get the rule of how to generate Ffs file\r
@@ -140,12 +143,12 @@ class FfsInfStatement(FfsInfStatementClassObject):
         # For Rule has ComplexFile\r
         #\r
         elif isinstance(Rule, RuleComplexFile.RuleComplexFile):\r
-           \r
+\r
             InputSectList = self.__GenComplexFileSection__(Rule)\r
             FfsOutput = self.__GenComplexFileFfs__(Rule, InputSectList)\r
-            \r
+\r
             return FfsOutput\r
-                \r
+\r
     ## __ExtendMacro__() method\r
     #\r
     #   Replace macro with its value\r
@@ -153,14 +156,14 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #   @param  self        The object pointer\r
     #   @param  String      The string to be replaced\r
     #   @retval string      Macro replaced string\r
-    # \r
+    #\r
     def __ExtendMacro__ (self, String):\r
         MacroDict = {\r
             '$(INF_OUTPUT)'  : self.EfiOutputPath,\r
             '$(MODULE_NAME)' : self.BaseName,\r
             '$(BUILD_NUMBER)': self.BuildNum,\r
             '$(INF_VERSION)' : self.VersionString,\r
-            '$(NAMED_GUID)'  : self.ModuleGuid        \r
+            '$(NAMED_GUID)'  : self.ModuleGuid\r
         }\r
         String = GenFdsGlobalVariable.MacroExtend(String, MacroDict)\r
         return String\r
@@ -171,14 +174,14 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #\r
     #   @param  self        The object pointer\r
     #   @retval Rule        Rule object\r
-    # \r
+    #\r
     def __GetRule__ (self) :\r
         CurrentArchList = []\r
         if self.CurrentArch == None:\r
             CurrentArchList = ['common']\r
         else:\r
             CurrentArchList.append(self.CurrentArch)\r
-        \r
+\r
         for CurrentArch in CurrentArchList:\r
             RuleName = 'RULE'              + \\r
                        '.'                 + \\r
@@ -189,32 +192,33 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 RuleName = RuleName + \\r
                            '.'      + \\r
                            self.Rule.upper()\r
-                           \r
+\r
             Rule = GenFdsGlobalVariable.FdfParser.Profile.RuleDict.get(RuleName)\r
             if Rule != None:\r
                 GenFdsGlobalVariable.VerboseLogger ("Want To Find Rule Name is : " + RuleName)\r
                 return Rule\r
-            \r
+\r
         RuleName = 'RULE'      + \\r
                    '.'         + \\r
                    'COMMON'    + \\r
                    '.'         + \\r
                    self.ModuleType.upper()\r
-        \r
+\r
         if self.Rule != None:\r
             RuleName = RuleName + \\r
                        '.'      + \\r
                        self.Rule.upper()\r
-                       \r
-        GenFdsGlobalVariable.VerboseLogger ('Trying to apply common rule %s for INF %s' % (RuleName, self.InfFileName))               \r
-        \r
+\r
+        GenFdsGlobalVariable.VerboseLogger ('Trying to apply common rule %s for INF %s' % (RuleName, self.InfFileName))\r
+\r
         Rule = GenFdsGlobalVariable.FdfParser.Profile.RuleDict.get(RuleName)\r
         if Rule != None:\r
             GenFdsGlobalVariable.VerboseLogger ("Want To Find Rule Name is : " + RuleName)\r
             return Rule\r
 \r
         if Rule == None :\r
-            raise Exception ('Don\'t Find common rule %s for INF %s' % (RuleName, self.InfFileName))\r
+            EdkLogger.error("GenFds", GENFDS_ERROR, 'Don\'t Find common rule %s for INF %s' \\r
+                            % (RuleName, self.InfFileName))\r
 \r
     ## __GetPlatformArchList__() method\r
     #\r
@@ -222,26 +226,26 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #\r
     #   @param  self        The object pointer\r
     #   @retval list        Arch list\r
-    # \r
+    #\r
     def __GetPlatformArchList__(self):\r
         TargetArchList = GenFdsGlobalVariable.ArchList\r
         if len(TargetArchList) == 0:\r
             TargetArchList = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList\r
         else:\r
             TargetArchList = set(GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList) & set(TargetArchList)\r
-            \r
+\r
         InfFileKey = os.path.normpath(self.InfFileName)\r
         DscArchList = []\r
         PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'IA32']\r
         if  PlatformDataBase != None:\r
             if InfFileKey in PlatformDataBase.Modules:\r
                 DscArchList.append ('IA32')\r
-                \r
+\r
         PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'X64']\r
         if  PlatformDataBase != None:\r
             if InfFileKey in PlatformDataBase.Modules:\r
                 DscArchList.append ('X64')\r
-                \r
+\r
         PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'IPF']\r
         if PlatformDataBase != None:\r
             if InfFileKey in (PlatformDataBase.Modules):\r
@@ -252,14 +256,14 @@ class FfsInfStatement(FfsInfStatementClassObject):
             CurArchList = set (TargetArchList) & set (DscArchList)\r
         GenFdsGlobalVariable.VerboseLogger ("Valid target architecture(s) is : " + " ".join(CurArchList))\r
         return list(CurArchList)\r
-    \r
+\r
     ## GetCurrentArch() method\r
     #\r
     #   Get Arch list of the module from this INF is to be placed into flash\r
     #\r
     #   @param  self        The object pointer\r
     #   @retval list        Arch list\r
-    # \r
+    #\r
     def GetCurrentArch(self) :\r
         CurArchList = self.__GetPlatformArchList__()\r
         ArchList = []\r
@@ -273,22 +277,22 @@ class FfsInfStatement(FfsInfStatementClassObject):
                     self.TargetOverrideList.append(Target)\r
         else:\r
             ArchList = CurArchList\r
-                \r
+\r
         if len(ArchList) == 1:\r
             Arch = ArchList[0]\r
             return Arch\r
         elif len(ArchList) > 1:\r
-            raise Exception("Not able to determine ARCH for Module %s !" %self.InfFileName) \r
+            EdkLogger.error("GenFds", GENFDS_ERROR, "Not able to determine ARCH for Module %s !" % self.InfFileName)\r
         else:\r
-            raise Exception("Don't find legal ARCH in Module %s !" %self.InfFileName)\r
-    \r
+            EdkLogger.error("GenFds", GENFDS_ERROR, "Don't find legal ARCH in Module %s !" % self.InfFileName)\r
+\r
     ## __GetEFIOutPutPath__() method\r
     #\r
     #   Get the output path for generated files\r
     #\r
     #   @param  self        The object pointer\r
     #   @retval string      Path that output files from this INF go to\r
-    # \r
+    #\r
     def __GetEFIOutPutPath__(self):\r
         Arch = ''\r
         OutputPath = ''\r
@@ -298,7 +302,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         Arch = "NoneArch"\r
         if self.CurrentArch != None:\r
             Arch = self.CurrentArch\r
-        \r
+\r
         OutputPath = os.path.join(GenFdsGlobalVariable.OutputDirDict[Arch],\r
                                   Arch ,\r
                                   ModulePath,\r
@@ -307,7 +311,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                                   )\r
         OutputPath = os.path.realpath(OutputPath)\r
         return OutputPath\r
-    \r
+\r
     ## __GenSimpleFileSection__() method\r
     #\r
     #   Generate section by specified file name or a list of files with file extension\r
@@ -315,7 +319,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #   @param  self        The object pointer\r
     #   @param  Rule        The rule object used to generate section\r
     #   @retval string      File name of the generated section file\r
-    #     \r
+    #\r
     def __GenSimpleFileSection__(self, Rule):\r
         #\r
         # Prepare the parameter of GenSection\r
@@ -337,16 +341,16 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 NoStrip = Rule.KeepReloc\r
             elif self.ShadowFromInfFile != None:\r
                 NoStrip = self.ShadowFromInfFile\r
-                \r
+\r
         if FileList != [] :\r
             for File in FileList:\r
-                \r
+\r
                 SecNum = '%d' %Index\r
                 GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \\r
-                              Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum   \r
-                Index = Index + 1             \r
+                              Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum\r
+                Index = Index + 1\r
                 OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)\r
-                \r
+\r
                 if not NoStrip:\r
                     FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')\r
                     if os.path.exists(FileBeforeStrip):\r
@@ -361,7 +365,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                         )\r
                     GenFdsGlobalVariable.CallExternalTool(StripCmd, "Strip Failed !")\r
                     File = StrippedFile\r
-                    \r
+\r
                 if SectionType == 'TE':\r
                     TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')\r
                     GenTeCmd = (\r
@@ -372,7 +376,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                         )\r
                     GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
                     File = TeFile\r
-                \r
+\r
                 GenSectionCmd = (\r
                     'GenSec',\r
                     '-o', OutputFile,\r
@@ -389,7 +393,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
             GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \\r
                               Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + SecNum\r
             OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)\r
-            \r
+\r
             if not NoStrip:\r
                 FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')\r
                 shutil.copyfile(File, FileBeforeStrip)\r
@@ -402,7 +406,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                     )\r
                 GenFdsGlobalVariable.CallExternalTool(StripCmd, "Strip Failed !")\r
                 File = StrippedFile\r
-            \r
+\r
             if SectionType == 'TE':\r
                 TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')\r
                 GenTeCmd = (\r
@@ -413,7 +417,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                     )\r
                 GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
                 GenSecInputFile = TeFile\r
-            \r
+\r
             GenSectionCmd = (\r
                 'GenSec',\r
                 '-o', OutputFile,\r
@@ -427,7 +431,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
             OutputFileList.append(OutputFile)\r
 \r
         return OutputFileList\r
-    \r
+\r
     ## __GenSimpleFileFfs__() method\r
     #\r
     #   Generate FFS\r
@@ -467,7 +471,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         #\r
         GenFdsGlobalVariable.CallExternalTool(GenFfsCmd, "GenFfs Failed!")\r
         return FfsOutput\r
-    \r
+\r
     ## __GenComplexFileSection__() method\r
     #\r
     #   Generate section by sections in Rule\r
@@ -475,13 +479,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #   @param  self        The object pointer\r
     #   @param  Rule        The rule object used to generate section\r
     #   @retval string      File name of the generated section file\r
-    #  \r
+    #\r
     def __GenComplexFileSection__(self, Rule):\r
-        \r
+\r
         if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'):\r
             if Rule.KeepReloc != None:\r
                 self.KeepRelocFromRule = Rule.KeepReloc\r
-        \r
+\r
         SectFiles = tuple()\r
         Index = 1\r
         for Sect in Rule.SectionList:\r
@@ -508,9 +512,9 @@ class FfsInfStatement(FfsInfStatementClassObject):
     #   @retval string      Generated FFS file name\r
     #\r
     def __GenComplexFileFfs__(self, Rule, InputFile):\r
-        \r
+\r
         CmdParams = self.__GetGenFfsCmdParameter__(Rule)\r
-        \r
+\r
         FfsOutput = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs')\r
         GenFfsCmd = (\r
             'GenFfs',\r
@@ -539,8 +543,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
             result += ('-x',)\r
         if Rule.CheckSum != False:\r
             result += ('-s',)\r
-            \r
+\r
         if Rule.Alignment != None and Rule.Alignment != '':\r
             result += ('-a', Rule.Alignment)\r
-            \r
+\r
         return result\r
index 85ce80f..45fd097 100755 (executable)
@@ -22,19 +22,21 @@ import subprocess
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 import os\r
 from CommonDataClass.FdfClass import FvImageSectionClassObject\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
 \r
 ## generate FV image section\r
 #\r
 #\r
 class FvImageSection(FvImageSectionClassObject):\r
-    \r
+\r
     ## The constructor\r
     #\r
     #   @param  self        The object pointer\r
     #\r
     def __init__(self):\r
         FvImageSectionClassObject.__init__(self)\r
-    \r
+\r
     ## GenSection() method\r
     #\r
     #   Generate FV image section\r
@@ -47,17 +49,17 @@ class FvImageSection(FvImageSectionClassObject):
     #   @param  FfsInf      FfsInfStatement object that contains this section data\r
     #   @param  Dict        dictionary contains macro and its value\r
     #   @retval tuple       (Generated file name, section alignment)\r
-    #    \r
+    #\r
     def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):\r
-        \r
+\r
         OutputFileList = []\r
         if self.FvFileType != None:\r
             FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FvFileType, self.FvFileExtension)\r
             if IsSect :\r
                 return FileList, self.Alignment\r
-            \r
+\r
             Num = SecNum\r
-            \r
+\r
             for FileName in FileList:\r
                 OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get("FV_IMAGE"))\r
                 GenSectionCmd = (\r
@@ -79,7 +81,7 @@ class FvImageSection(FvImageSectionClassObject):
             if Fv != None:\r
                 self.Fv = Fv\r
             else:\r
-                raise Exception("FvImageSection Failed! %s NOT found in FDF" % self.FvName)\r
+                EdkLogger.error("GenFds", GENFDS_ERROR, "FvImageSection Failed! %s NOT found in FDF" % self.FvName)\r
 \r
             FvFileName = self.Fv.AddToBuffer(Buffer, MacroDict = Dict)\r
 \r
@@ -97,5 +99,5 @@ class FvImageSection(FvImageSectionClassObject):
 \r
             GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
             OutputFileList.append(OutputFile)\r
-                \r
+\r
             return OutputFileList, self.Alignment\r
index b4229ff..c2473fd 100644 (file)
@@ -113,17 +113,17 @@ def main():
                 ActivePlatform = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)\r
 \r
             if not os.path.exists(ActivePlatform)  :\r
-                raise Exception ("ActivePlatform doesn't exist!")\r
+                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist!")\r
 \r
             if ActivePlatform.find(Workspace) == -1:\r
-                raise Exception ("ActivePlatform doesn't exist in Workspace!")\r
+                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist in Workspace!")\r
 \r
             ActivePlatform = ActivePlatform.replace(Workspace, '')\r
             if len(ActivePlatform) > 0 :\r
                 if ActivePlatform[0] == '\\' or ActivePlatform[0] == '/':\r
                     ActivePlatform = ActivePlatform[1:]\r
             else:\r
-                raise Exception ("ActivePlatform doesn't exist!")\r
+                EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist!")\r
         else :\r
             EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing active platform")\r
 \r
index b5dd6a9..98b4d5e 100644 (file)
@@ -68,8 +68,8 @@ class GenFdsGlobalVariable:
             os.makedirs(GenFdsGlobalVariable.FfsDir)\r
         if ArchList != None:\r
             GenFdsGlobalVariable.ArchList = ArchList\r
-        \r
-        T_CHAR_LF = '\n'    \r
+\r
+        T_CHAR_LF = '\n'\r
         #\r
         # Create FV Address inf file\r
         #\r
@@ -84,20 +84,20 @@ class GenFdsGlobalVariable:
             if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].BsBaseAddress:\r
                 BsAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].BsBaseAddress\r
                 break\r
-        \r
+\r
         FvAddressFile.writelines("EFI_BOOT_DRIVER_BASE_ADDRESS = " + \\r
                                        BsAddress          + \\r
                                        T_CHAR_LF)\r
-                                       \r
+\r
         RtAddress = '0'\r
         for Arch in ArchList:\r
             if GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].RtBaseAddress:\r
                 RtAddress = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].RtBaseAddress\r
-                \r
+\r
         FvAddressFile.writelines("EFI_RUNTIME_DRIVER_BASE_ADDRESS = " + \\r
                                        RtAddress          + \\r
                                        T_CHAR_LF)\r
-        \r
+\r
         FvAddressFile.close()\r
 \r
     ## ReplaceWorkspaceMacro()\r
@@ -112,16 +112,16 @@ class GenFdsGlobalVariable:
         else:\r
             Str = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, String)\r
         return os.path.normpath(Str)\r
-    \r
+\r
     def CallExternalTool (cmd, errorMess):\r
-        \r
+\r
         if type(cmd) not in (tuple, list):\r
             GenFdsGlobalVariable.ErrorLogger("ToolError!  Invalid parameter type in call to CallExternalTool")\r
 \r
         if GenFdsGlobalVariable.DebugLevel != -1:\r
             cmd += ('-d', str(GenFdsGlobalVariable.DebugLevel))\r
             GenFdsGlobalVariable.InfLogger (cmd)\r
-            \r
+\r
         if GenFdsGlobalVariable.VerboseMode:\r
             cmd += ('-v',)\r
             GenFdsGlobalVariable.InfLogger (cmd)\r
@@ -142,15 +142,14 @@ class GenFdsGlobalVariable:
             GenFdsGlobalVariable.InfLogger (out)\r
             GenFdsGlobalVariable.InfLogger (error)\r
             if PopenObject.returncode != 0:\r
-                GenFdsGlobalVariable.InfLogger (errorMess)\r
-                sys.exit(1)\r
+                EdkLogger.error("GenFds", BuildToolError.COMMAND_FAILURE, errorMess)\r
 \r
     def VerboseLogger (msg):\r
         EdkLogger.verbose(msg)\r
 \r
     def InfLogger (msg):\r
         EdkLogger.info(msg)\r
-        \r
+\r
     def ErrorLogger (msg, File = None, Line = None, ExtraData = None):\r
         EdkLogger.error('GenFds', BuildToolError.GENFDS_ERROR, msg, File, Line, ExtraData)\r
 \r
@@ -165,7 +164,7 @@ class GenFdsGlobalVariable:
     def MacroExtend (Str, MacroDict = {}, Arch = 'COMMON'):\r
         if Str == None :\r
             return None\r
-        \r
+\r
         Dict = {'$(WORKSPACE)'   : GenFdsGlobalVariable.WorkSpaceDir,\r
                 '$(EDK_SOURCE)'  : GenFdsGlobalVariable.EdkSourceDir,\r
 #                '$(OUTPUT_DIRECTORY)': GenFdsGlobalVariable.OutputDirFromDsc,\r
@@ -175,23 +174,22 @@ class GenFdsGlobalVariable:
         OutputDir = GenFdsGlobalVariable.OutputDirFromDscDict[GenFdsGlobalVariable.ArchList[0]]\r
         if Arch != 'COMMON' and Arch in GenFdsGlobalVariable.ArchList:\r
             OutputDir = GenFdsGlobalVariable.OutputDirFromDscDict[Arch]\r
-            \r
+\r
         Dict['$(OUTPUT_DIRECTORY)'] = OutputDir\r
-            \r
+\r
         if MacroDict != None  and len (MacroDict) != 0:\r
             Dict.update(MacroDict)\r
 \r
         for key in Dict.keys():\r
             if Str.find(key) >= 0 :\r
                 Str = Str.replace (key, Dict[key])\r
-        \r
+\r
         if Str.find('$(ARCH)') >= 0:\r
             if len(GenFdsGlobalVariable.ArchList) == 1:\r
                 Str = Str.replace('$(ARCH)', GenFdsGlobalVariable.ArchList[0])\r
             else:\r
-                GenFdsGlobalVariable.InfLogger ("\nNo way to determine $(ARCH) for %s\n" % Str)\r
-                sys.exit(1)\r
-            \r
+                EdkLogger.error("GenFds", GENFDS_ERROR, "No way to determine $(ARCH) for %s" % Str)\r
+\r
         return Str\r
 \r
 \r
index 4278c4d..97688a1 100755 (executable)
@@ -23,19 +23,21 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable
 from CommonDataClass.FdfClass import GuidSectionClassObject\r
 from Common import ToolDefClassObject\r
 import sys\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
 \r
 ## generate GUIDed section\r
 #\r
 #\r
 class GuidSection(GuidSectionClassObject) :\r
-    \r
+\r
     ## The constructor\r
     #\r
     #   @param  self        The object pointer\r
     #\r
     def __init__(self):\r
         GuidSectionClassObject.__init__(self)\r
-    \r
+\r
     ## GenSection() method\r
     #\r
     #   Generate GUIDed section\r
@@ -48,18 +50,18 @@ class GuidSection(GuidSectionClassObject) :
     #   @param  FfsInf      FfsInfStatement object that contains this section data\r
     #   @param  Dict        dictionary contains macro and its value\r
     #   @retval tuple       (Generated file name, section alignment)\r
-    #    \r
+    #\r
     def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):\r
         #\r
         # Generate all section\r
         #\r
         self.KeyStringList = KeyStringList\r
-        \r
+\r
         if FfsInf != None:\r
             self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)\r
             self.NameGuid = FfsInf.__ExtendMacro__(self.NameGuid)\r
             self.SectionType = FfsInf.__ExtendMacro__(self.SectionType)\r
-            \r
+\r
         SectFile = tuple()\r
         Index = 0\r
         for Sect in self.SectionList:\r
@@ -69,7 +71,7 @@ class GuidSection(GuidSectionClassObject) :
             if ReturnSectList != []:\r
                 for file in ReturnSectList:\r
                     SectFile += (file,)\r
-                       \r
+\r
 \r
         OutputFile = OutputPath + \\r
                      os.sep     + \\r
@@ -78,7 +80,7 @@ class GuidSection(GuidSectionClassObject) :
                      SecNum     + \\r
                      Ffs.SectionSuffix['GUIDED']\r
         OutputFile = os.path.normpath(OutputFile)\r
-        \r
+\r
         ExternalTool = None\r
         if self.NameGuid != None:\r
             ExternalTool = self.__FindExtendTool__()\r
@@ -93,15 +95,14 @@ class GuidSection(GuidSectionClassObject) :
                  '-o', OutputFile,\r
                  '-s', Section.Section.SectionType[self.SectionType],\r
                 ) + SectFile\r
-                             \r
+\r
             GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
             OutputFileList = []\r
             OutputFileList.append(OutputFile)\r
             return OutputFileList, self.Alignment\r
         #or GUID not in External Tool List\r
         elif ExternalTool == None:\r
-            print "No tool found with GUID %s" % self.NameGuid\r
-            sys.exit(1)\r
+            EdkLogger.error("GenFds", GENFDS_ERROR, "No tool found with GUID %s" % self.NameGuid)\r
         else:\r
             #\r
             # Call GenSection with DUMMY section type.\r
@@ -110,7 +111,7 @@ class GuidSection(GuidSectionClassObject) :
                 'GenSec',\r
                 '-o', OutputFile,\r
                 ) + SectFile\r
-        \r
+\r
             GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
             #\r
             # Use external tool process the Output\r
@@ -123,7 +124,7 @@ class GuidSection(GuidSectionClassObject) :
                        SecNum     + \\r
                        '.tmp'\r
             TempFile = os.path.normpath(TempFile)\r
-            \r
+\r
             ExternalToolCmd = (\r
                 ExternalTool,\r
                 '-e',\r
@@ -156,13 +157,13 @@ class GuidSection(GuidSectionClassObject) :
             OutputFileList = []\r
             OutputFileList.append(OutputFile)\r
             return OutputFileList, self.Alignment\r
-    \r
+\r
     ## __FindExtendTool()\r
     #\r
     #    Find location of tools to process section data\r
     #\r
     #   @param  self        The object pointer\r
-    #    \r
+    #\r
     def __FindExtendTool__(self):\r
         Tool = None\r
         if self.KeyStringList == None or self.KeyStringList == []:\r
@@ -187,4 +188,4 @@ class GuidSection(GuidSectionClassObject) :
         return Tool\r
 \r
 \r
-                \r
+\r
index 8e31402..0980b58 100644 (file)
@@ -20,20 +20,22 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable
 import StringIO\r
 from CommonDataClass.FdfClass import RegionClassObject\r
 import os\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
 \r
 \r
 ## generate Region\r
 #\r
 #\r
 class Region(RegionClassObject):\r
-    \r
+\r
     ## The constructor\r
     #\r
     #   @param  self        The object pointer\r
     #\r
     def __init__(self):\r
         RegionClassObject.__init__(self)\r
-        \r
+\r
 \r
     ## AddToBuffer()\r
     #\r
@@ -55,7 +57,7 @@ class Region(RegionClassObject):
         GenFdsGlobalVariable.InfLogger('Generate Region at Offset 0x%X' % self.Offset)\r
         GenFdsGlobalVariable.InfLogger("   Region Size = 0x%X" %Size)\r
         GenFdsGlobalVariable.SharpCounter = 0\r
-        \r
+\r
         if self.RegionType == 'FV':\r
             #\r
             # Get Fv from FvDict\r
@@ -63,33 +65,35 @@ class Region(RegionClassObject):
             FvBuffer = StringIO.StringIO('')\r
             RegionBlockSize = self.BlockSizeOfRegion(BlockSizeList)\r
             RegionBlockNum = self.BlockNumOfRegion(RegionBlockSize)\r
-            \r
+\r
             self.FvAddress = int(BaseAddress, 16) + self.Offset\r
             FvBaseAddress = '0x%X' %self.FvAddress\r
-                    \r
+\r
             for RegionData in self.RegionDataList:\r
-                \r
+\r
                 if RegionData.endswith(".fv"):\r
                     RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)\r
                     GenFdsGlobalVariable.InfLogger('   Region FV File Name = .fv : %s'%RegionData)\r
                     if RegionData[1] != ':' :\r
                         RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
                     if not os.path.exists(RegionData):\r
-                        raise Exception ( 'File: %s dont exist !' %RegionData)\r
-                    \r
+                        EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
+\r
                     BinFile = open (RegionData, 'r+b')\r
                     FvBuffer.write(BinFile.read())\r
                     if FvBuffer.len > Size:\r
-                        raise Exception ("Size of FV File (%s) is larger than Region Size 0x%X" % (RegionData, Size))\r
+                        EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                        "Size of FV File (%s) is larger than Region Size 0x%X" \\r
+                                        % (RegionData, Size))\r
                     break\r
-                \r
+\r
                 if RegionData.upper() in FvBinDict.keys():\r
                     continue\r
-                \r
+\r
                 FvObj = None\r
                 if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
                     FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())\r
-                        \r
+\r
                 if FvObj != None :\r
                     GenFdsGlobalVariable.InfLogger('   Region Name = FV')\r
                     #\r
@@ -105,22 +109,24 @@ class Region(RegionClassObject):
                     self.FvAddress = self.FvAddress + FvBuffer.len\r
                     FvAlignValue = self.GetFvAlignValue(FvObj.FvAlignment)\r
                     if self.FvAddress % FvAlignValue != 0:\r
-                        raise Exception ("FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment))                    \r
+                        EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                        "FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment))\r
                     FvBaseAddress = '0x%X' %self.FvAddress\r
                     FileName = FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict)\r
-                    \r
+\r
                     if FvBuffer.len > Size:\r
-                        raise Exception ("Size of FV (%s) is larger than Region Size 0x%X" % (RegionData, Size))\r
+                        EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                        "Size of FV (%s) is larger than Region Size 0x%X" % (RegionData, Size))\r
                 else:\r
-                    raise Exception ("FV (%s) is NOT described in FDF file!" % (RegionData))\r
+                    EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (RegionData))\r
+\r
 \r
-            \r
             if FvBuffer.len > 0:\r
                 Buffer.write(FvBuffer.getvalue())\r
             else:\r
                 BinFile = open (FileName, 'rb')\r
                 Buffer.write(BinFile.read())\r
-                \r
+\r
             FvBuffer.close()\r
 \r
         if self.RegionType == 'FILE':\r
@@ -131,12 +137,13 @@ class Region(RegionClassObject):
                 if RegionData[1] != ':' :\r
                     RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
                 if not os.path.exists(RegionData):\r
-                    raise Exception ( 'File: %s dont exist !' %RegionData)\r
-                \r
+                    EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)\r
+\r
                 BinFile = open (RegionData, 'r+b')\r
                 FvBuffer.write(BinFile.read())\r
                 if FvBuffer.len > Size :\r
-                    raise Exception ("Size of File (%s) large than Region Size ", RegionData)\r
+                    EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                    "Size of File (%s) large than Region Size " % RegionData)\r
 \r
             #\r
             # If File contents less than region size, append "0xff" after it\r
@@ -149,7 +156,7 @@ class Region(RegionClassObject):
                         FvBuffer.write(pack('B', int('0x00', 16)))\r
             Buffer.write(FvBuffer.getvalue())\r
             FvBuffer.close()\r
-            \r
+\r
         if self.RegionType == 'DATA' :\r
             GenFdsGlobalVariable.InfLogger('   Region Name = DATA')\r
             DataSize = 0\r
@@ -157,7 +164,7 @@ class Region(RegionClassObject):
                 Data = RegionData.split(',')\r
                 DataSize = DataSize + len(Data)\r
                 if DataSize > Size:\r
-                   raise Exception ("Size of DATA large than Region Size ")\r
+                   EdkLogger.error("GenFds", GENFDS_ERROR, "Size of DATA large than Region Size ")\r
                 else:\r
                     for item in Data :\r
                         Buffer.write(pack('B', int(item, 16)))\r
@@ -167,7 +174,7 @@ class Region(RegionClassObject):
                 else:\r
                     Buffer.write(pack(str(Size - DataSize)+'B', *(int('0x00', 16) for i in range(Size - DataSize))))\r
 \r
-                \r
+\r
         if self.RegionType == None:\r
             GenFdsGlobalVariable.InfLogger('   Region Name = None')\r
             if (ErasePolarity == '1') :\r
@@ -190,7 +197,7 @@ class Region(RegionClassObject):
             Str = Str[:-1]\r
         else:\r
             pass\r
-        \r
+\r
         AlignValue = int(Str)*Granu\r
         return AlignValue\r
     ## BlockSizeOfRegion()\r
@@ -208,12 +215,14 @@ class Region(RegionClassObject):
 \r
             if self.Offset < Offset :\r
                 if Offset - self.Offset < self.Size:\r
-                    raise Exception ("Region at Offset 0x%X can NOT fit into Block array with BlockSize %X", (self.Offset, item[0]))\r
+                    EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                    "Region at Offset 0x%X can NOT fit into Block array with BlockSize %X" \\r
+                                    % (self.Offset, item[0]))\r
                 BlockSize = item[0]\r
                 GenFdsGlobalVariable.VerboseLogger ("BlockSize = %X" %BlockSize)\r
                 return BlockSize\r
         return BlockSize\r
-    \r
+\r
     ## BlockNumOfRegion()\r
     #\r
     #   @param  BlockSize            block size of region\r
@@ -221,8 +230,8 @@ class Region(RegionClassObject):
     #\r
     def BlockNumOfRegion (self, BlockSize):\r
         if BlockSize == 0 :\r
-            raise Exception ("Region: %s doesn't in Fd address scope !" %self.Offset)\r
+            EdkLogger.error("GenFds", GENFDS_ERROR, "Region: %s doesn't in Fd address scope !" % self.Offset)\r
         BlockNum = self.Size / BlockSize\r
         GenFdsGlobalVariable.VerboseLogger ("BlockNum = 0x%X" %BlockNum)\r
         return BlockNum\r
-                \r
+\r
index a74ff9e..166ccf0 100755 (executable)
@@ -18,6 +18,8 @@
 from CommonDataClass.FdfClass import SectionClassObject\r
 from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 import os\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
 \r
 ## section base class\r
 #\r
@@ -68,19 +70,19 @@ class Section (SectionClassObject):
         'SEC_COMPAT16'  : '.sec',\r
         'SEC_BIN'       : '.sec'\r
     }\r
-    \r
+\r
     ToolGuid = {\r
         '0xa31280ad-0x481e-0x41b6-0x95e8-0x127f-0x4c984779' : 'TianoCompress',\r
         '0xee4e5898-0x3914-0x4259-0x9d6e-0xdc7b-0xd79403cf' : 'LzmaCompress'\r
     }\r
-    \r
+\r
     ## The constructor\r
     #\r
     #   @param  self        The object pointer\r
     #\r
     def __init__(self):\r
         SectionClassObject.__init__(self)\r
-        \r
+\r
     ## GenSection() method\r
     #\r
     #   virtual function\r
@@ -112,7 +114,7 @@ class Section (SectionClassObject):
             IsSect = True\r
         else :\r
             IsSect = False\r
-            \r
+\r
         if FileExtension != None:\r
             Suffix = FileExtension\r
         elif IsSect :\r
@@ -120,8 +122,8 @@ class Section (SectionClassObject):
         else:\r
             Suffix = Section.BinFileType.get(FileType)\r
         if FfsInf == None:\r
-            raise Exception ('Inf File does not exist!')\r
-        \r
+            EdkLogger.error("GenFds", GENFDS_ERROR, 'Inf File does not exist!')\r
+\r
         FileList = []\r
         if FileType != None:\r
             for File in FfsInf.BinFileList:\r
@@ -135,12 +137,12 @@ class Section (SectionClassObject):
                         GenFdsGlobalVariable.InfLogger ("\nFile Type \'%s\' of File %s in %s is not same with file type \'%s\' from Rule in FDF" %(File.FileType, File.BinaryFile, FfsInf.InfFileName, FileType))\r
                 else:\r
                         GenFdsGlobalVariable.InfLogger ("\nCurrent ARCH \'%s\' of File %s is not in the Support Arch Scope of %s specified by INF %s in FDF" %(FfsInf.CurrentArch, File.BinaryFile, File.SupArchList, FfsInf.InfFileName))\r
-            \r
+\r
         if os.path.exists(FfsInf.EfiOutputPath):\r
             for FileName in os.listdir(FfsInf.EfiOutputPath):\r
                 Name, Ext = os.path.splitext(FileName)\r
                 if Ext == Suffix:\r
                    FileList.append(os.path.join(FfsInf.EfiOutputPath, FileName))\r
-                   \r
-        return FileList, IsSect \r
+\r
+        return FileList, IsSect\r
     GetFileList = staticmethod(GetFileList)\r