summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Feng <bob.c.feng@intel.com>2015-06-23 08:45:06 +0000
committerbobfeng <bobfeng@Edk2>2015-06-23 08:45:06 +0000
commit901fd8223893d5cdb68ef84f265d23f4180a33bc (patch)
treeee3f677f92f38186db4d116b35aca477e6a80e17
parent581c6c624db03c039656f334c4282e9a7142afe9 (diff)
downloadedk2-platforms-901fd8223893d5cdb68ef84f265d23f4180a33bc.tar.xz
BaseTools/Build: Add error report for incorrect syntax in DEC file.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: "Bob Feng" <bob.c.feng@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17685 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileTable.py44
1 files changed, 30 insertions, 14 deletions
diff --git a/BaseTools/Source/Python/Workspace/MetaFileTable.py b/BaseTools/Source/Python/Workspace/MetaFileTable.py
index 89a12cd228..449e56efcc 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileTable.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileTable.py
@@ -17,6 +17,7 @@
import uuid
import Common.EdkLogger as EdkLogger
+from Common.BuildToolError import FORMAT_INVALID
from MetaDataTable import Table, TableFile
from MetaDataTable import ConvertToSqlString
@@ -226,24 +227,39 @@ class PackageTable(MetaFileTable):
return self.Exec(SqlCommand)
def GetValidExpression(self, TokenSpaceGuid, PcdCName):
- SqlCommand = "select Value1 from %s WHERE Value2='%s' and Value3='%s'" % (self.Table, TokenSpaceGuid, PcdCName)
+ SqlCommand = "select Value1,StartLine from %s WHERE Value2='%s' and Value3='%s'" % (self.Table, TokenSpaceGuid, PcdCName)
self.Cur.execute(SqlCommand)
validateranges = []
validlists = []
expressions = []
- for row in self.Cur:
- comment = row[0]
- comment = comment.strip("#")
- comment = comment.strip()
- if comment.startswith("@ValidRange"):
- comment = comment.replace("@ValidRange", "", 1)
- validateranges.append(comment.split("|")[1].strip())
- if comment.startswith("@ValidList"):
- comment = comment.replace("@ValidList", "", 1)
- validlists.append(comment.split("|")[1].strip())
- if comment.startswith("@Expression"):
- comment = comment.replace("@Expression", "", 1)
- expressions.append(comment.split("|")[1].strip())
+ try:
+ for row in self.Cur:
+ comment = row[0]
+
+ LineNum = row[1]
+ comment = comment.strip("#")
+ comment = comment.strip()
+ oricomment = comment
+ if comment.startswith("@ValidRange"):
+ comment = comment.replace("@ValidRange", "", 1)
+ validateranges.append(comment.split("|")[1].strip())
+ if comment.startswith("@ValidList"):
+ comment = comment.replace("@ValidList", "", 1)
+ validlists.append(comment.split("|")[1].strip())
+ if comment.startswith("@Expression"):
+ comment = comment.replace("@Expression", "", 1)
+ expressions.append(comment.split("|")[1].strip())
+ except Exception, Exc:
+ ValidType = ""
+ if oricomment.startswith("@ValidRange"):
+ ValidType = "@ValidRange"
+ if oricomment.startswith("@ValidList"):
+ ValidType = "@ValidList"
+ if oricomment.startswith("@Expression"):
+ ValidType = "@Expression"
+ EdkLogger.error('Parser', FORMAT_INVALID, "The syntax for %s of PCD %s.%s is incorrect" % (ValidType,TokenSpaceGuid, PcdCName),
+ ExtraData=oricomment,File=self.MetaFile, Line=LineNum)
+ return set(), set(), set()
return set(validateranges), set(validlists), set(expressions)
## Python class representation of table storing platform data
class PlatformTable(MetaFileTable):