From cc71d8b7f8e7013783bb3ce77ac375ecb94e107d Mon Sep 17 00:00:00 2001 From: Yonghong Zhu Date: Mon, 9 Oct 2017 21:15:04 +0800 Subject: [PATCH] BaseTools: Fix the bug 'DSC DEFAULT' in report wrongly use FDF value current the PCD value in DSC file may be override by FDF file, then it cause the 'DSC DEFAULT' in build report wrongly display the FDF value but not the DSC file's value. This patch add a attribute DscDefaultValue for PcdClassObject to save the actual DSC file's PCD value and use this value to display for 'DSC DEFAULT'. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- .../Python/Workspace/BuildClassObject.py | 7 +++++-- .../Python/Workspace/WorkspaceDatabase.py | 19 +++++++++---------- BaseTools/Source/Python/build/BuildReport.py | 7 ++++--- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index ea26e5e5a1..5fa497b803 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -1,7 +1,7 @@ ## @file # This file is used to define each component of the build database # -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -44,7 +44,7 @@ from Common.BuildToolError import * # @var Phase: To store value for Phase, default is "DXE" # class PcdClassObject(object): - def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], expressions = []): + def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], expressions = [], IsDsc = False): self.TokenCName = Name self.TokenSpaceGuidCName = Guid self.TokenSpaceGuidValue = GuidValue @@ -62,6 +62,9 @@ class PcdClassObject(object): self.validateranges = validateranges self.validlists = validlists self.expressions = expressions + self.DscDefaultValue = None + if IsDsc: + self.DscDefaultValue = Value ## Convert the class to a string # diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py index b61722144c..2c4b973901 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -885,8 +885,8 @@ class DscBuildData(PlatformBuildClassObject): MaxDatumSize, {}, False, - None - ) + None, + IsDsc=True) return Pcds ## Retrieve dynamic PCD settings @@ -950,9 +950,9 @@ class DscBuildData(PlatformBuildClassObject): MaxDatumSize, {SkuName : SkuInfo}, False, - None - ) - + None, + IsDsc=True) + for pcd in Pcds.values(): pcdDecObject = self._DecPcds[pcd.TokenCName,pcd.TokenSpaceGuidCName] if 'DEFAULT' not in pcd.SkuInfoList.keys() and 'COMMON' not in pcd.SkuInfoList.keys(): @@ -1069,9 +1069,8 @@ class DscBuildData(PlatformBuildClassObject): None, pcdDecObject.validateranges, pcdDecObject.validlists, - pcdDecObject.expressions - ) - + pcdDecObject.expressions, + IsDsc=True) for pcd in Pcds.values(): SkuInfoObj = pcd.SkuInfoList.values()[0] @@ -1179,8 +1178,8 @@ class DscBuildData(PlatformBuildClassObject): MaxDatumSize, {SkuName : SkuInfo}, False, - None - ) + None, + IsDsc=True) for pcd in Pcds.values(): SkuInfoObj = pcd.SkuInfoList.values()[0] pcdDecObject = self._DecPcds[pcd.TokenCName,pcd.TokenSpaceGuidCName] diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index f0e9093c7a..6a4d7e099b 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -833,7 +833,7 @@ class PcdReport(object): for Arch in Wa.ArchList: Platform = Wa.BuildDatabase[Wa.MetaFile, Arch, Wa.BuildTarget, Wa.ToolChain] for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds: - DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue + DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DscDefaultValue if DscDefaultValue: self.DscPcdDefault[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue @@ -914,6 +914,7 @@ class PcdReport(object): # DecDefaultValue = self.DecPcdDefault.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType)) DscDefaultValue = self.DscPcdDefault.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName)) + DscDefaultValBak= DscDefaultValue DscDefaultValue = self.FdfPcdSet.get((Pcd.TokenCName, Key), DscDefaultValue) InfDefaultValue = None @@ -1000,8 +1001,8 @@ class PcdReport(object): else: FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.VpdOffset)) - if not DscMatch and DscDefaultValue != None: - FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', DscDefaultValue.strip())) + if not DscMatch and DscDefaultValBak != None: + FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', DscDefaultValBak.strip())) if not InfMatch and InfDefaultValue != None: FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', InfDefaultValue.strip()))