Revision: 19767
http://sourceforge.net/p/edk2/code/19767
Author: yzhu52
Date: 2016-01-29 04:48:55 +0000 (Fri, 29 Jan 2016)
Log Message:
-----------
BaseTools:Incremental build not work if VPD values in DSC changed by -D
If a -D flag is passed into build that selects different lines in
[PcdsDynamicExVpd], then build does not see any changes to the timestamp
of the DSC file and the VPD tool is not used to regenerate the VPD
region based in the statements that are active. so we changed the detect
condition and use SaveFileOnChange function to generate VPD.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Modified Paths:
--------------
trunk/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/edk2/BaseTools/Source/Python/Common/VpdInfoFile.py
Modified: trunk/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py 2016-01-29
04:46:47 UTC (rev 19766)
+++ trunk/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py 2016-01-29
04:48:55 UTC (rev 19767)
@@ -1256,7 +1256,6 @@
"Fail to get FLASH_DEFINITION definition in
DSC file %s which is required when DSC contains VPD PCD." %
str(self.Platform.MetaFile))
if VpdFile.GetCount() != 0:
- DscTimeStamp = self.Platform.MetaFile.TimeStamp
FvPath = os.path.join(self.BuildDir, "FV")
if not os.path.exists(FvPath):
try:
@@ -1264,13 +1263,9 @@
except:
EdkLogger.error("build", FILE_WRITE_FAILURE, "Fail to
create FV folder under %s" % self.BuildDir)
-
VpdFilePath = os.path.join(FvPath, "%s.txt" %
self.Platform.VpdToolGuid)
-
- if not os.path.exists(VpdFilePath) or
os.path.getmtime(VpdFilePath) < DscTimeStamp:
- VpdFile.Write(VpdFilePath)
-
+ if VpdFile.Write(VpdFilePath):
# retrieve BPDG tool's path from tool_def.txt according to
VPD_TOOL_GUID defined in DSC file.
BPDGToolName = None
for ToolDef in self.ToolDefinition.values():
Modified: trunk/edk2/BaseTools/Source/Python/Common/VpdInfoFile.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/Common/VpdInfoFile.py 2016-01-29
04:46:47 UTC (rev 19766)
+++ trunk/edk2/BaseTools/Source/Python/Common/VpdInfoFile.py 2016-01-29
04:48:55 UTC (rev 19767)
@@ -6,7 +6,7 @@
# is pointed by *_*_*_VPD_TOOL_GUID in conf/tools_def.txt
#
#
-# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
# 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
@@ -21,6 +21,7 @@
import Common.BuildToolError as BuildToolError
import subprocess
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.Misc import SaveFileOnChange
FILE_COMMENT_TEMPLATE = \
"""
@@ -124,35 +125,22 @@
if not (FilePath != None or len(FilePath) != 0):
EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,
"Invalid parameter FilePath: %s." % FilePath)
- try:
- fd = open(FilePath, "w")
- except:
- EdkLogger.error("VpdInfoFile",
- BuildToolError.FILE_OPEN_FAILURE,
- "Fail to open file %s for written." % FilePath)
-
- try:
- # write file header
- fd.write(FILE_COMMENT_TEMPLATE)
- # write each of PCD in VPD type
- Pcds = self._VpdArray.keys()
- Pcds.sort()
- for Pcd in Pcds:
- i = 0
- for Offset in self._VpdArray[Pcd]:
- PcdValue =
str(Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[i]].DefaultValue).strip()
- if PcdValue == "" :
- PcdValue = Pcd.DefaultValue
-
- fd.write("%s.%s|%s|%s|%s|%s \n" %
(Pcd.TokenSpaceGuidCName, Pcd.TokenCName,
str(Pcd.SkuInfoList.keys()[i]),str(Offset).strip(),
str(Pcd.MaxDatumSize).strip(),PcdValue))
- i += 1
- except:
- EdkLogger.error("VpdInfoFile",
- BuildToolError.FILE_WRITE_FAILURE,
- "Fail to write file %s" % FilePath)
- fd.close()
+ Content = FILE_COMMENT_TEMPLATE
+ Pcds = self._VpdArray.keys()
+ Pcds.sort()
+ for Pcd in Pcds:
+ i = 0
+ for Offset in self._VpdArray[Pcd]:
+ PcdValue =
str(Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[i]].DefaultValue).strip()
+ if PcdValue == "" :
+ PcdValue = Pcd.DefaultValue
+ Content += "%s.%s|%s|%s|%s|%s \n" % (Pcd.TokenSpaceGuidCName,
Pcd.TokenCName, str(Pcd.SkuInfoList.keys()[i]),str(Offset).strip(),
str(Pcd.MaxDatumSize).strip(),PcdValue)
+ i += 1
+
+ return SaveFileOnChange(FilePath, Content, False)
+
## Read an existing VPD PCD info file.
#
# This routine will read VPD PCD information from existing file and
construct
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits