BaseTools/Ecc: Add a checkpoint for invalid DEC file.

Add a checkpoint to check whether a header file in 'include' directory is defined in DEC file

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17708 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Hess Chen
2015-06-25 08:01:59 +00:00
committed by hchen30
parent b66592d8eb
commit 14239f6603
4 changed files with 25 additions and 1 deletions

View File

@ -564,6 +564,7 @@ class Check(object):
self.MetaDataFileCheckLibraryInstanceDependent()
self.MetaDataFileCheckLibraryInstanceOrder()
self.MetaDataFileCheckLibraryNoUse()
self.MetaDataFileCheckLibraryDefinedInDec()
self.MetaDataFileCheckBinaryInfInFdf()
self.MetaDataFileCheckPcdDuplicate()
self.MetaDataFileCheckPcdFlash()
@ -695,7 +696,24 @@ class Check(object):
for FilePath in FilePathList:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE, OtherMsg="The Library Class [%s] is duplicated in '%s' line %s and line %s." % (Record[1], FilePath, Record[3], Record[4]), BelongsToTable='Dsc', BelongsToItem=Record[0])
# Check the header file in Include\Library directory whether be defined in the package DEC file.
def MetaDataFileCheckLibraryDefinedInDec(self):
if EccGlobalData.gConfig.MetaDataFileCheckLibraryDefinedInDec == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking for library instance whether be defined in the package dec file ...")
SqlCommand = """
select A.Value1, A.StartLine, A.ID, B.Value1 from Inf as A left join Dec as B
on A.Model = B.Model and A.Value1 = B.Value1 where A.Model=%s
""" % MODEL_EFI_LIBRARY_CLASS
RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
for Record in RecordSet:
LibraryInInf, Line, ID, LibraryDec = Record
if not LibraryDec:
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED, LibraryInInf):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED, \
OtherMsg="The Library Class [%s] in %s line is not defined in the associated package file." % (LibraryInInf, Line),
BelongsToTable='Inf', BelongsToItem=ID)
# Check whether an Inf file is specified in the FDF file, but not in the Dsc file, then the Inf file must be for a Binary module only
def MetaDataFileCheckBinaryInfInFdf(self):
if EccGlobalData.gConfig.MetaDataFileCheckBinaryInfInFdf == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':