summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BaseTools/Source/Python/Ecc/Check.py161
-rw-r--r--BaseTools/Source/Python/Ecc/Configuration.py11
-rw-r--r--BaseTools/Source/Python/Ecc/Ecc.py8
-rw-r--r--BaseTools/Source/Python/Ecc/EccGlobalData.py1
-rw-r--r--BaseTools/Source/Python/Ecc/EccToolError.py10
-rw-r--r--BaseTools/Source/Python/Ecc/MetaDataParser.py11
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py2
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py24
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py8
-rw-r--r--BaseTools/Source/Python/Ecc/config.ini4
10 files changed, 228 insertions, 12 deletions
diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 4e7ffe7aca..11a06ecc02 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -13,11 +13,12 @@
import Common.LongFilePathOs as os
import re
from CommonDataClass.DataClass import *
-from Common.DataType import SUP_MODULE_LIST_STRING, TAB_VALUE_SPLIT
+import Common.DataType as DT
from EccToolError import *
from MetaDataParser import ParseHeaderCommentSection
import EccGlobalData
import c
+from Common.LongFilePathSupport import OpenLongFilePath as open
## Check
#
@@ -40,9 +41,23 @@ class Check(object):
self.FunctionLayoutCheck()
self.NamingConventionCheck()
+ # Check UNI files
+ def UniCheck(self):
+ if EccGlobalData.gConfig.GeneralCheckUni == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Checking whether UNI file is UTF-16 ...")
+ SqlCommand = """select ID, FullPath, ExtName from File where ExtName like 'uni'"""
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+ for Record in RecordSet:
+ File = Record[1]
+ FileIn = open(File, 'rb').read(2)
+ if FileIn != '\xff\xfe':
+ OtherMsg = "File %s is not a valid UTF-16 UNI file" % Record[1]
+ EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_UNI, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0])
+
# General Checking
def GeneralCheck(self):
self.GeneralCheckNonAcsii()
+ self.UniCheck()
# Check whether file has non ACSII char
def GeneralCheckNonAcsii(self):
@@ -554,6 +569,10 @@ class Check(object):
self.MetaDataFileCheckModuleFileNoUse()
self.MetaDataFileCheckPcdType()
self.MetaDataFileCheckModuleFileGuidDuplication()
+ self.MetaDataFileCheckModuleFileGuidFormat()
+ self.MetaDataFileCheckModuleFileProtocolFormat()
+ self.MetaDataFileCheckModuleFilePpiFormat()
+ self.MetaDataFileCheckModuleFilePcdFormat()
# Check whether each file defined in meta-data exists
def MetaDataFileCheckPathName(self):
@@ -583,7 +602,7 @@ class Check(object):
List = Record[1].split('|', 1)
SupModType = []
if len(List) == 1:
- SupModType = SUP_MODULE_LIST_STRING.split(TAB_VALUE_SPLIT)
+ SupModType = DT.SUP_MODULE_LIST_STRING.split(DT.TAB_VALUE_SPLIT)
elif len(List) == 2:
SupModType = List[1].split()
@@ -821,7 +840,7 @@ class Check(object):
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
for Record in RecordSet:
Path = Record[1]
- Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '').replace('\AARCH64', '')
+ Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '')
if Path in InfPathList:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg="The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable='File', BelongsToItem=Record[0])
@@ -898,6 +917,142 @@ class Check(object):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ # Check Guid Format in module INF
+ def MetaDataFileCheckModuleFileGuidFormat(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Check Guid Format in module INF ...")
+ Table = EccGlobalData.gDb.TblInf
+ SqlCommand = """
+ select ID, Value1, Usage, BelongsToFile from %s where Model = %s group by ID
+ """ % (Table.Table, MODEL_EFI_GUID)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ Value1 = Record[1]
+ Value2 = Record[2]
+ GuidCommentList = []
+ InfPath = self.GetInfFilePathFromID(Record[3])
+ Msg = "The GUID format of %s in INF file [%s] does not follow rules" % (Value1, InfPath)
+ if Value2.startswith(DT.TAB_SPECIAL_COMMENT):
+ GuidCommentList = Value2[2:].split(DT.TAB_SPECIAL_COMMENT)
+ if GuidCommentList[0].strip().startswith(DT.TAB_INF_USAGE_UNDEFINED):
+ continue
+ elif len(GuidCommentList) > 1:
+ if not GuidCommentList[0].strip().startswith((DT.TAB_INF_USAGE_PRO,
+ DT.TAB_INF_USAGE_SOME_PRO,
+ DT.TAB_INF_USAGE_CON,
+ DT.TAB_INF_USAGE_SOME_CON)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_GUID, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ if not (GuidCommentList[1].strip()).startswith(DT.TAB_INF_GUIDTYPE_VAR) and \
+ not GuidCommentList[1].strip().startswith((DT.TAB_INF_GUIDTYPE_EVENT,
+ DT.TAB_INF_GUIDTYPE_HII,
+ DT.TAB_INF_GUIDTYPE_FILE,
+ DT.TAB_INF_GUIDTYPE_HOB,
+ DT.TAB_INF_GUIDTYPE_FV,
+ DT.TAB_INF_GUIDTYPE_ST,
+ DT.TAB_INF_GUIDTYPE_TSG,
+ DT.TAB_INF_GUIDTYPE_GUID,
+ DT.TAB_INF_GUIDTYPE_PROTOCOL,
+ DT.TAB_INF_GUIDTYPE_PPI,
+ DT.TAB_INF_USAGE_UNDEFINED)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_GUID, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ else:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_GUID, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ else:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_GUID, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
+ # Check Protocol Format in module INF
+ def MetaDataFileCheckModuleFileProtocolFormat(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Check Protocol Format in module INF ...")
+ Table = EccGlobalData.gDb.TblInf
+ SqlCommand = """
+ select ID, Value1, Usage, BelongsToFile from %s where Model = %s group by ID
+ """ % (Table.Table, MODEL_EFI_PROTOCOL)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ Value1 = Record[1]
+ Value2 = Record[2]
+ GuidCommentList = []
+ InfPath = self.GetInfFilePathFromID(Record[3])
+ Msg = "The Protocol format of %s in INF file [%s] does not follow rules" % (Value1, InfPath)
+ if Value2.startswith(DT.TAB_SPECIAL_COMMENT):
+ GuidCommentList = Value2[2:].split(DT.TAB_SPECIAL_COMMENT)
+ if len(GuidCommentList) >= 1:
+ if not GuidCommentList[0].strip().startswith((DT.TAB_INF_USAGE_PRO,
+ DT.TAB_INF_USAGE_SOME_PRO,
+ DT.TAB_INF_USAGE_CON,
+ DT.TAB_INF_USAGE_SOME_CON,
+ DT.TAB_INF_USAGE_NOTIFY,
+ DT.TAB_INF_USAGE_TO_START,
+ DT.TAB_INF_USAGE_BY_START,
+ DT.TAB_INF_USAGE_UNDEFINED)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ else:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
+
+ # Check Ppi Format in module INF
+ def MetaDataFileCheckModuleFilePpiFormat(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Check Ppi Format in module INF ...")
+ Table = EccGlobalData.gDb.TblInf
+ SqlCommand = """
+ select ID, Value1, Usage, BelongsToFile from %s where Model = %s group by ID
+ """ % (Table.Table, MODEL_EFI_PPI)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ Value1 = Record[1]
+ Value2 = Record[2]
+ GuidCommentList = []
+ InfPath = self.GetInfFilePathFromID(Record[3])
+ Msg = "The Ppi format of %s in INF file [%s] does not follow rules" % (Value1, InfPath)
+ if Value2.startswith(DT.TAB_SPECIAL_COMMENT):
+ GuidCommentList = Value2[2:].split(DT.TAB_SPECIAL_COMMENT)
+ if len(GuidCommentList) >= 1:
+ if not GuidCommentList[0].strip().startswith((DT.TAB_INF_USAGE_PRO,
+ DT.TAB_INF_USAGE_SOME_PRO,
+ DT.TAB_INF_USAGE_CON,
+ DT.TAB_INF_USAGE_SOME_CON,
+ DT.TAB_INF_USAGE_NOTIFY,
+ DT.TAB_INF_USAGE_UNDEFINED)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PPI, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ else:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PPI, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
+ # Check Pcd Format in module INF
+ def MetaDataFileCheckModuleFilePcdFormat(self):
+ if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
+ EdkLogger.quiet("Check Pcd Format in module INF ...")
+ Table = EccGlobalData.gDb.TblInf
+ SqlCommand = """
+ select ID, Model, Value1, Value2, Usage, BelongsToFile from %s where Model >= %s and Model < %s group by ID
+ """ % (Table.Table, MODEL_PCD, MODEL_META_DATA_HEADER)
+ RecordSet = Table.Exec(SqlCommand)
+ for Record in RecordSet:
+ Model = Record[1]
+ PcdName = Record[2] + '.' + Record[3]
+ Usage = Record[4]
+ PcdCommentList = []
+ InfPath = self.GetInfFilePathFromID(Record[5])
+ Msg = "The Pcd format of %s in INF file [%s] does not follow rules" % (PcdName, InfPath)
+ if Usage.startswith(DT.TAB_SPECIAL_COMMENT):
+ PcdCommentList = Usage[2:].split(DT.TAB_SPECIAL_COMMENT)
+ if len(PcdCommentList) >= 1:
+ if Model in [MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_FEATURE_FLAG] \
+ and not PcdCommentList[0].strip().startswith((DT.TAB_INF_USAGE_SOME_PRO,
+ DT.TAB_INF_USAGE_CON,
+ DT.TAB_INF_USAGE_UNDEFINED)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PCD, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ if Model in [MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC, MODEL_PCD_DYNAMIC_EX] \
+ and not PcdCommentList[0].strip().startswith((DT.TAB_INF_USAGE_PRO,
+ DT.TAB_INF_USAGE_SOME_PRO,
+ DT.TAB_INF_USAGE_CON,
+ DT.TAB_INF_USAGE_SOME_CON,
+ DT.TAB_INF_USAGE_UNDEFINED)):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PCD, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+ else:
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_FORMAT_PCD, OtherMsg=Msg, BelongsToTable=Table.Table, BelongsToItem=Record[0])
+
# Check whether these is duplicate Guid/Ppi/Protocol name
def CheckGuidProtocolPpi(self, ErrorID, Model, Table):
Name = ''
diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py
index 72bfbc709b..3e54438e3e 100644
--- a/BaseTools/Source/Python/Ecc/Configuration.py
+++ b/BaseTools/Source/Python/Ecc/Configuration.py
@@ -80,6 +80,8 @@ class Configuration(object):
self.GeneralCheckFileExistence = 1
# Check whether file has non ACSII char
self.GeneralCheckNonAcsii = 1
+ # Check whether UNI file is valid
+ self.GeneralCheckUni = 1
## Space Checking
self.SpaceCheckAll = 1
@@ -236,6 +238,15 @@ class Configuration(object):
# Check whether there are FILE_GUID duplication among different INF files
self.MetaDataFileCheckModuleFileGuidDuplication = 1
+ # Check Guid Format in INF files
+ self.MetaDataFileCheckModuleFileGuidFormat = 1
+ # Check Protocol Format in INF files
+ self.MetaDataFileCheckModuleFileProtocolFormat = 1
+ # Check Ppi Format in INF files
+ self.MetaDataFileCheckModuleFilePpiFormat = 1
+ # Check Pcd Format in INF files
+ self.MetaDataFileCheckModuleFilePcdFormat = 1
+
#
# The check points in this section are reserved
#
diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/Ecc.py
index 72f22d5b22..cb47bc2e53 100644
--- a/BaseTools/Source/Python/Ecc/Ecc.py
+++ b/BaseTools/Source/Python/Ecc/Ecc.py
@@ -180,6 +180,7 @@ class Ecc(object):
EccGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EccGlobalData.gDb)
EccGlobalData.gCFileList = GetFileList(MODEL_FILE_C, EccGlobalData.gDb)
EccGlobalData.gHFileList = GetFileList(MODEL_FILE_H, EccGlobalData.gDb)
+ EccGlobalData.gUFileList = GetFileList(MODEL_FILE_UNI, EccGlobalData.gDb)
## BuildMetaDataFileDatabase
#
@@ -246,6 +247,13 @@ class Ecc(object):
Op.write("%s\r" % Filename)
Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
continue
+ if len(File) > 4 and File[-4:].upper() == ".UNI":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ EccGlobalData.gDb.TblFile.InsertFile(Filename, MODEL_FILE_UNI)
+ continue
+
Op.close()
# Commit to database
diff --git a/BaseTools/Source/Python/Ecc/EccGlobalData.py b/BaseTools/Source/Python/Ecc/EccGlobalData.py
index a20d6ead48..c0b00a4265 100644
--- a/BaseTools/Source/Python/Ecc/EccGlobalData.py
+++ b/BaseTools/Source/Python/Ecc/EccGlobalData.py
@@ -23,4 +23,5 @@ gDb = None
gIdentifierTableList = []
gCFileList = []
gHFileList = []
+gUFileList = []
gException = None \ No newline at end of file
diff --git a/BaseTools/Source/Python/Ecc/EccToolError.py b/BaseTools/Source/Python/Ecc/EccToolError.py
index 4039f57bc6..3895193d8c 100644
--- a/BaseTools/Source/Python/Ecc/EccToolError.py
+++ b/BaseTools/Source/Python/Ecc/EccToolError.py
@@ -20,6 +20,7 @@ ERROR_GENERAL_CHECK_NO_PROGMA = 1005
ERROR_GENERAL_CHECK_CARRIAGE_RETURN = 1006
ERROR_GENERAL_CHECK_FILE_EXISTENCE = 1007
ERROR_GENERAL_CHECK_NON_ACSII = 1008
+ERROR_GENERAL_CHECK_UNI = 1009
ERROR_SPACE_CHECK_ALL = 2000
@@ -95,6 +96,10 @@ ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE = 10014
ERROR_META_DATA_FILE_CHECK_PCD_TYPE = 10015
ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION = 10016
ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE = 10017
+ERROR_META_DATA_FILE_CHECK_FORMAT_GUID = 10018
+ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL = 10019
+ERROR_META_DATA_FILE_CHECK_FORMAT_PPI = 10020
+ERROR_META_DATA_FILE_CHECK_FORMAT_PCD = 10021
ERROR_SPELLING_CHECK_ALL = 11000
@@ -108,6 +113,7 @@ gEccErrorMessage = {
ERROR_GENERAL_CHECK_CARRIAGE_RETURN : "There should be a carriage return at the end of the file",
ERROR_GENERAL_CHECK_FILE_EXISTENCE : "File not found",
ERROR_GENERAL_CHECK_NON_ACSII : "File has invalid Non-ACSII char",
+ ERROR_GENERAL_CHECK_UNI : "File is not a valid UTF-16 UNI file",
ERROR_SPACE_CHECK_ALL : "",
@@ -183,6 +189,10 @@ gEccErrorMessage = {
ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE : "No used module files found",
ERROR_META_DATA_FILE_CHECK_PCD_TYPE : "Wrong C code function used for this kind of PCD",
ERROR_META_DATA_FILE_CHECK_MODULE_FILE_GUID_DUPLICATION : "Module file has FILE_GUID collision with other module file",
+ ERROR_META_DATA_FILE_CHECK_FORMAT_GUID : "Wrong GUID Format used in Module file",
+ ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL : "Wrong Protocol Format used in Module file",
+ ERROR_META_DATA_FILE_CHECK_FORMAT_PPI : "Wrong Ppi Format used in Module file",
+ ERROR_META_DATA_FILE_CHECK_FORMAT_PCD : "Wrong Pcd Format used in Module file",
ERROR_SPELLING_CHECK_ALL : "",
}
diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Source/Python/Ecc/MetaDataParser.py
index 98b16a0e5c..d80a5cff5d 100644
--- a/BaseTools/Source/Python/Ecc/MetaDataParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaDataParser.py
@@ -184,19 +184,26 @@ def ParseHeaderCommentSection(CommentList, FileName = None):
continue
License += Comment + EndOfLine
- if not Copyright:
+ if not Copyright.strip():
SqlStatement = """ select ID from File where FullPath like '%s'""" % FileName
ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
for Result in ResultSet:
Msg = 'Header comment section must have copyright information'
EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
- if not License:
+ if not License.strip():
SqlStatement = """ select ID from File where FullPath like '%s'""" % FileName
ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
for Result in ResultSet:
Msg = 'Header comment section must have license information'
EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
+
+ if not Abstract.strip() or Abstract.find('Component description file') > -1:
+ SqlStatement = """ select ID from File where FullPath like '%s'""" % FileName
+ ResultSet = EccGlobalData.gDb.TblFile.Exec(SqlStatement)
+ for Result in ResultSet:
+ Msg = 'Header comment section must have Abstract information.'
+ EccGlobalData.gDb.TblReport.Insert(ERROR_DOXYGEN_CHECK_FILE_HEADER, Msg, "File", Result[0])
return Abstract.strip(), Description.strip(), Copyright.strip(), License.strip()
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
index 0d53f05d8b..a27e98c975 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
@@ -98,7 +98,7 @@ class Table(object):
SqlCommand = """drop table IF EXISTS %s""" % self.Table
try:
self.Cur.execute(SqlCommand)
- except sqlite3.Error, e:
+ except Exception, e:
print "An error occurred when Drop a table:", e.args[0]
## Get count
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
index 949d067945..1c3e968785 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -433,6 +433,7 @@ class InfParser(MetaFileParser):
def Start(self):
NmakeLine = ''
Content = ''
+ Usage = ''
try:
Content = open(str(self.MetaFile), 'r').readlines()
except:
@@ -451,8 +452,26 @@ class InfParser(MetaFileParser):
IsFindBlockComment = False
for Index in range(0, len(Content)):
+ if self._SectionType in [MODEL_EFI_GUID,
+ MODEL_EFI_PROTOCOL,
+ MODEL_EFI_PPI,
+ MODEL_PCD_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC]:
+ Line = Content[Index].strip()
+ if Line.startswith(TAB_COMMENT_SPLIT):
+ continue
+ elif Line.find(TAB_COMMENT_SPLIT) > 0:
+ Usage = Line[Line.find(TAB_COMMENT_SPLIT):]
+ Line = Line[:Line.find(TAB_COMMENT_SPLIT)]
+ else:
+ Usage = ''
+ else:
# skip empty, commented, block commented lines
- Line = CleanString(Content[Index], AllowCppStyleComment=True)
+ Line = CleanString(Content[Index], AllowCppStyleComment=True)
+ Usage = ''
NextLine = ''
if Index + 1 < len(Content):
NextLine = CleanString(Content[Index + 1])
@@ -539,7 +558,8 @@ class InfParser(MetaFileParser):
-1,
self._LineIndex+1,
-1,
- 0
+ 0,
+ Usage
)
if IsFindBlockComment:
EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */",
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py
index 89bc7f262f..54a3016948 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py
@@ -51,6 +51,7 @@ class ModuleTable(MetaFileTable):
Value1 TEXT NOT NULL,
Value2 TEXT,
Value3 TEXT,
+ Usage TEXT,
Scope1 TEXT,
Scope2 TEXT,
BelongsToItem REAL NOT NULL,
@@ -84,14 +85,15 @@ class ModuleTable(MetaFileTable):
# @param Enabled: If this item enabled
#
def Insert(self, Model, Value1, Value2, Value3, Scope1='COMMON', Scope2='COMMON',
- BelongsToItem=-1, BelongsToFile = -1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=0):
- (Value1, Value2, Value3, Scope1, Scope2) = ConvertToSqlString((Value1, Value2, Value3, Scope1, Scope2))
+ BelongsToItem=-1, BelongsToFile = -1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=0, Usage=''):
+ (Value1, Value2, Value3, Usage, Scope1, Scope2) = ConvertToSqlString((Value1, Value2, Value3, Usage, Scope1, Scope2))
return Table.Insert(
self,
Model,
Value1,
Value2,
Value3,
+ Usage,
Scope1,
Scope2,
BelongsToItem,
@@ -113,7 +115,7 @@ class ModuleTable(MetaFileTable):
#
def Query(self, Model, Arch=None, Platform=None):
ConditionString = "Model=%s AND Enabled>=0" % Model
- ValueString = "Value1,Value2,Value3,Scope1,Scope2,ID,StartLine"
+ ValueString = "Value1,Value2,Value3,Usage,Scope1,Scope2,ID,StartLine"
if Arch != None and Arch != 'COMMON':
ConditionString += " AND (Scope1='%s' OR Scope1='COMMON')" % Arch
diff --git a/BaseTools/Source/Python/Ecc/config.ini b/BaseTools/Source/Python/Ecc/config.ini
index 436fe4b09b..8e11082b83 100644
--- a/BaseTools/Source/Python/Ecc/config.ini
+++ b/BaseTools/Source/Python/Ecc/config.ini
@@ -70,6 +70,8 @@ GeneralCheckCarriageReturn = 1
GeneralCheckFileExistence = 1
# Check whether file has non ACSII char
GeneralCheckNonAcsii = 1
+# Check whether UNI file is valid
+GeneralCheckUni = 1
#
# Space Checking
@@ -236,7 +238,7 @@ MetaDataFileCheckPcdDuplicate = 1
# Check whether PCD settings in the FDF file can only be related to flash.
MetaDataFileCheckPcdFlash = 1
# Check whether PCDs used in INF files but not specified in DSC or FDF files
-MetaDataFileCheckPcdNoUse = 1
+MetaDataFileCheckPcdNoUse = 0
# Check whether having duplicate guids defined for Guid/Protocol/Ppi
MetaDataFileCheckGuidDuplicate = 1
# Check whether all files under module directory are described in INF files