diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2016-01-29 04:48:55 +0000 |
---|---|---|
committer | yzhu52 <yzhu52@Edk2> | 2016-01-29 04:48:55 +0000 |
commit | e459de78001be89d37cc286d0fcd57f92e1a438a (patch) | |
tree | 6f68e08d3562248d0ca6865b913d32e911dcbf3c /BaseTools/Source/Python/Common | |
parent | d66670f9ea830c8f6e1f21b2deeca58128e3bfde (diff) | |
download | edk2-platforms-e459de78001be89d37cc286d0fcd57f92e1a438a.tar.xz |
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 <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19767 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Common')
-rw-r--r-- | BaseTools/Source/Python/Common/VpdInfoFile.py | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py index 1a68e9bee1..dc8ece9608 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -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.EdkLogger as EdkLogger import Common.BuildToolError as BuildToolError
import subprocess
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.Misc import SaveFileOnChange
FILE_COMMENT_TEMPLATE = \
"""
@@ -124,34 +125,21 @@ class VpdInfoFile: 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.
#
|