Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1. Fixed unknown error report when no corresponding table in database…
… for a file

2. Added more detailed error information for format error

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1289 7335b38e-4728-0410-8992-fb3ffe349368
  • Loading branch information
jwang36 committed Jul 25, 2008
1 parent a4f4e72 commit 7d650cd
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 13 deletions.
62 changes: 51 additions & 11 deletions Source/Python/Workspace/MetaFileParser.py
Expand Up @@ -22,6 +22,7 @@
from Common.DataType import *
from Common.String import *
from Common.Misc import Blist
from Common.Misc import GuidStructureStringToGuidString

## Base class of parser
#
Expand Down Expand Up @@ -349,7 +350,8 @@ def _PcdParser(self):
self._ValueList[2] = TokenList[1]
if self._ValueList[0] == '' or self._ValueList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<PcdCName>)",
File=self._FilePath, Line=self._LineIndex+1)

## [depex] section parser
def _DepexParser(self):
Expand Down Expand Up @@ -691,10 +693,12 @@ def _PcdParser(self):
self._ValueList[2] = TokenList[1]
if self._ValueList[0] == '' or self._ValueList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
File=self._FilePath, Line=self._LineIndex+1)
if self._ValueList[2] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
File=self._FilePath, Line=self._LineIndex+1)

## [components] section parser
def _ComponentParser(self):
Expand All @@ -710,13 +714,16 @@ def _LibraryClassParser(self):
TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
if len(TokenList) < 2:
EdkLogger.error('Parser', FORMAT_INVALID, "No library class or instance specified",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
File=self._FilePath, Line=self._LineIndex+1)
if TokenList[0] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No library class specified",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
File=self._FilePath, Line=self._LineIndex+1)
if TokenList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No library instance specified",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
File=self._FilePath, Line=self._LineIndex+1)
self._ValueList[0:len(TokenList)] = TokenList
if len(self._Macros) > 0:
self._ValueList[1] = NormPath(self._ValueList[1], self._Macros)
Expand Down Expand Up @@ -832,13 +839,21 @@ def _GuidParser(self):
TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
if len(TokenList) < 2:
EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name or value specified",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + " (<CName> = <GuidValueInCFormat>)",
File=self._FilePath, Line=self._LineIndex+1)
if TokenList[0] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No GUID name specified",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + " (<CName> = <GuidValueInCFormat>)",
File=self._FilePath, Line=self._LineIndex+1)
if TokenList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No GUID value specified",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + " (<CName> = <GuidValueInCFormat>)",
File=self._FilePath, Line=self._LineIndex+1)
if TokenList[1][0] != '{' or TokenList[1][-1] != '}' or GuidStructureStringToGuidString(TokenList[1]) == '':
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid GUID value format",
ExtraData=self._CurrentLine + \
" (<CName> = <GuidValueInCFormat:{8,4,4,{2,2,2,2,2,2,2,2}}>)",
File=self._FilePath, Line=self._LineIndex+1)
self._ValueList[0] = TokenList[0]
self._ValueList[1] = TokenList[1]

Expand All @@ -855,10 +870,35 @@ def _PcdParser(self):
self._ValueList[0:1] = GetSplitValueList(TokenList[0], TAB_SPLIT)
if self._ValueList[0] == '' or self._ValueList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + \
" (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
File=self._FilePath, Line=self._LineIndex+1)
if len(TokenList) < 2 or TokenList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No PCD Datum information given",
ExtraData=self._CurrentLine, File=self._FilePath, Line=self._LineIndex+1)
ExtraData=self._CurrentLine + \
" (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
File=self._FilePath, Line=self._LineIndex+1)
ValueList = GetSplitValueList(TokenList[1])
if len(ValueList) != 3:
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information given",
ExtraData=self._CurrentLine + \
" (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
File=self._FilePath, Line=self._LineIndex+1)
if ValueList[0] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "Missing DefaultValue in PCD Datum information",
ExtraData=self._CurrentLine + \
" (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
File=self._FilePath, Line=self._LineIndex+1)
if ValueList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "Missing DatumType in PCD Datum information",
ExtraData=self._CurrentLine + \
" (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
File=self._FilePath, Line=self._LineIndex+1)
if ValueList[2] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "Missing Token in PCD Datum information",
ExtraData=self._CurrentLine + \
" (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
File=self._FilePath, Line=self._LineIndex+1)
self._ValueList[2] = TokenList[1]

_SectionParser = {
Expand Down
7 changes: 5 additions & 2 deletions Source/Python/Workspace/WorkspaceDatabase.py
Expand Up @@ -1939,8 +1939,11 @@ def SetTimeStamp(self, FileId, TimeStamp):

## Check if a table integrity flag exists or not
def CheckIntegrity(self, TableName):
Result = self.Cur.execute("select min(ID) from %s" % (TableName)).fetchall()
if Result[0][0] != -1:
try:
Result = self.Cur.execute("select min(ID) from %s" % (TableName)).fetchall()
if Result[0][0] != -1:
return False
except:
return False
return True

Expand Down

0 comments on commit 7d650cd

Please sign in to comment.