]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Ecc/Check.py
Sync BaseTool trunk (version r2423) into EDKII BaseTools. The change mainly includes:
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / Check.py
index cd47b805e5e77c48c600155503417ee02e1be89b..6f5f9fd0b5570e4318db377c5f78f023a900319c 100644 (file)
@@ -580,6 +580,7 @@ class Check(object):
             pass\r
 \r
     # Check whether the unnecessary inclusion of library classes in the Inf file\r
+    # Check whether the unnecessary duplication of library classe names in the DSC file\r
     def MetaDataFileCheckLibraryNoUse(self):\r
         if EccGlobalData.gConfig.MetaDataFileCheckLibraryNoUse == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':\r
             EdkLogger.quiet("Checking for library instance not used ...")\r
@@ -588,7 +589,20 @@ class Check(object):
             for Record in RecordSet:\r
                 if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, Record[1]):\r
                     EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, OtherMsg="The Library Class [%s] is not used in any platform" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])\r
-\r
+            SqlCommand = """\r
+                         select A.ID, A.Value1, A.BelongsToFile, A.StartLine, B.StartLine from Dsc as A left join Dsc as B\r
+                         where A.Model = %s and B.Model = %s and A.Value3 = B.Value3 and A.Arch = B.Arch and A.ID <> B.ID\r
+                         and A.Value1 = B.Value1 and A.StartLine <> B.StartLine and B.BelongsToFile = A.BelongsToFile""" \\r
+                            % (MODEL_EFI_LIBRARY_CLASS, MODEL_EFI_LIBRARY_CLASS)\r
+            RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)\r
+            for Record in RecordSet:\r
+                if Record[3] and Record[4] and Record[3] != Record[4]:\r
+                    SqlCommand = """select FullPath from File where ID = %s""" % (Record[2])\r
+                    FilePathList = EccGlobalData.gDb.TblFile.Exec(SqlCommand)\r
+                    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
     # 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