From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=chasel.chiu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 C63E421A07A80 for ; Wed, 26 Sep 2018 04:57:52 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2018 04:57:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,306,1534834800"; d="scan'208";a="236066753" Received: from cchiu4-mobl1.gar.corp.intel.com ([10.5.240.23]) by orsmga004.jf.intel.com with ESMTP; 26 Sep 2018 04:57:44 -0700 From: "Chasel, Chiu" To: edk2-devel@lists.01.org Cc: Jiewen Yao , Gao Liming , Zhu Yonghong , Chasel Chiu Date: Wed, 26 Sep 2018 19:57:41 +0800 Message-Id: <20180926115741.12608-1-chasel.chiu@intel.com> X-Mailer: git-send-email 2.13.3.windows.1 Subject: [PATCH] GenCfgOpt.py: remove tailing space from output file X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2018 11:57:53 -0000 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 Cc: Gao Liming Cc: Zhu Yonghong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chasel Chiu --- IntelFsp2Pkg/Tools/GenCfgOpt.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py index c9b7bc5373..7e61b00ab8 100644 --- a/IntelFsp2Pkg/Tools/GenCfgOpt.py +++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py @@ -1,6 +1,6 @@ ## @ GenCfgOpt.py # -# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2018, 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 that accompanies this distribution. # The full text of the license may be found at @@ -976,6 +976,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 @@ -1175,7 +1182,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() @@ -1220,7 +1227,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() -- 2.13.3.windows.1