From nobody Mon Dec 23 06:02:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520002360056964.0544057221408; Fri, 2 Mar 2018 06:52:40 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E9AA522546BB8; Fri, 2 Mar 2018 06:46:28 -0800 (PST) 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 1133220955F3E for ; Fri, 2 Mar 2018 06:46:27 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2018 06:52:37 -0800 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.129]) by FMSMGA003.fm.intel.com with ESMTP; 02 Mar 2018 06:52:36 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; 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 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,412,1515484800"; d="scan'208";a="30958532" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Fri, 2 Mar 2018 22:52:34 +0800 Message-Id: <1520002354-12544-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [Patch] BaseTools: Correct Structure Pcd value in the report X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The patch "Fixed build failed issue" changed structure Pcd Object, so we need update build report to correct structure Pcd Value. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- BaseTools/Source/Python/build/BuildReport.py | 72 ++++++++++++++++++++++++= ---- 1 file changed, 63 insertions(+), 9 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index b2cc6ee..f4d2c75 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -956,11 +956,11 @@ class PcdReport(object): DscDefaultValBak =3D DscDefaultValue DscDefaultValue =3D self.FdfPcdSet.get((Pcd.TokenCName= , Key), DscDefaultValue) if DscDefaultValue !=3D DscDefaultValBak: try: DscDefaultValue =3D ValueExpressionEx(DscDefau= ltValue, Pcd.DatumType, self._GuidDict)(True) - except BadExpression, Value: + except BadExpression, DscDefaultValue: EdkLogger.error('BuildReport', FORMAT_INVALID,= "PCD Value: %s, Type: %s" %(DscDefaultValue, Pcd.DatumType)) =20 InfDefaultValue =3D None =20 PcdValue =3D DecDefaultValue @@ -1031,13 +1031,46 @@ class PcdReport(object): SkuInfoList =3D Pcd.SkuInfoList Pcd =3D GlobalData.gStructurePcd[self.Arch][(Pcd.T= okenCName, Pcd.TokenSpaceGuidCName)] Pcd.DatumType =3D Pcd.StructName if TypeName in ('DYNVPD', 'DEXVPD'): Pcd.SkuInfoList =3D SkuInfoList - if Pcd.SkuOverrideValues: - DscMatch =3D True + if Pcd.PcdFieldValueFromComm: + BuildOptionMatch =3D True DecMatch =3D False + elif Pcd.SkuOverrideValues: + DscOverride =3D False + if not Pcd.SkuInfoList: + OverrideValues =3D Pcd.SkuOverrideValues + if OverrideValues: + Keys =3D OverrideValues.keys() + Data =3D OverrideValues[Keys[0]] + Struct =3D Data.values()[0] + DscOverride =3D self.ParseStruct(Struc= t) + else: + SkuList =3D sorted(Pcd.SkuInfoList.keys()) + for Sku in SkuList: + SkuInfo =3D Pcd.SkuInfoList[Sku] + if TypeName in ('DYNHII', 'DEXHII'): + if SkuInfo.DefaultStoreDict: + DefaultStoreList =3D sorted(Sk= uInfo.DefaultStoreDict.keys()) + for DefaultStore in DefaultSto= reList: + OverrideValues =3D Pcd.Sku= OverrideValues[Sku] + DscOverride =3D self.Parse= Struct(OverrideValues[DefaultStore]) + if DscOverride: + break + else: + OverrideValues =3D Pcd.SkuOverride= Values[Sku] + if OverrideValues: + Keys =3D OverrideValues.keys() + OverrideFieldStruct =3D self.O= verrideFieldValue(Pcd, OverrideValues[Keys[0]]) + DscOverride =3D self.ParseStru= ct(OverrideFieldStruct) + if DscOverride: + break + if DscOverride: + DscMatch =3D True + DecMatch =3D False + # # Report PCD item according to their override relation= ship # if DecMatch and InfMatch: self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeN= ame, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, De= cMatch, DecDefaultValue, ' ') @@ -1080,10 +1113,18 @@ class PcdReport(object): FileWrite(File, gSectionEnd) else: if not ReportSubType and ModulePcdSet: FileWrite(File, gSubSectionEnd) =20 + def ParseStruct(self, struct): + HasDscOverride =3D False + if struct: + for _, Values in struct.items(): + if Values[1] and Values[1].endswith('.dsc'): + HasDscOverride =3D True + break + return HasDscOverride =20 def PrintPcdDefault(self, File, Pcd, IsStructure, DscMatch, DscDefault= Value, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue): if not DscMatch and DscDefaultValue !=3D None: Value =3D DscDefaultValue.strip() IsByteArray, ArrayList =3D ByteArrayForamt(Value) @@ -1112,10 +1153,12 @@ class PcdReport(object): FileWrite(File, '%s' % (Array)) else: FileWrite(File, ' %*s =3D %s' % (self.MaxLen + 19, 'DEC= DEFAULT', Value)) if IsStructure: self.PrintStructureInfo(File, Pcd.DefaultValues) + if DecMatch and IsStructure: + self.PrintStructureInfo(File, Pcd.DefaultValues) =20 def PrintPcdValue(self, File, Pcd, PcdTokenCName, TypeName, IsStructur= e, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefau= ltValue, Flag =3D ' '): if not Pcd.SkuInfoList: Value =3D Pcd.DefaultValue IsByteArray, ArrayList =3D ByteArrayForamt(Value) @@ -1129,11 +1172,12 @@ class PcdReport(object): OverrideValues =3D Pcd.SkuOverrideValues if OverrideValues: Keys =3D OverrideValues.keys() Data =3D OverrideValues[Keys[0]] Struct =3D Data.values()[0] - self.PrintStructureInfo(File, Struct) + OverrideFieldStruct =3D self.OverrideFieldValue(Pcd, S= truct) + self.PrintStructureInfo(File, OverrideFieldStruct) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefa= ultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) else: FirstPrint =3D True SkuList =3D sorted(Pcd.SkuInfoList.keys()) for Sku in SkuList: @@ -1189,12 +1233,12 @@ class PcdReport(object): else: FileWrite(File, ' %-*s : %6s %10= s %10s %10s =3D %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')= ', '(' + SkuIdName + ')', '(' + DefaultStore + ')', Value)) FileWrite(File, '%*s: %s: %s' % (self.MaxLen += 4, SkuInfo.VariableGuid, SkuInfo.VariableName, SkuInfo.VariableOffset)) if IsStructure: OverrideValues =3D Pcd.SkuOverrideValues[S= ku] - Struct =3D OverrideValues[DefaultStore] - self.PrintStructureInfo(File, Struct) + OverrideFieldStruct =3D self.OverrideField= Value(Pcd, OverrideValues[DefaultStore]) + self.PrintStructureInfo(File, OverrideFiel= dStruct) self.PrintPcdDefault(File, Pcd, IsStructure, D= scMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultVa= lue) else: Value =3D SkuInfo.DefaultValue IsByteArray, ArrayList =3D ByteArrayForamt(Value) if FirstPrint: @@ -1228,16 +1272,26 @@ class PcdReport(object): FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.= VpdOffset)) if IsStructure: OverrideValues =3D Pcd.SkuOverrideValues[Sku] if OverrideValues: Keys =3D OverrideValues.keys() - Struct =3D OverrideValues[Keys[0]] - self.PrintStructureInfo(File, Struct) + OverrideFieldStruct =3D self.OverrideFieldValu= e(Pcd, OverrideValues[Keys[0]]) + self.PrintStructureInfo(File, OverrideFieldStr= uct) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch,= DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) =20 + def OverrideFieldValue(self, Pcd, OverrideStruct): + OverrideFieldStruct =3D collections.OrderedDict() + if OverrideStruct: + for Key, Values in OverrideStruct.items(): + if Values[1] and Values[1].endswith('.dsc'): + OverrideFieldStruct[Key] =3D Values + if Pcd.PcdFieldValueFromComm: + for Key, Values in Pcd.PcdFieldValueFromComm.items(): + OverrideFieldStruct[Key] =3D Values + return OverrideFieldStruct + def PrintStructureInfo(self, File, Struct): - NewInfo =3D collections.OrderedDict() for Key, Value in Struct.items(): if Value[1] and 'build command options' in Value[1]: FileWrite(File, ' *B %-*s =3D %s' % (self.MaxLen + 4, = '.' + Key, Value[0])) else: FileWrite(File, ' %-*s =3D %s' % (self.MaxLen + 4, = '.' + Key, Value[0])) --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel