From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 71FB180369 for ; Wed, 8 Mar 2017 22:53:24 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2017 22:53:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,267,1486454400"; d="scan'208";a="74019378" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga005.fm.intel.com with ESMTP; 08 Mar 2017 22:53:17 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 8 Mar 2017 22:53:17 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.177]) with mapi id 14.03.0248.002; Thu, 9 Mar 2017 14:53:14 +0800 From: "Zhu, Yonghong" To: "Chen, Hesheng" , "edk2-devel@lists.01.org" Thread-Topic: [patch] BaseTools/UPT: Fix an issue of adding Event twice Thread-Index: AQHSlxkTlxE8/mhebU6jrCjxUhnTIqGMFXBA Date: Thu, 9 Mar 2017 06:53:14 +0000 Message-ID: References: <1488873685-16456-1-git-send-email-hesheng.chen@intel.com> In-Reply-To: <1488873685-16456-1-git-send-email-hesheng.chen@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [patch] BaseTools/UPT: Fix an issue of adding Event twice X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Mar 2017 06:53:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu Best Regards, Zhu Yonghong -----Original Message----- From: Chen, Hesheng=20 Sent: Tuesday, March 07, 2017 4:01 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong Subject: [patch] BaseTools/UPT: Fix an issue of adding Event twice Fix the issue of after installing a package the Event information is duplic= ated. The tool checks if the EVENT information existing in UserExtension or= not. If already existing in UserExtension the tool will not add additional= information. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: hesschen --- BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py | 18 ++++++++++++---= --- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTo= ols/Source/Python/UPT/GenMetaFile/GenInfFile.py index c1362e6..bb8a120 100644 --- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py +++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py @@ -2,7 +2,7 @@ # # This file contained the logical of transfer package object to INF files. # -# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights=20 +reserved.
# # This program and the accompanying materials are licensed and made availa= ble # under the terms and conditions of the BSD License which accompanies = this @@ -169,15 +169,16 @@ def ModuleToInf(ModuleObject, PackageObject=3DNo= ne, DistHeader=3DNone): Content +=3D GenGuidSections(ModuleObject.GetGuidList()) Content +=3D GenBinaries(ModuleObject) Content +=3D GenDepex(ModuleObject) - Content +=3D GenUserExtensions(ModuleObject) + __UserExtensionsContent =3D GenUserExtensions(ModuleObject) + Content +=3D __UserExtensionsContent if ModuleObject.GetEventList() or ModuleObject.GetBootModeList() or Mo= duleObject.GetHobList(): Content +=3D '\n' # # generate [Event], [BootMode], [Hob] section # - Content +=3D GenSpecialSections(ModuleObject.GetEventList(), 'Event') - Content +=3D GenSpecialSections(ModuleObject.GetBootModeList(), 'BootM= ode') - Content +=3D GenSpecialSections(ModuleObject.GetHobList(), 'Hob') + Content +=3D GenSpecialSections(ModuleObject.GetEventList(), 'Event', = __UserExtensionsContent) + Content +=3D GenSpecialSections(ModuleObject.GetBootModeList(), 'BootM= ode', __UserExtensionsContent) + Content +=3D GenSpecialSections(ModuleObject.GetHobList(), 'Hob',=20 + __UserExtensionsContent) SaveFileOnChange(ContainerFile, Content, False) if DistHeader.ReadOnly: os.chmod(ContainerFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH) @@ -979,7 +980,7 @@ def GenAsBuiltPcdExSections(ModuleObject): ## GenSpecialSections # generate special sections for Event/BootMode/Hob # -def GenSpecialSect= ions(ObjectList, SectionName): +def GenSpecialSections(ObjectList, SectionName, UserExtensionsContent=3D''= ): # # generate section # @@ -1002,6 +1003,11 @@ def GenSpecialSections(ObjectList, SectionName): else: assert(SectionName) Usage =3D Obj.GetUsage() + + # If the content already in UserExtensionsContent then ignore + if '[%s]' % SectionName in UserExtensionsContent and Type in UserE= xtensionsContent: + return '' + Statement =3D ' ' + Type + ' ## ' + Usage if CommentStr in ['#\n', '#\n#\n']: CommentStr =3D '#\n#\n#\n' -- 2.7.2.windows.1