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: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
#\r
# This file contained the logical of transfer package object to INF files.\r
#\r
#\r
# This file contained the logical of transfer package object to INF files.\r
#\r
-# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials are licensed and made available \r
# under the terms and conditions of the BSD License which accompanies this \r
#\r
# This program and the accompanying materials are licensed and made available \r
# under the terms and conditions of the BSD License which accompanies this \r
Content += GenGuidSections(ModuleObject.GetGuidList())\r
Content += GenBinaries(ModuleObject)\r
Content += GenDepex(ModuleObject)\r
Content += GenGuidSections(ModuleObject.GetGuidList())\r
Content += GenBinaries(ModuleObject)\r
Content += GenDepex(ModuleObject)\r
- Content += GenUserExtensions(ModuleObject)\r
+ __UserExtensionsContent = GenUserExtensions(ModuleObject)\r
+ Content += __UserExtensionsContent\r
if ModuleObject.GetEventList() or ModuleObject.GetBootModeList() or ModuleObject.GetHobList():\r
Content += '\n'\r
#\r
# generate [Event], [BootMode], [Hob] section\r
#\r
if ModuleObject.GetEventList() or ModuleObject.GetBootModeList() or ModuleObject.GetHobList():\r
Content += '\n'\r
#\r
# generate [Event], [BootMode], [Hob] section\r
#\r
- Content += GenSpecialSections(ModuleObject.GetEventList(), 'Event')\r
- Content += GenSpecialSections(ModuleObject.GetBootModeList(), 'BootMode')\r
- Content += GenSpecialSections(ModuleObject.GetHobList(), 'Hob')\r
+ Content += GenSpecialSections(ModuleObject.GetEventList(), 'Event', __UserExtensionsContent)\r
+ Content += GenSpecialSections(ModuleObject.GetBootModeList(), 'BootMode', __UserExtensionsContent)\r
+ Content += GenSpecialSections(ModuleObject.GetHobList(), 'Hob', __UserExtensionsContent)\r
SaveFileOnChange(ContainerFile, Content, False)\r
if DistHeader.ReadOnly:\r
os.chmod(ContainerFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)\r
SaveFileOnChange(ContainerFile, Content, False)\r
if DistHeader.ReadOnly:\r
os.chmod(ContainerFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)\r
## GenSpecialSections\r
# generate special sections for Event/BootMode/Hob\r
#\r
## GenSpecialSections\r
# generate special sections for Event/BootMode/Hob\r
#\r
-def GenSpecialSections(ObjectList, SectionName):\r
+def GenSpecialSections(ObjectList, SectionName, UserExtensionsContent=''):\r
#\r
# generate section\r
#\r
#\r
# generate section\r
#\r
else:\r
assert(SectionName)\r
Usage = Obj.GetUsage()\r
else:\r
assert(SectionName)\r
Usage = Obj.GetUsage()\r
+\r
+ # If the content already in UserExtensionsContent then ignore\r
+ if '[%s]' % SectionName in UserExtensionsContent and Type in UserExtensionsContent:\r
+ return ''\r
+\r
Statement = ' ' + Type + ' ## ' + Usage\r
if CommentStr in ['#\n', '#\n#\n']:\r
CommentStr = '#\n#\n#\n'\r
Statement = ' ' + Type + ' ## ' + Usage\r
if CommentStr in ['#\n', '#\n#\n']:\r
CommentStr = '#\n#\n#\n'\r