From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.902.1581489213296208531 for ; Tue, 11 Feb 2020 22:33:33 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: zailiang.sun@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2020 22:33:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,428,1574150400"; d="scan'208";a="433941960" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga006.fm.intel.com with ESMTP; 11 Feb 2020 22:33:32 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 11 Feb 2020 22:33:32 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.5]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.158]) with mapi id 14.03.0439.000; Wed, 12 Feb 2020 14:33:30 +0800 From: "Sun, Zailiang" To: Gary Lin , "devel@edk2.groups.io" CC: "Qian, Yi" Subject: Re: [PATCH 2/2] Vlv2TbltDevicePkg/PreBuild.py: Remove unused functions Thread-Topic: [PATCH 2/2] Vlv2TbltDevicePkg/PreBuild.py: Remove unused functions Thread-Index: AQHV4W3Ws3QKzMcp9UqHASDDeTGCL6gXGVmA Date: Wed, 12 Feb 2020 06:33:30 +0000 Message-ID: <7CB7EF03E15B5D48981329A508747A9850D28902@SHSMSX104.ccr.corp.intel.com> References: <20200212062403.21714-1-glin@suse.com> <20200212062403.21714-2-glin@suse.com> In-Reply-To: <20200212062403.21714-2-glin@suse.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: zailiang.sun@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Zailiang Sun -----Original Message----- From: Gary Lin =20 Sent: Wednesday, February 12, 2020 2:24 PM To: devel@edk2.groups.io Cc: Sun, Zailiang ; Qian, Yi Subject: [PATCH 2/2] Vlv2TbltDevicePkg/PreBuild.py: Remove unused functions Clean up the script. Cc: Zailiang Sun cc: Yi Qian Signed-off-by: Gary Lin --- Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py | 97 ------------------------= ---- 1 file changed, 97 deletions(-) diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py b/Platform/Intel/= Vlv2TbltDevicePkg/PreBuild.py index 220515c809..be1d23560e 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py +++ b/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py @@ -59,108 +59,12 @@ def NormalizePath(target): else: return os.path.normpath (target) =20 -def RemoveFile(target): - target =3D NormalizePath(target) - if not target or target =3D=3D os.pathsep: - Error ('RemoveFile() invalid target') - if os.path.exists(target): - os.remove (target) - Log ('remove %s' % (RelativePath (target))) - -def RemoveDirectory(target): - target =3D NormalizePath(target) - if not target or target =3D=3D os.pathsep: - Error ('RemoveDirectory() invalid target') - if os.path.exists(target): - Log ('rmdir %s' % (RelativePath (target))) - shutil.rmtree(target) - def CreateDirectory(target): target =3D NormalizePath(target) if not os.path.exists(target): Log ('mkdir %s' % (RelativePath (target))) os.makedirs (target) =20 -def Copy(src, dst): - src =3D NormalizePath(src) - dst =3D NormalizePath(dst) - for File in glob.glob(src): - Log ('copy %s -> %s' % (RelativePath (File), RelativePath (dst))) - shutil.copy (File, dst) - -def GenCapsuleDevice (BaseName, PayloadFileName, Guid, Version, Lsv, Capsu= lesPath, CapsulesSubDir): - global gBaseToolsPath - LogAlways ('Generate Capsule: {0} {1:08x} {2:08x} {3}'.format (Guid, V= ersion, Lsv, PayloadFileName)) - - VersionString =3D '.'.join([str(ord(x)) for x in struct.pack('>I', Ver= sion).decode()]) - - FmpCapsuleFile =3D NormalizePath ((CapsulesPath, CapsulesSubDir, BaseN= ame + '.' + VersionString + '.cap')) - Command =3D GenerateCapsuleCommand.format ( - FMP_CAPSULE_GUID =3D Guid, - FMP_CAPSULE_VERSION =3D Version, - FMP_CAPSULE_LSV =3D Lsv, - BASE_TOOLS_PATH =3D gBaseToolsPath, - FMP_CAPSULE_FILE =3D FmpCapsuleFile, - FMP_CAPSULE_PAYLOAD =3D PayloadFileName - ) - Command =3D ' '.join(Command.splitlines()).strip() - if gArgs.Verbose: - Command =3D Command + ' -v' - - Log (Command) - - Process =3D subprocess.Popen(Command, stdin=3Dsubprocess.PIPE, stdout= =3Dsubprocess.PIPE, stderr=3Dsubprocess.PIPE, shell=3DTrue) - ProcessOutput =3D Process.communicate() - - if Process.returncode =3D=3D 0: - Log (ProcessOutput[0].decode()) - else: - LogAlways (Command) - LogAlways (ProcessOutput[0].decode()) - Error ('GenerateCapsule returned an error') - - Copy (PayloadFileName, (CapsulesPath, 'firmware.bin')) - MetaInfoXml =3D MetaInfoXmlTemplate - MetaInfoXml =3D MetaInfoXml.replace ('FMP_CAPSULE_GUID', Guid) - MetaInfoXml =3D MetaInfoXml.replace ('FMP_CAPSULE_BASE_NAME', BaseName= ) - MetaInfoXml =3D MetaInfoXml.replace ('FMP_CAPSULE_VERSION_DECIMAL', st= r(Version)) - MetaInfoXml =3D MetaInfoXml.replace ('FMP_CAPSULE_STRING', VersionStri= ng) - MetaInfoXml =3D MetaInfoXml.replace ('FMP_CAPSULE_DATE', str(datetime.= date.today())) - f =3D open (NormalizePath ((CapsulesPath, 'firmware.metainfo.xml')), '= w') - f.write(MetaInfoXml) - f.close() - - f =3D open (NormalizePath ((CapsulesPath, 'Lvfs.ddf')), 'w') - f.write(LvfsDdfTemplate) - f.close() - - if sys.platform =3D=3D "win32": - Command =3D 'makecab /f ' + NormalizePath ((CapsulesPath, 'Lvfs.dd= f')) - else: - Command =3D 'gcab --create firmware.cab firmware.bin firmware.meta= info.xml' - Log (Command) - - Process =3D subprocess.Popen(Command, cwd=3DCapsulesPath, stdin=3Dsubp= rocess.PIPE, stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.PIPE, shell=3DTr= ue) - ProcessOutput =3D Process.communicate() - - if Process.returncode =3D=3D 0: - Log (ProcessOutput[0].decode()) - else: - LogAlways (Command) - LogAlways (ProcessOutput[0].decode()) - Error ('GenerateCapsule returned an error') - - FmpCabinetFile =3D NormalizePath ((CapsulesPath, CapsulesSubDir, BaseN= ame + '.' + VersionString + '.cab')) - - Copy ((CapsulesPath, 'firmware.cab'), FmpCabinetFile) - - RemoveFile ((CapsulesPath, 'firmware.cab')) - RemoveFile ((CapsulesPath, 'setup.inf')) - RemoveFile ((CapsulesPath, 'setup.rpt')) - RemoveFile ((CapsulesPath, 'Lvfs.ddf')) - RemoveFile ((CapsulesPath, 'firmware.metainfo.xml')) - RemoveFile ((CapsulesPath, 'firmware.bin')) - BiosIdTemplate =3D ''' BOARD_ID =3D MNW2MAX BOARD_REV =3D $BOARD_REV @@ -170,7 +74,6 @@ BUILD_TYPE =3D $BUILD_TYPE VERSION_MINOR =3D 01 ''' =20 - if __name__ =3D=3D '__main__': # # Create command line argument parser object --=20 2.16.4