summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChasel, Chiu <chasel.chiu@intel.com>2018-09-26 19:50:42 +0800
committerChasel, Chiu <chasel.chiu@intel.com>2018-10-25 09:19:33 +0800
commit26cc0f28e5f0303d2701eefd39b6172fb91380cd (patch)
tree17df8379f3587224d4e75ac7af53254bc48703cf
parentb955ab0f0bbe405f7393e1db97e7d1a790f5eebd (diff)
downloadedk2-26cc0f28e5f0303d2701eefd39b6172fb91380cd.zip
edk2-26cc0f28e5f0303d2701eefd39b6172fb91380cd.tar.gz
edk2-26cc0f28e5f0303d2701eefd39b6172fb91380cd.tar.bz2
IntelFsp2Pkg/GenCfgOpt.py: remove tailing space from output file
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1212 UPD header files generated by GenCfgOpt.py may have tailing white space from some of the UPD description in DSC, especially when python script automatically switching lines for long description string. This patch will always remove tailing white space for UPD header files. Test: Verified the patch can remove tailing space in output header files when UPD DSC contains intentional tailing white space. Cc: Jiewen Yao <Jiewen.yao@intel.com> Cc: Gao Liming <liming.gao@intel.com> Cc: Zhu Yonghong <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chasel Chiu <chasel.chiu@intel.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> (cherry picked from commit d75c07bc689d33564fb481c275f6fa4e0c62d9ef)
-rw-r--r--IntelFsp2Pkg/Tools/GenCfgOpt.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py
index 04b61a5..059cfcb 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -1038,6 +1038,13 @@ EndList
NewTextBody.extend(OldTextBody)
return NewTextBody
+ def WriteLinesWithoutTailingSpace (self, HeaderFd, Line):
+ TxtBody2 = Line.splitlines(True)
+ for Line2 in TxtBody2:
+ Line2 = Line2.rstrip()
+ Line2 += '\n'
+ HeaderFd.write (Line2)
+ return 0
def CreateHeaderFile (self, InputHeaderFile):
FvDir = self._FvDir
@@ -1237,7 +1244,7 @@ EndList
Index += 1
for Item in range(len(StructStart)):
if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:
- HeaderFd.write (Line)
+ self.WriteLinesWithoutTailingSpace(HeaderFd, Line)
HeaderFd.write("#pragma pack()\n\n")
HeaderFd.write("#endif\n")
HeaderFd.close()
@@ -1282,7 +1289,7 @@ EndList
Index += 1
for Item in range(len(StructStart)):
if Index >= StructStartWithComment[Item] and Index <= StructEnd[Item]:
- HeaderFd.write (Line)
+ self.WriteLinesWithoutTailingSpace(HeaderFd, Line)
HeaderFd.write("#pragma pack()\n\n")
HeaderFd.write("#endif\n")
HeaderFd.close()