From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7B72821B02822 for ; Tue, 11 Sep 2018 18:49:46 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2018 18:49:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,362,1531810800"; d="scan'208";a="256425995" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by orsmga005.jf.intel.com with ESMTP; 11 Sep 2018 18:49:44 -0700 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: zhijufan , Liming Gao Date: Wed, 12 Sep 2018 09:49:42 +0800 Message-Id: <1536716982-26968-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch] BaseTools: Align the boolean type PCD value's display in the report X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2018 01:49:46 -0000 From: zhijufan 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 Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- 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