]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/Ecc: Add a checkpoint for invalid DEC file.
authorHess Chen <hesheng.chen@intel.com>
Thu, 25 Jun 2015 08:01:59 +0000 (08:01 +0000)
committerhchen30 <hchen30@Edk2>
Thu, 25 Jun 2015 08:01:59 +0000 (08:01 +0000)
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

BaseTools/Source/Python/Ecc/Check.py
BaseTools/Source/Python/Ecc/Configuration.py
BaseTools/Source/Python/Ecc/EccToolError.py
BaseTools/Source/Python/Ecc/config.ini

index da3b0fb9ac344573d03072be62703f6dd533374c..6c4c90ca782115fdcefc14cbee1728fe15778b3e 100644 (file)
@@ -564,6 +564,7 @@ class Check(object):
         self.MetaDataFileCheckLibraryInstanceDependent()\r
         self.MetaDataFileCheckLibraryInstanceOrder()\r
         self.MetaDataFileCheckLibraryNoUse()\r
+        self.MetaDataFileCheckLibraryDefinedInDec()\r
         self.MetaDataFileCheckBinaryInfInFdf()\r
         self.MetaDataFileCheckPcdDuplicate()\r
         self.MetaDataFileCheckPcdFlash()\r
@@ -695,7 +696,24 @@ class Check(object):
                     for FilePath in FilePathList:\r
                         if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NAME_DUPLICATE, Record[1]):\r
                             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])\r
-                                                \r
+    \r
+    # Check the header file in Include\Library directory whether be defined in the package DEC file.\r
+    def MetaDataFileCheckLibraryDefinedInDec(self):\r
+        if EccGlobalData.gConfig.MetaDataFileCheckLibraryDefinedInDec == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
+            EdkLogger.quiet("Checking for library instance whether be defined in the package dec file ...")\r
+            SqlCommand = """\r
+                    select A.Value1, A.StartLine, A.ID, B.Value1 from Inf as A left join Dec as B\r
+                    on A.Model = B.Model and A.Value1 = B.Value1 where A.Model=%s\r
+                    """ % MODEL_EFI_LIBRARY_CLASS\r
+            RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)\r
+            for Record in RecordSet:\r
+                LibraryInInf, Line, ID, LibraryDec = Record\r
+                if not LibraryDec:\r
+                    if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED, LibraryInInf):\r
+                        EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED, \\r
+                                            OtherMsg="The Library Class [%s] in %s line is not defined in the associated package file." % (LibraryInInf, Line), \r
+                                            BelongsToTable='Inf', BelongsToItem=ID)\r
+    \r
     # 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\r
     def MetaDataFileCheckBinaryInfInFdf(self):\r
         if EccGlobalData.gConfig.MetaDataFileCheckBinaryInfInFdf == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
index 5a06c4ee2e00b5c979094eb3480f17cf6ab93aa1..da53f5f6f8ca88573d384477db28d17881ca0faa 100644 (file)
@@ -220,6 +220,8 @@ class Configuration(object):
         self.MetaDataFileCheckLibraryInstanceOrder = 1\r
         # Check whether the unnecessary inclusion of library classes in the INF file\r
         self.MetaDataFileCheckLibraryNoUse = 1\r
+        # Check the header file in Include\Library directory whether be defined in the package DEC file.\r
+        self.MetaDataFileCheckLibraryDefinedInDec = 1\r
         # 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\r
         self.MetaDataFileCheckBinaryInfInFdf = 1\r
         # Not to report error and warning related OS include file such as "windows.h" and "stdio.h"\r
index 900dcc17dd0adb321e3e99e3384259aff7072e69..5c45fdf904bcfcc193d49f8d2826b1a58e953bd5 100644 (file)
@@ -101,6 +101,7 @@ ERROR_META_DATA_FILE_CHECK_FORMAT_GUID = 10018
 ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL = 10019\r
 ERROR_META_DATA_FILE_CHECK_FORMAT_PPI = 10020\r
 ERROR_META_DATA_FILE_CHECK_FORMAT_PCD = 10021\r
+ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED = 10022\r
 \r
 ERROR_SPELLING_CHECK_ALL = 11000\r
 \r
@@ -195,6 +196,7 @@ gEccErrorMessage = {
     ERROR_META_DATA_FILE_CHECK_FORMAT_PROTOCOL : "Wrong Protocol Format used in Module file",\r
     ERROR_META_DATA_FILE_CHECK_FORMAT_PPI : "Wrong Ppi Format used in Module file",\r
     ERROR_META_DATA_FILE_CHECK_FORMAT_PCD : "Wrong Pcd Format used in Module file",\r
+    ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED : "Not defined LibraryClass used in the Module file.",\r
     ERROR_SPELLING_CHECK_ALL : "",\r
     }\r
 \r
index 89c17a5ef29b1a7fd1ec3c88869fa52404b3dda7..b3c1204aed35e694cbbf1b9d6150bdeed0ea70e3 100644 (file)
@@ -230,6 +230,8 @@ MetaDataFileCheckLibraryInstanceDependent = 1
 MetaDataFileCheckLibraryInstanceOrder = 1\r
 # Check whether the unnecessary inclusion of library classes in the INF file\r
 MetaDataFileCheckLibraryNoUse = 1\r
+# Check the header file in Include\Library directory whether be defined in the package DEC file.\r
+MetaDataFileCheckLibraryDefinedInDec = 1\r
 # 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\r
 MetaDataFileCheckBinaryInfInFdf = 1\r
 # Not to report error and warning related OS include file such as "windows.h" and "stdio.h".\r