public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: zhijufan <zhijux.fan@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [Patch] BaseTools: Align the boolean type PCD value's display in the report
Date: Wed, 12 Sep 2018 09:49:42 +0800	[thread overview]
Message-ID: <1536716982-26968-1-git-send-email-yonghong.zhu@intel.com> (raw)

From: zhijufan <zhijux.fan@intel.com>

This patch align the boolean type PCD value's display in the build
report. Original it may display 0x0, also may use 0 for the same PCD.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
 BaseTools/Source/Python/build/BuildReport.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index a598d64..c7fa1b9 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1012,11 +1012,11 @@ class PcdReport(object):
                         FileWrite(File, "")
                     FileWrite(File, Key)
                     First = False
 
 
-                if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+                if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES:
                     PcdValueNumber = int(PcdValue.strip(), 0)
                     if DecDefaultValue is None:
                         DecMatch = True
                     else:
                         DecDefaultValueNumber = int(DecDefaultValue.strip(), 0)
@@ -1100,10 +1100,19 @@ class PcdReport(object):
                         DecMatch = False
 
                 #
                 # Report PCD item according to their override relationship
                 #
+                if Pcd.DatumType == 'BOOLEAN':
+                    if DscDefaultValue:
+                        DscDefaultValue = str(int(DscDefaultValue, 0))
+                    if DecDefaultValue:
+                        DecDefaultValue = str(int(DecDefaultValue, 0))
+                    if InfDefaultValue:
+                        InfDefaultValue = str(int(InfDefaultValue, 0))
+                    if Pcd.DefaultValue:
+                        Pcd.DefaultValue = str(int(Pcd.DefaultValue, 0))
                 if DecMatch:
                     self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '  ')
                 elif InfDefaultValue and InfMatch:
                     self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*M')
                 elif BuildOptionMatch:
@@ -1124,13 +1133,15 @@ class PcdReport(object):
                         continue
                     if not BuildOptionMatch:
                         ModuleOverride = self.ModulePcdOverride.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), {})
                         for ModulePath in ModuleOverride:
                             ModuleDefault = ModuleOverride[ModulePath]
-                            if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+                            if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES:
                                 ModulePcdDefaultValueNumber = int(ModuleDefault.strip(), 0)
                                 Match = (ModulePcdDefaultValueNumber == PcdValueNumber)
+                                if Pcd.DatumType == 'BOOLEAN':
+                                    ModuleDefault = str(ModulePcdDefaultValueNumber)
                             else:
                                 Match = (ModuleDefault.strip() == PcdValue.strip())
                             if Match:
                                 continue
                             IsByteArray, ArrayList = ByteArrayForamt(ModuleDefault.strip())
@@ -1245,10 +1256,12 @@ class PcdReport(object):
                     if SkuInfo.DefaultStoreDict:
                         DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys())
                         for DefaultStore in DefaultStoreList:
                             Value = SkuInfo.DefaultStoreDict[DefaultStore]
                             IsByteArray, ArrayList = ByteArrayForamt(Value)
+                            if Pcd.DatumType == 'BOOLEAN':
+                                Value = str(int(Value, 0))
                             if FirstPrint:
                                 FirstPrint = False
                                 if IsByteArray:
                                     if self.DefaultStoreSingle and self.SkuSingle:
                                         FileWrite(File, ' %-*s   : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '{'))
@@ -1307,10 +1320,12 @@ class PcdReport(object):
                                 self.PrintStructureInfo(File, OverrideFieldStruct)
                             self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
                 else:
                     Value = SkuInfo.DefaultValue
                     IsByteArray, ArrayList = ByteArrayForamt(Value)
+                    if Pcd.DatumType == 'BOOLEAN':
+                        Value = str(int(Value, 0))
                     if FirstPrint:
                         FirstPrint = False
                         if IsByteArray:
                             if self.SkuSingle:
                                 FileWrite(File, ' %-*s   : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', "{"))
-- 
2.6.1.windows.1



             reply	other threads:[~2018-09-12  1:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12  1:49 Yonghong Zhu [this message]
2018-09-13  0:47 ` [Patch] BaseTools: Align the boolean type PCD value's display in the report Zhu, Yonghong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1536716982-26968-1-git-send-email-yonghong.zhu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox