BaseTools: Update build report for StructurePcd value
authorYunhua Feng <yunhuax.feng@intel.com>
Wed, 25 Jul 2018 04:26:09 +0000 (12:26 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Mon, 30 Jul 2018 01:30:04 +0000 (09:30 +0800)
Update build report to display the structure Pcd value that from
FDF file.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/build/BuildReport.py

index 5709cde..50717b7 100644 (file)
@@ -968,7 +968,6 @@ class PcdReport(object):
                     if CName == PcdTokenCName and Guid == Key:\r
                         DscDefaultValue = self.FdfPcdSet[(CName, Guid, Field)]\r
                         break\r
-                DscDefaultValue = self.FdfPcdSet.get((Pcd.TokenCName, Key), DscDefaultValue)\r
                 if DscDefaultValue != DscDefaultValBak:\r
                     try:\r
                         DscDefaultValue = ValueExpressionEx(DscDefaultValue, Pcd.DatumType, self._GuidDict)(True)\r
@@ -1084,8 +1083,13 @@ class PcdReport(object):
                                 if DscOverride:\r
                                     break\r
                         if DscOverride:\r
+                            DscDefaultValue = True\r
                             DscMatch = True\r
                             DecMatch = False\r
+                    else:\r
+                        DscDefaultValue = True\r
+                        DscMatch = True\r
+                        DecMatch = False\r
 \r
                 #\r
                 # Report PCD item according to their override relationship\r
@@ -1352,16 +1356,22 @@ class PcdReport(object):
                     OverrideFieldStruct[Key] = Values\r
         if Pcd.PcdFieldValueFromFdf:\r
             for Key, Values in Pcd.PcdFieldValueFromFdf.items():\r
+                if Key in OverrideFieldStruct and Values[0] == OverrideFieldStruct[Key][0]:\r
+                    continue\r
                 OverrideFieldStruct[Key] = Values\r
         if Pcd.PcdFieldValueFromComm:\r
             for Key, Values in Pcd.PcdFieldValueFromComm.items():\r
+                if Key in OverrideFieldStruct and Values[0] == OverrideFieldStruct[Key][0]:\r
+                    continue\r
                 OverrideFieldStruct[Key] = Values\r
         return OverrideFieldStruct\r
 \r
     def PrintStructureInfo(self, File, Struct):\r
-        for Key, Value in Struct.items():\r
+        for Key, Value in sorted(Struct.items(), key=lambda x: x[0]):\r
             if Value[1] and 'build command options' in Value[1]:\r
                 FileWrite(File, '    *B  %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))\r
+            elif Value[1] and Value[1].endswith('.fdf'):\r
+                FileWrite(File, '    *F  %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))\r
             else:\r
                 FileWrite(File, '        %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))\r
 \r