public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools: Update build report for StructurePcd value
@ 2018-07-26 13:07 Yonghong Zhu
  2018-07-27  6:07 ` Zhu, Yonghong
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2018-07-26 13:07 UTC (permalink / raw)
  To: edk2-devel; +Cc: Yunhua Feng, Liming Gao

From: Yunhua Feng <yunhuax.feng@intel.com>

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>
---
 BaseTools/Source/Python/build/BuildReport.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 27680019dc..d973db5c77 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -966,11 +966,10 @@ class PcdReport(object):
                 Field = ''
                 for (CName, Guid, Field) in self.FdfPcdSet:
                     if CName == PcdTokenCName and Guid == Key:
                         DscDefaultValue = self.FdfPcdSet[(CName, Guid, Field)]
                         break
-                DscDefaultValue = self.FdfPcdSet.get((Pcd.TokenCName, Key), DscDefaultValue)
                 if DscDefaultValue != DscDefaultValBak:
                     try:
                         DscDefaultValue = ValueExpressionEx(DscDefaultValue, Pcd.DatumType, self._GuidDict)(True)
                     except BadExpression as DscDefaultValue:
                         EdkLogger.error('BuildReport', FORMAT_INVALID, "PCD Value: %s, Type: %s" %(DscDefaultValue, Pcd.DatumType))
@@ -1082,12 +1081,17 @@ class PcdReport(object):
                                         OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]])
                                         DscOverride = self.ParseStruct(OverrideFieldStruct)
                                 if DscOverride:
                                     break
                         if DscOverride:
+                            DscDefaultValue = True
                             DscMatch = True
                             DecMatch = False
+                    else:
+                        DscDefaultValue = True
+                        DscMatch = True
+                        DecMatch = False
 
                 #
                 # Report PCD item according to their override relationship
                 #
                 if DecMatch:
@@ -1344,20 +1348,26 @@ class PcdReport(object):
             for Key, Values in OverrideStruct.items():
                 if Values[1] and Values[1].endswith('.dsc'):
                     OverrideFieldStruct[Key] = Values
         if Pcd.PcdFieldValueFromFdf:
             for Key, Values in Pcd.PcdFieldValueFromFdf.items():
+                if Key in OverrideFieldStruct and Values[0] == OverrideFieldStruct[Key][0]:
+                    continue
                 OverrideFieldStruct[Key] = Values
         if Pcd.PcdFieldValueFromComm:
             for Key, Values in Pcd.PcdFieldValueFromComm.items():
+                if Key in OverrideFieldStruct and Values[0] == OverrideFieldStruct[Key][0]:
+                    continue
                 OverrideFieldStruct[Key] = Values
         return OverrideFieldStruct
 
     def PrintStructureInfo(self, File, Struct):
-        for Key, Value in Struct.items():
+        for Key, Value in sorted(Struct.items(), key=lambda x: x[0]):
             if Value[1] and 'build command options' in Value[1]:
                 FileWrite(File, '    *B  %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))
+            elif Value[1] and Value[1].endswith('.fdf'):
+                FileWrite(File, '    *F  %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))
             else:
                 FileWrite(File, '        %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))
 
     def StrtoHex(self, value):
         try:
-- 
2.12.2.windows.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] BaseTools: Update build report for StructurePcd value
  2018-07-26 13:07 [PATCH] BaseTools: Update build report for StructurePcd value Yonghong Zhu
@ 2018-07-27  6:07 ` Zhu, Yonghong
  0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2018-07-27  6:07 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yonghong Zhu
Sent: Thursday, July 26, 2018 9:07 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: [edk2] [PATCH] BaseTools: Update build report for StructurePcd value

From: Yunhua Feng <yunhuax.feng@intel.com>

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>
---
 BaseTools/Source/Python/build/BuildReport.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index 27680019dc..d973db5c77 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -966,11 +966,10 @@ class PcdReport(object):
                 Field = ''
                 for (CName, Guid, Field) in self.FdfPcdSet:
                     if CName == PcdTokenCName and Guid == Key:
                         DscDefaultValue = self.FdfPcdSet[(CName, Guid, Field)]
                         break
-                DscDefaultValue = self.FdfPcdSet.get((Pcd.TokenCName, Key), DscDefaultValue)
                 if DscDefaultValue != DscDefaultValBak:
                     try:
                         DscDefaultValue = ValueExpressionEx(DscDefaultValue, Pcd.DatumType, self._GuidDict)(True)
                     except BadExpression as DscDefaultValue:
                         EdkLogger.error('BuildReport', FORMAT_INVALID, "PCD Value: %s, Type: %s" %(DscDefaultValue, Pcd.DatumType)) @@ -1082,12 +1081,17 @@ class PcdReport(object):
                                         OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]])
                                         DscOverride = self.ParseStruct(OverrideFieldStruct)
                                 if DscOverride:
                                     break
                         if DscOverride:
+                            DscDefaultValue = True
                             DscMatch = True
                             DecMatch = False
+                    else:
+                        DscDefaultValue = True
+                        DscMatch = True
+                        DecMatch = False
 
                 #
                 # Report PCD item according to their override relationship
                 #
                 if DecMatch:
@@ -1344,20 +1348,26 @@ class PcdReport(object):
             for Key, Values in OverrideStruct.items():
                 if Values[1] and Values[1].endswith('.dsc'):
                     OverrideFieldStruct[Key] = Values
         if Pcd.PcdFieldValueFromFdf:
             for Key, Values in Pcd.PcdFieldValueFromFdf.items():
+                if Key in OverrideFieldStruct and Values[0] == OverrideFieldStruct[Key][0]:
+                    continue
                 OverrideFieldStruct[Key] = Values
         if Pcd.PcdFieldValueFromComm:
             for Key, Values in Pcd.PcdFieldValueFromComm.items():
+                if Key in OverrideFieldStruct and Values[0] == OverrideFieldStruct[Key][0]:
+                    continue
                 OverrideFieldStruct[Key] = Values
         return OverrideFieldStruct
 
     def PrintStructureInfo(self, File, Struct):
-        for Key, Value in Struct.items():
+        for Key, Value in sorted(Struct.items(), key=lambda x: x[0]):
             if Value[1] and 'build command options' in Value[1]:
                 FileWrite(File, '    *B  %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))
+            elif Value[1] and Value[1].endswith('.fdf'):
+                FileWrite(File, '    *F  %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))
             else:
                 FileWrite(File, '        %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0]))
 
     def StrtoHex(self, value):
         try:
--
2.12.2.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-27  6:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-26 13:07 [PATCH] BaseTools: Update build report for StructurePcd value Yonghong Zhu
2018-07-27  6:07 ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox