public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zhu, Yonghong" <yonghong.zhu@intel.com>
To: "Chen, Hesheng" <hesheng.chen@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [patch] BaseTools/UPT: Fix an issue of adding Event twice
Date: Thu, 9 Mar 2017 06:53:14 +0000	[thread overview]
Message-ID: <B9726D6DCCFB8B4CA276A9169B02216D51E246E2@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1488873685-16456-1-git-send-email-hesheng.chen@intel.com>

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Chen, Hesheng 
Sent: Tuesday, March 07, 2017 4:01 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [patch] BaseTools/UPT: Fix an issue of adding Event twice

Fix the issue of after installing a package the Event information is duplicated. 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 <hesheng.chen@intel.com>
---
 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/BaseTools/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.<BR>
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights 
+reserved.<BR>
 #
 # This program and the accompanying materials are licensed and made available  # under the terms and conditions of the BSD License which accompanies this @@ -169,15 +169,16 @@ def ModuleToInf(ModuleObject, PackageObject=None, DistHeader=None):
     Content += GenGuidSections(ModuleObject.GetGuidList())
     Content += GenBinaries(ModuleObject)
     Content += GenDepex(ModuleObject)
-    Content += GenUserExtensions(ModuleObject)
+    __UserExtensionsContent = GenUserExtensions(ModuleObject)
+    Content += __UserExtensionsContent
     if ModuleObject.GetEventList() or ModuleObject.GetBootModeList() or ModuleObject.GetHobList():
         Content += '\n'
     #
     # generate [Event], [BootMode], [Hob] section
     #
-    Content += GenSpecialSections(ModuleObject.GetEventList(), 'Event')
-    Content += GenSpecialSections(ModuleObject.GetBootModeList(), 'BootMode')
-    Content += GenSpecialSections(ModuleObject.GetHobList(), 'Hob')
+    Content += GenSpecialSections(ModuleObject.GetEventList(), 'Event', __UserExtensionsContent)
+    Content += GenSpecialSections(ModuleObject.GetBootModeList(), 'BootMode', __UserExtensionsContent)
+    Content += GenSpecialSections(ModuleObject.GetHobList(), 'Hob', 
+ __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 GenSpecialSections(ObjectList, SectionName):
+def GenSpecialSections(ObjectList, SectionName, UserExtensionsContent=''):
     #
     # generate section
     #
@@ -1002,6 +1003,11 @@ def GenSpecialSections(ObjectList, SectionName):
         else:
             assert(SectionName)
         Usage = Obj.GetUsage()
+
+        # If the content already in UserExtensionsContent then ignore
+        if '[%s]' % SectionName in UserExtensionsContent and Type in UserExtensionsContent:
+            return ''
+
         Statement = ' ' + Type + ' ## ' + Usage
         if CommentStr in ['#\n', '#\n#\n']:
             CommentStr = '#\n#\n#\n'
--
2.7.2.windows.1



      reply	other threads:[~2017-03-09  6:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07  8:01 [patch] BaseTools/UPT: Fix an issue of adding Event twice hesschen
2017-03-09  6:53 ` Zhu, Yonghong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B9726D6DCCFB8B4CA276A9169B02216D51E246E2@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox