From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 27BC521159809 for ; Wed, 26 Sep 2018 17:39:27 -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 fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2018 17:39:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,308,1534834800"; d="scan'208";a="236241496" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 26 Sep 2018 17:39:20 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 26 Sep 2018 17:39:20 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 26 Sep 2018 17:39:19 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.140]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.183]) with mapi id 14.03.0319.002; Thu, 27 Sep 2018 08:39:17 +0800 From: "Yao, Jiewen" To: "Chiu, Chasel" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH] GenCfgOpt.py: remove tailing space from output file Thread-Index: AQHUVZAuTvTzZR0vG0+9Vheovkms9qUDSd1w Date: Thu, 27 Sep 2018 00:39:16 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AD9E823@shsmsx102.ccr.corp.intel.com> References: <20180926115741.12608-1-chasel.chiu@intel.com> In-Reply-To: <20180926115741.12608-1-chasel.chiu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzJiYTFiNWMtZjJmZi00Y2FlLTliYjgtMGI5NGMyMDA1ODlmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibVRvRXBMXC9wR0FVSmJyZDdyS3dcL2hUeGtINU9iejhNNWdEbWRTM2hnbUdjeTMyakYxUFdCXC9vTVp3R2ttT0FtbyJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: Thu, 27 Sep 2018 00:39:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: jiewen.yao@intel.com > -----Original Message----- > From: Chiu, Chasel > Sent: Wednesday, September 26, 2018 7:58 PM > To: edk2-devel@lists.01.org > Cc: Yao, Jiewen ; Gao, Liming > ; Zhu, Yonghong ; Chiu, > Chasel > Subject: [PATCH] GenCfgOpt.py: remove tailing space from output file >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1212 >=20 > 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. >=20 > Test: Verified the patch can remove tailing space in > output header files when UPD DSC contains intentional > tailing white space. >=20 > 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(-) >=20 > 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 >=20 > + def WriteLinesWithoutTailingSpace (self, HeaderFd, Line): > + TxtBody2 =3D Line.splitlines(True) > + for Line2 in TxtBody2: > + Line2 =3D Line2.rstrip() > + Line2 +=3D '\n' > + HeaderFd.write (Line2) > + return 0 > def CreateHeaderFile (self, InputHeaderFile): > FvDir =3D self._FvDir >=20 > @@ -1175,7 +1182,7 @@ EndList > Index +=3D 1 > for Item in range(len(StructStart)): > if Index >=3D StructStartWithComment[Item] and > Index <=3D 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 +=3D 1 > for Item in range(len(StructStart)): > if Index >=3D StructStartWithComment[Item] and > Index <=3D 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