Revision: 17708
          http://sourceforge.net/p/edk2/code/17708
Author:   hchen30
Date:     2015-06-25 08:01:59 +0000 (Thu, 25 Jun 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: YangX Li <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/Python/Ecc/Check.py
    trunk/edk2/BaseTools/Source/Python/Ecc/Configuration.py
    trunk/edk2/BaseTools/Source/Python/Ecc/EccToolError.py
    trunk/edk2/BaseTools/Source/Python/Ecc/config.ini

Modified: trunk/edk2/BaseTools/Source/Python/Ecc/Check.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/Ecc/Check.py     2015-06-25 07:59:16 UTC 
(rev 17707)
+++ trunk/edk2/BaseTools/Source/Python/Ecc/Check.py     2015-06-25 08:01:59 UTC 
(rev 17708)
@@ -564,6 +564,7 @@
         self.MetaDataFileCheckLibraryInstanceDependent()
         self.MetaDataFileCheckLibraryInstanceOrder()
         self.MetaDataFileCheckLibraryNoUse()
+        self.MetaDataFileCheckLibraryDefinedInDec()
         self.MetaDataFileCheckBinaryInfInFdf()
         self.MetaDataFileCheckPcdDuplicate()
         self.MetaDataFileCheckPcdFlash()
@@ -695,7 +696,24 @@
                     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':

Modified: trunk/edk2/BaseTools/Source/Python/Ecc/Configuration.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/Ecc/Configuration.py     2015-06-25 
07:59:16 UTC (rev 17707)
+++ trunk/edk2/BaseTools/Source/Python/Ecc/Configuration.py     2015-06-25 
08:01:59 UTC (rev 17708)
@@ -220,6 +220,8 @@
         self.MetaDataFileCheckLibraryInstanceOrder = 1
         # Check whether the unnecessary inclusion of library classes in the 
INF file
         self.MetaDataFileCheckLibraryNoUse = 1
+        # Check the header file in Include\Library directory whether be 
defined in the package DEC file.
+        self.MetaDataFileCheckLibraryDefinedInDec = 1
         # 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
         self.MetaDataFileCheckBinaryInfInFdf = 1
         # Not to report error and warning related OS include file such as 
"windows.h" and "stdio.h"

Modified: trunk/edk2/BaseTools/Source/Python/Ecc/EccToolError.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/Ecc/EccToolError.py      2015-06-25 
07:59:16 UTC (rev 17707)
+++ trunk/edk2/BaseTools/Source/Python/Ecc/EccToolError.py      2015-06-25 
08:01:59 UTC (rev 17708)
@@ -101,6 +101,7 @@
 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_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED = 10022
 
 ERROR_SPELLING_CHECK_ALL = 11000
 
@@ -195,6 +196,7 @@
     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_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED : "Not defined LibraryClass 
used in the Module file.",
     ERROR_SPELLING_CHECK_ALL : "",
     }
 

Modified: trunk/edk2/BaseTools/Source/Python/Ecc/config.ini
===================================================================
--- trunk/edk2/BaseTools/Source/Python/Ecc/config.ini   2015-06-25 07:59:16 UTC 
(rev 17707)
+++ trunk/edk2/BaseTools/Source/Python/Ecc/config.ini   2015-06-25 08:01:59 UTC 
(rev 17708)
@@ -230,6 +230,8 @@
 MetaDataFileCheckLibraryInstanceOrder = 1
 # Check whether the unnecessary inclusion of library classes in the INF file
 MetaDataFileCheckLibraryNoUse = 1
+# Check the header file in Include\Library directory whether be defined in the 
package DEC file.
+MetaDataFileCheckLibraryDefinedInDec = 1
 # 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
 MetaDataFileCheckBinaryInfInFdf = 1
 # Not to report error and warning related OS include file such as "windows.h" 
and "stdio.h".


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to