summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
diff options
context:
space:
mode:
authorHess Chen <hesheng.chen@intel.com>2014-08-26 05:58:02 +0000
committerhchen30 <hchen30@6f19259b-4bc3-4df7-8a09-765794883524>2014-08-26 05:58:02 +0000
commit421ccda3079077dd613308526e02d797f5cc356a (patch)
treeecf0907550f140643cb5ab965fd3b87d837b8ee4 /BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
parentf0aa06e385c41743ac805bed9469aac336a6ec4c (diff)
downloadedk2-platforms-421ccda3079077dd613308526e02d797f5cc356a.tar.xz
This patch is going to:
1. Add a recovery mode for UPT failure 2. Add UNI file support 3. Add binary file header support 4. Add support for PCD error message 5. Add support for replace 6. Format generated INF/DEC files 7. Update dependency check 8. Other minor fixes Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen <hesheng.chen@intel.com> Reviewed-by: Gao, Liming <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15896 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py')
-rw-r--r--BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py542
1 files changed, 339 insertions, 203 deletions
diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
index 78bb6ea4f1..0daa96af25 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, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2014, 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
@@ -15,16 +15,22 @@
'''
GenInf
'''
-from os import getenv
+import os
+import stat
+import codecs
+import md5
+from Core.FileHook import __FileHookOpen__
from Library.String import GetSplitValueList
from Library.Parsing import GenSection
from Library.Parsing import GetWorkspacePackage
-from Library.Parsing import ConvertArchForInstall
+from Library.Parsing import ConvertArchForInstall
from Library.Misc import SaveFileOnChange
from Library.Misc import IsAllModuleList
from Library.Misc import Sdict
from Library.Misc import ConvertPath
from Library.Misc import ConvertSpec
+from Library.Misc import GetRelativePath
+from Library.Misc import GetLocalValue
from Library.CommentGenerating import GenHeaderCommentSection
from Library.CommentGenerating import GenGenericCommentF
from Library.CommentGenerating import _GetHelpStr
@@ -34,29 +40,107 @@ from Logger import ToolError
import Logger.Log as Logger
from Library import DataType as DT
from GenMetaFile import GenMetaFileMisc
+from Library.UniClassObject import FormatUniEntry
+
## Transfer Module Object to Inf files
#
# Transfer all contents of a standard Module Object to an Inf file
# @param ModuleObject: A Module Object
#
-def ModuleToInf(ModuleObject):
- if not GlobalData.gWSPKG_LIST:
+def ModuleToInf(ModuleObject, PackageObject=None, DistHeader=None):
+ if not GlobalData.gWSPKG_LIST:
GlobalData.gWSPKG_LIST = GetWorkspacePackage()
-
#
# Init global information for the file
#
ContainerFile = ModuleObject.GetFullPath()
+
Content = ''
#
- # generate header comment section
+ # Generate file header, If any Abstract, Description, Copyright or License XML elements are missing,
+ # should 1) use the Abstract, Description, Copyright or License from the PackageSurfaceArea.Header elements
+ # that the module belongs to, or 2) if this is a stand-alone module that is not included in a PackageSurfaceArea,
+ # use the abstract, description, copyright or license from the DistributionPackage.Header elements.
+ #
+ ModuleAbstract = GetLocalValue(ModuleObject.GetAbstract())
+ if not ModuleAbstract and PackageObject:
+ ModuleAbstract = GetLocalValue(PackageObject.GetAbstract())
+ if not ModuleAbstract and DistHeader:
+ ModuleAbstract = GetLocalValue(DistHeader.GetAbstract())
+ ModuleDescription = GetLocalValue(ModuleObject.GetDescription())
+ if not ModuleDescription and PackageObject:
+ ModuleDescription = GetLocalValue(PackageObject.GetDescription())
+ if not ModuleDescription and DistHeader:
+ ModuleDescription = GetLocalValue(DistHeader.GetDescription())
+ ModuleCopyright = ''
+ for (Lang, Copyright) in ModuleObject.GetCopyright():
+ if Lang:
+ pass
+ ModuleCopyright = Copyright
+ if not ModuleCopyright and PackageObject:
+ for (Lang, Copyright) in PackageObject.GetCopyright():
+ if Lang:
+ pass
+ ModuleCopyright = Copyright
+ if not ModuleCopyright and DistHeader:
+ for (Lang, Copyright) in DistHeader.GetCopyright():
+ if Lang:
+ pass
+ ModuleCopyright = Copyright
+ ModuleLicense = ''
+ for (Lang, License) in ModuleObject.GetLicense():
+ if Lang:
+ pass
+ ModuleLicense = License
+ if not ModuleLicense and PackageObject:
+ for (Lang, License) in PackageObject.GetLicense():
+ if Lang:
+ pass
+ ModuleLicense = License
+ if not ModuleLicense and DistHeader:
+ for (Lang, License) in DistHeader.GetLicense():
+ if Lang:
+ pass
+ ModuleLicense = License
+
+ #
+ # Generate header comment section of INF file
#
- Content += GenHeaderCommentSection(ModuleObject.GetAbstract(),
- ModuleObject.GetDescription(),
- ModuleObject.GetCopyright(),
- ModuleObject.GetLicense())
-
+ Content += GenHeaderCommentSection(ModuleAbstract,
+ ModuleDescription,
+ ModuleCopyright,
+ ModuleLicense)
+
+ #
+ # Generate Binary Header
+ #
+ for UserExtension in ModuleObject.GetUserExtensionList():
+ if UserExtension.GetUserID() == DT.TAB_BINARY_HEADER_USERID \
+ and UserExtension.GetIdentifier() == DT.TAB_BINARY_HEADER_IDENTIFIER:
+ ModuleBinaryAbstract = GetLocalValue(UserExtension.GetBinaryAbstract())
+ ModuleBinaryDescription = GetLocalValue(UserExtension.GetBinaryDescription())
+ ModuleBinaryCopyright = ''
+ ModuleBinaryLicense = ''
+ for (Lang, Copyright) in UserExtension.GetBinaryCopyright():
+ ModuleBinaryCopyright = Copyright
+ for (Lang, License) in UserExtension.GetBinaryLicense():
+ ModuleBinaryLicense = License
+ if ModuleBinaryAbstract and ModuleBinaryDescription and \
+ ModuleBinaryCopyright and ModuleBinaryLicense:
+ Content += GenHeaderCommentSection(ModuleBinaryAbstract,
+ ModuleBinaryDescription,
+ ModuleBinaryCopyright,
+ ModuleBinaryLicense,
+ True)
+
+ #
+ # Generate MODULE_UNI_FILE for module
+ #
+ FileHeader = GenHeaderCommentSection(ModuleAbstract, ModuleDescription, ModuleCopyright, ModuleLicense, False, \
+ DT.TAB_COMMENT_EDK1_SPLIT)
+ GenModuleUNIEncodeFile(ModuleObject, FileHeader)
+
#
# Judge whether the INF file is an AsBuild INF.
#
@@ -64,7 +148,6 @@ def ModuleToInf(ModuleObject):
GlobalData.gIS_BINARY_INF = True
else:
GlobalData.gIS_BINARY_INF = False
-
#
# for each section, maintain a dict, sorted arch will be its key,
# statement list will be its data
@@ -72,8 +155,6 @@ def ModuleToInf(ModuleObject):
# 'Arch1' : [statement1, statement3]
# }
#
-
- #
# Gen section contents
#
Content += GenDefines(ModuleObject)
@@ -82,36 +163,110 @@ def ModuleToInf(ModuleObject):
Content += GenPackages(ModuleObject)
Content += GenPcdSections(ModuleObject)
Content += GenSources(ModuleObject)
- Content += GenProtocolPPiSections(ModuleObject.GetProtocolList(), True)
- Content += GenProtocolPPiSections(ModuleObject.GetPpiList(), False)
- Content += GenGuidSections(ModuleObject.GetGuidList())
+ Content += GenProtocolPPiSections(ModuleObject.GetProtocolList(), True)
+ Content += GenProtocolPPiSections(ModuleObject.GetPpiList(), False)
+ Content += GenGuidSections(ModuleObject.GetGuidList())
Content += GenBinaries(ModuleObject)
Content += GenDepex(ModuleObject)
- Content += GenUserExtensions(ModuleObject)
-
+ Content += GenUserExtensions(ModuleObject)
if ModuleObject.GetEventList() or ModuleObject.GetBootModeList() or ModuleObject.GetHobList():
- Content += '\n\n'
+ Content += '\n'
#
# generate [Event], [BootMode], [Hob] section
#
- Content += GenSpecialSections(ModuleObject.GetEventList(), 'Event')
+ Content += GenSpecialSections(ModuleObject.GetEventList(), 'Event')
Content += GenSpecialSections(ModuleObject.GetBootModeList(), 'BootMode')
Content += GenSpecialSections(ModuleObject.GetHobList(), 'Hob')
-
SaveFileOnChange(ContainerFile, Content, False)
+ if DistHeader.ReadOnly:
+ os.chmod(ContainerFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)
+ else:
+ os.chmod(ContainerFile, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH|stat.S_IWUSR|stat.S_IWGRP|stat.S_IWOTH)
return ContainerFile
+## GenModuleUNIEncodeFile
+# GenModuleUNIEncodeFile, default is a UCS-2LE encode file
+#
+def GenModuleUNIEncodeFile(ModuleObject, UniFileHeader='', Encoding=DT.TAB_ENCODING_UTF16LE):
+ GenUNIFlag = False
+ OnlyLANGUAGE_EN_X = True
+ BinaryAbstract = []
+ BinaryDescription = []
+ #
+ # If more than one language code is used for any element that would be present in the MODULE_UNI_FILE,
+ # then the MODULE_UNI_FILE must be created.
+ #
+ for (Key, Value) in ModuleObject.GetAbstract() + ModuleObject.GetDescription():
+ if Key == DT.TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+
+ for UserExtension in ModuleObject.GetUserExtensionList():
+ if UserExtension.GetUserID() == DT.TAB_BINARY_HEADER_USERID \
+ and UserExtension.GetIdentifier() == DT.TAB_BINARY_HEADER_IDENTIFIER:
+ for (Key, Value) in UserExtension.GetBinaryAbstract():
+ if Key == DT.TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+ BinaryAbstract.append((Key, Value))
+ for (Key, Value) in UserExtension.GetBinaryDescription():
+ if Key == DT.TAB_LANGUAGE_EN_X:
+ GenUNIFlag = True
+ else:
+ OnlyLANGUAGE_EN_X = False
+ BinaryDescription.append((Key, Value))
+
+
+ if not GenUNIFlag:
+ return
+ elif OnlyLANGUAGE_EN_X:
+ return
+ else:
+ ModuleObject.UNIFlag = True
+ ContainerFile = os.path.normpath(os.path.join(os.path.dirname(ModuleObject.GetFullPath()),
+ (ModuleObject.GetBaseName() + '.uni')))
+ if not os.path.exists(os.path.dirname(ModuleObject.GetFullPath())):
+ os.makedirs(os.path.dirname(ModuleObject.GetFullPath()))
+
+ Content = UniFileHeader + os.linesep
+ Content += DT.END_OF_LINE
+
+ Content += FormatUniEntry('#string ' + DT.TAB_INF_ABSTRACT, ModuleObject.GetAbstract(), ContainerFile) + os.linesep
+
+ Content += FormatUniEntry('#string ' + DT.TAB_INF_DESCRIPTION, ModuleObject.GetDescription(), ContainerFile) \
+ + os.linesep
+
+ BinaryAbstractString = FormatUniEntry('#string ' + DT.TAB_INF_BINARY_ABSTRACT, BinaryAbstract, ContainerFile)
+ if BinaryAbstractString:
+ Content += BinaryAbstractString + os.linesep
+
+ BinaryDescriptionString = FormatUniEntry('#string ' + DT.TAB_INF_BINARY_DESCRIPTION, BinaryDescription, \
+ ContainerFile)
+ if BinaryDescriptionString:
+ Content += BinaryDescriptionString + os.linesep
+
+ if not os.path.exists(ContainerFile):
+ File = codecs.open(ContainerFile, 'wb', Encoding)
+ File.write(u'\uFEFF' + Content)
+ File.stream.close()
+ Md5Sigature = md5.new(__FileHookOpen__(str(ContainerFile), 'rb').read())
+ Md5Sum = Md5Sigature.hexdigest()
+ if (ContainerFile, Md5Sum) not in ModuleObject.FileList:
+ ModuleObject.FileList.append((ContainerFile, Md5Sum))
+
+ return ContainerFile
def GenDefines(ModuleObject):
#
# generate [Defines] section
#
- Content = ''
- NewSectionDict = {}
+ Content = ''
+ NewSectionDict = {}
for UserExtension in ModuleObject.GetUserExtensionList():
DefinesDict = UserExtension.GetDefinesDict()
if not DefinesDict:
continue
-
for Statement in DefinesDict:
SortedArch = DT.TAB_ARCH_COMMON
if Statement.strip().startswith(DT.TAB_INF_DEFINES_CUSTOM_MAKEFILE):
@@ -123,52 +278,79 @@ def GenDefines(ModuleObject):
if SortedArch in NewSectionDict:
NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
else:
- NewSectionDict[SortedArch] = [Statement]
-
+ NewSectionDict[SortedArch] = [Statement]
SpecialStatementList = []
-
#
# Add INF_VERSION statement firstly
#
- Statement = 'INF_VERSION = 0x00010017'
+
+ LeftOffset = 31
+ # TAB_INF_DEFINES_INF_VERSION
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_INF_VERSION).ljust(LeftOffset) + u'= %s' % '0x00010017'
SpecialStatementList.append(Statement)
+ # BaseName
BaseName = ModuleObject.GetBaseName()
if BaseName.startswith('.') or BaseName.startswith('-'):
BaseName = '_' + BaseName
- Statement = '%s = %s' % (DT.TAB_INF_DEFINES_BASE_NAME, BaseName)
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_BASE_NAME).ljust(LeftOffset) + u'= %s' % BaseName
SpecialStatementList.append(Statement)
- Statement = '%s = %s' % (DT.TAB_INF_DEFINES_FILE_GUID, ModuleObject.GetGuid())
- SpecialStatementList.append(Statement)
- Statement = '%s = %s' % (DT.TAB_INF_DEFINES_VERSION_STRING, ModuleObject.GetVersion())
+
+ # TAB_INF_DEFINES_FILE_GUID
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_FILE_GUID).ljust(LeftOffset) + u'= %s' % ModuleObject.GetGuid()
SpecialStatementList.append(Statement)
+ # TAB_INF_DEFINES_VERSION_STRING
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_VERSION_STRING).ljust(LeftOffset) + u'= %s' % ModuleObject.GetVersion()
+ SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_VERSION_STRING
+ if ModuleObject.UNIFlag:
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_MODULE_UNI_FILE).ljust(LeftOffset) + \
+ u'= %s' % ModuleObject.GetBaseName() + '.uni'
+ SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_MODULE_TYPE
if ModuleObject.GetModuleType():
- Statement = '%s = %s' % (DT.TAB_INF_DEFINES_MODULE_TYPE, ModuleObject.GetModuleType())
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_MODULE_TYPE).ljust(LeftOffset) + u'= %s' % ModuleObject.GetModuleType()
SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_PCD_IS_DRIVER
if ModuleObject.GetPcdIsDriver():
- Statement = '%s = %s' % (DT.TAB_INF_DEFINES_PCD_IS_DRIVER, ModuleObject.GetPcdIsDriver())
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_PCD_IS_DRIVER).ljust(LeftOffset) + \
+ u'= %s' % ModuleObject.GetPcdIsDriver()
SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION
if ModuleObject.GetUefiSpecificationVersion():
- Statement = '%s = %s' % (DT.TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION, \
- ModuleObject.GetUefiSpecificationVersion())
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION).ljust(LeftOffset) + \
+ u'= %s' % ModuleObject.GetUefiSpecificationVersion()
SpecialStatementList.append(Statement)
+
+ # TAB_INF_DEFINES_PI_SPECIFICATION_VERSION
if ModuleObject.GetPiSpecificationVersion():
- Statement = '%s = %s' % (DT.TAB_INF_DEFINES_PI_SPECIFICATION_VERSION, ModuleObject.GetPiSpecificationVersion())
- SpecialStatementList.append(Statement)
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_PI_SPECIFICATION_VERSION).ljust(LeftOffset) + \
+ u'= %s' % ModuleObject.GetPiSpecificationVersion()
+ SpecialStatementList.append(Statement)
+
+ # LibraryClass
for LibraryClass in ModuleObject.GetLibraryClassList():
if LibraryClass.GetUsage() == DT.USAGE_ITEM_PRODUCES or \
LibraryClass.GetUsage() == DT.USAGE_ITEM_SOMETIMES_PRODUCES:
- Statement = '%s = %s' % (DT.TAB_INF_DEFINES_LIBRARY_CLASS, LibraryClass.GetLibraryClass())
+ Statement = (u'%s ' % DT.TAB_INF_DEFINES_LIBRARY_CLASS).ljust(LeftOffset) + \
+ u'= %s' % LibraryClass.GetLibraryClass()
if LibraryClass.GetSupModuleList():
Statement += '|' + DT.TAB_SPACE_SPLIT.join(l for l in LibraryClass.GetSupModuleList())
SpecialStatementList.append(Statement)
+
+ # Spec Item
for SpecItem in ModuleObject.GetSpecList():
Spec, Version = SpecItem
Spec = ConvertSpec(Spec)
Statement = '%s %s = %s' % (DT.TAB_INF_DEFINES_SPEC, Spec, Version)
SpecialStatementList.append(Statement)
-
+
+ # Extern
ExternList = []
for Extern in ModuleObject.GetExternList():
ArchList = Extern.GetSupArchList()
@@ -179,27 +361,23 @@ def GenDefines(ModuleObject):
HelpStringList = Extern.GetHelpTextList()
FFE = Extern.GetFeatureFlag()
ExternList.append([ArchList, EntryPoint, UnloadImage, Constructor, Destructor, FFE, HelpStringList])
-
#
# Add VALID_ARCHITECTURES information
#
ValidArchStatement = None
if ModuleObject.SupArchList:
- ValidArchStatement = '# ' + '\n'
+ ValidArchStatement = '\n' + '# ' + '\n'
ValidArchStatement += '# The following information is for reference only and not required by the build tools.\n'
ValidArchStatement += '# ' + '\n'
ValidArchStatement += '# VALID_ARCHITECTURES = %s' % (' '.join(ModuleObject.SupArchList)) + '\n'
- ValidArchStatement += '# ' + '\n'
-
+ ValidArchStatement += '# '
if DT.TAB_ARCH_COMMON not in NewSectionDict:
NewSectionDict[DT.TAB_ARCH_COMMON] = []
NewSectionDict[DT.TAB_ARCH_COMMON] = NewSectionDict[DT.TAB_ARCH_COMMON] + SpecialStatementList
GenMetaFileMisc.AddExternToDefineSec(NewSectionDict, DT.TAB_ARCH_COMMON, ExternList)
if ValidArchStatement is not None:
NewSectionDict[DT.TAB_ARCH_COMMON] = NewSectionDict[DT.TAB_ARCH_COMMON] + [ValidArchStatement]
-
Content += GenSection('Defines', NewSectionDict)
-
return Content
def GenLibraryClasses(ModuleObject):
@@ -223,17 +401,16 @@ def GenLibraryClasses(ModuleObject):
FFE = LibraryClass.GetFeatureFlag()
Statement += Name
if FFE:
- Statement += '|' + FFE
+ Statement += '|' + FFE
ModuleList = LibraryClass.GetSupModuleList()
ArchList = LibraryClass.GetSupArchList()
for Index in xrange(0, len(ArchList)):
ArchList[Index] = ConvertArchForInstall(ArchList[Index])
ArchList.sort()
SortedArch = ' '.join(ArchList)
-
KeyList = []
if not ModuleList or IsAllModuleList(ModuleList):
- KeyList = [SortedArch]
+ KeyList = [SortedArch]
else:
ModuleString = DT.TAB_VALUE_SPLIT.join(l for l in ModuleList)
if not ArchList:
@@ -241,7 +418,6 @@ def GenLibraryClasses(ModuleObject):
KeyList = [SortedArch + '.' + ModuleString]
else:
KeyList = [Arch + '.' + ModuleString for Arch in ArchList]
-
for Key in KeyList:
if Key in NewSectionDict:
NewSectionDict[Key] = NewSectionDict[Key] + [Statement]
@@ -254,9 +430,10 @@ def GenLibraryClasses(ModuleObject):
if not BinaryFile.AsBuiltList:
continue
for LibraryItem in BinaryFile.AsBuiltList[0].LibraryInstancesList:
- Statement = '# Guid: ' + LibraryItem.Guid + ' Version: ' + LibraryItem.Version
+ Statement = '# Guid: ' + LibraryItem.Guid + ' Version: ' + LibraryItem.Version
+
if len(BinaryFile.SupArchList) == 0:
- if LibraryClassDict.has_key('COMMON'):
+ if LibraryClassDict.has_key('COMMON') and Statement not in LibraryClassDict['COMMON']:
LibraryClassDict['COMMON'].append(Statement)
else:
LibraryClassDict['COMMON'] = ['## @LIB_INSTANCES']
@@ -264,13 +441,15 @@ def GenLibraryClasses(ModuleObject):
else:
for Arch in BinaryFile.SupArchList:
if LibraryClassDict.has_key(Arch):
- LibraryClassDict[Arch].append(Statement)
+ if Statement not in LibraryClassDict[Arch]:
+ LibraryClassDict[Arch].append(Statement)
+ else:
+ continue
else:
LibraryClassDict[Arch] = ['## @LIB_INSTANCES']
LibraryClassDict[Arch].append(Statement)
-
Content += GenSection('LibraryClasses', LibraryClassDict)
-
+
return Content
def GenPackages(ModuleObject):
@@ -279,7 +458,7 @@ def GenPackages(ModuleObject):
# generate [Packages] section
#
NewSectionDict = Sdict()
- WorkspaceDir = getenv('WORKSPACE')
+ WorkspaceDir = GlobalData.gWORKSPACE
for PackageDependency in ModuleObject.GetPackageDependencyList():
#
# Generate generic comment
@@ -288,11 +467,12 @@ def GenPackages(ModuleObject):
HelpText = PackageDependency.GetHelpText()
if HelpText:
HelpStr = HelpText.GetString()
- CommentStr = GenGenericCommentF(HelpStr)
+ CommentStr = GenGenericCommentF(HelpStr)
Statement = CommentStr
Guid = PackageDependency.GetGuid()
Version = PackageDependency.GetVersion()
FFE = PackageDependency.GetFeatureFlag()
+ Path = ''
#
# find package path/name
#
@@ -304,20 +484,18 @@ def GenPackages(ModuleObject):
#
# get relative path
#
- RelaPath = Path[Path.upper().find(WorkspaceDir.upper()) + len(WorkspaceDir) + 1:]
+ RelaPath = GetRelativePath(Path, WorkspaceDir)
Statement += RelaPath.replace('\\', '/')
if FFE:
- Statement += '|' + FFE
+ Statement += '|' + FFE
ArchList = PackageDependency.GetSupArchList()
ArchList.sort()
SortedArch = ' '.join(ArchList)
if SortedArch in NewSectionDict:
NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
else:
- NewSectionDict[SortedArch] = [Statement]
-
+ NewSectionDict[SortedArch] = [Statement]
Content += GenSection('Packages', NewSectionDict)
-
return Content
def GenSources(ModuleObject):
@@ -326,23 +504,20 @@ def GenSources(ModuleObject):
#
Content = ''
NewSectionDict = {}
-
- for Source in ModuleObject.GetSourceFileList():
+ for Source in ModuleObject.GetSourceFileList():
SourceFile = Source.GetSourceFile()
Family = Source.GetFamily()
FeatureFlag = Source.GetFeatureFlag()
SupArchList = Source.GetSupArchList()
SupArchList.sort()
- SortedArch = ' '.join(SupArchList)
-
+ SortedArch = ' '.join(SupArchList)
Statement = GenSourceStatement(ConvertPath(SourceFile), Family, FeatureFlag)
if SortedArch in NewSectionDict:
NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
else:
NewSectionDict[SortedArch] = [Statement]
-
Content += GenSection('Sources', NewSectionDict)
-
+
return Content
def GenDepex(ModuleObject):
@@ -359,7 +534,6 @@ def GenDepex(ModuleObject):
SupModList = Depex.GetModuleType()
Expression = Depex.GetDepex()
Statement = CommentStr + Expression
-
SupArchList.sort()
KeyList = []
if not SupArchList:
@@ -370,17 +544,14 @@ def GenDepex(ModuleObject):
for ModuleType in SupModList:
for Arch in SupArchList:
KeyList.append(ConvertArchForInstall(Arch) + '.' + ModuleType)
-
for Key in KeyList:
if Key in NewSectionDict:
NewSectionDict[Key] = NewSectionDict[Key] + [Statement]
else:
NewSectionDict[Key] = [Statement]
-
Content += GenSection('Depex', NewSectionDict, False)
return Content
-
## GenUserExtensions
#
# GenUserExtensions
@@ -388,17 +559,18 @@ def GenDepex(ModuleObject):
def GenUserExtensions(ModuleObject):
NewSectionDict = {}
for UserExtension in ModuleObject.GetUserExtensionList():
+ if UserExtension.GetUserID() == DT.TAB_BINARY_HEADER_USERID and \
+ UserExtension.GetIdentifier() == DT.TAB_BINARY_HEADER_IDENTIFIER:
+ continue
if UserExtension.GetIdentifier() == 'Depex':
continue
Statement = UserExtension.GetStatement()
if not Statement:
continue
-
ArchList = UserExtension.GetSupArchList()
for Index in xrange(0, len(ArchList)):
ArchList[Index] = ConvertArchForInstall(ArchList[Index])
ArchList.sort()
-
KeyList = []
CommonPreFix = ''
if UserExtension.GetUserID():
@@ -410,17 +582,16 @@ def GenUserExtensions(ModuleObject):
if ArchList:
KeyList = [CommonPreFix + '.' + Arch for Arch in ArchList]
else:
- KeyList = [CommonPreFix]
-
+ KeyList = [CommonPreFix]
for Key in KeyList:
if Key in NewSectionDict:
NewSectionDict[Key] = NewSectionDict[Key] + [Statement]
else:
NewSectionDict[Key] = [Statement]
Content = GenSection('UserExtensions', NewSectionDict, False)
-
+
return Content
-
+
# GenSourceStatement
#
# @param SourceFile: string of source file path/name
@@ -432,23 +603,21 @@ def GenUserExtensions(ModuleObject):
#
# @retval Statement: The generated statement for source
#
-def GenSourceStatement(SourceFile, Family, FeatureFlag, TagName=None,
+def GenSourceStatement(SourceFile, Family, FeatureFlag, TagName=None,
ToolCode=None, HelpStr=None):
Statement = ''
if HelpStr:
- Statement += GenGenericCommentF(HelpStr)
+ Statement += GenGenericCommentF(HelpStr)
#
# format of SourceFile|Family|TagName|ToolCode|FeatureFlag
#
Statement += SourceFile
-
if TagName == None:
TagName = ''
if ToolCode == None:
ToolCode = ''
if HelpStr == None:
HelpStr = ''
-
if FeatureFlag:
Statement += '|' + Family + '|' + TagName + '|' + ToolCode + '|' + FeatureFlag
elif ToolCode:
@@ -457,7 +626,6 @@ def GenSourceStatement(SourceFile, Family, FeatureFlag, TagName=None,
Statement += '|' + Family + '|' + TagName
elif Family:
Statement += '|' + Family
-
return Statement
# GenBinaryStatement
@@ -466,7 +634,7 @@ def GenSourceStatement(SourceFile, Family, FeatureFlag, TagName=None,
# @param Value: (Target, Family, TagName, Comment)
#
#
-def GenBinaryStatement(Key, Value):
+def GenBinaryStatement(Key, Value, SubTypeGuidValue=None):
(FileName, FileType, FFE, SortedArch) = Key
if SortedArch:
pass
@@ -477,14 +645,14 @@ def GenBinaryStatement(Key, Value):
Family = ''
TagName = ''
Comment = ''
-
if Comment:
Statement = GenGenericCommentF(Comment)
else:
Statement = ''
-
- Statement += FileType + '|' + FileName
-
+ if FileType == 'SUBTYPE_GUID' and SubTypeGuidValue:
+ Statement += FileType + '|' + SubTypeGuidValue + '|' + FileName
+ else:
+ Statement += FileType + '|' + FileName
if FileType in DT.BINARY_FILE_TYPE_UI_LIST + DT.BINARY_FILE_TYPE_VER_LIST:
if FFE:
Statement += '|' + Target + '|' + FFE
@@ -499,9 +667,7 @@ def GenBinaryStatement(Key, Value):
Statement += '|' + Target + '|' + Family
elif Target:
Statement += '|' + Target
-
return Statement
-
## GenGuidSections
#
# @param GuidObjList: List of GuidObject
@@ -511,26 +677,21 @@ def GenGuidSections(GuidObjList):
#
# generate [Guids] section
#
- Content = ''
+ Content = ''
GuidDict = Sdict()
-
for Guid in GuidObjList:
HelpTextList = Guid.GetHelpTextList()
HelpStr = _GetHelpStr(HelpTextList)
-
CName = Guid.GetCName()
FFE = Guid.GetFeatureFlag()
Statement = CName
if FFE:
Statement += '|' + FFE
-
Usage = Guid.GetUsage()
GuidType = Guid.GetGuidTypeList()[0]
VariableName = Guid.GetVariableName()
-
#
- # we need to differentiate the generic comment and usage comment
- # as multiple generic comment need to be put at first
+ # Differentiate the generic comment and usage comment as multiple generic comment need to be put at first
#
if Usage == DT.ITEM_UNDEFINED and GuidType == DT.ITEM_UNDEFINED:
# generate list of generic comment
@@ -543,17 +704,15 @@ def GenGuidSections(GuidObjList):
Comment = ' # ' + Comment
else:
Comment = ''
-
if Usage != DT.ITEM_UNDEFINED and GuidType == DT.ITEM_UNDEFINED:
- Comment = '## ' + Usage + Comment
+ Comment = '## ' + Usage + ' ## GUID ' + Comment
elif GuidType == 'Variable':
Comment = '## ' + Usage + ' ## ' + GuidType + ':' + VariableName + Comment
else:
Comment = '## ' + Usage + ' ## ' + GuidType + Comment
-
+
if Comment:
Comment += '\n'
-
#
# merge duplicate items
#
@@ -562,18 +721,15 @@ def GenGuidSections(GuidObjList):
SortedArch = ' '.join(ArchList)
if (Statement, SortedArch) in GuidDict:
PreviousComment = GuidDict[Statement, SortedArch]
- Comment = PreviousComment + Comment
+ Comment = PreviousComment + Comment
GuidDict[Statement, SortedArch] = Comment
-
-
- NewSectionDict = GenMetaFileMisc.TransferDict(GuidDict)
-
+ NewSectionDict = GenMetaFileMisc.TransferDict(GuidDict, 'INF_GUID')
#
# generate the section contents
#
if NewSectionDict:
Content = GenSection('Guids', NewSectionDict)
-
+
return Content
## GenProtocolPPiSections
@@ -587,19 +743,15 @@ def GenProtocolPPiSections(ObjList, IsProtocol):
for Object in ObjList:
HelpTextList = Object.GetHelpTextList()
HelpStr = _GetHelpStr(HelpTextList)
-
CName = Object.GetCName()
FFE = Object.GetFeatureFlag()
Statement = CName
if FFE:
Statement += '|' + FFE
-
Usage = Object.GetUsage()
Notify = Object.GetNotify()
-
#
- # we need to differentiate the generic comment and usage comment
- # as consecutive generic comment need to be put together
+ # Differentiate the generic comment and usage comment as consecutive generic comment need to be put together
#
if Usage == DT.ITEM_UNDEFINED and Notify == '':
# generate list of generic comment
@@ -612,7 +764,6 @@ def GenProtocolPPiSections(ObjList, IsProtocol):
Comment = ' # ' + Comment
else:
Comment = ''
-
if Usage == DT.ITEM_UNDEFINED and not Comment and Notify == '':
Comment = ''
else:
@@ -620,10 +771,8 @@ def GenProtocolPPiSections(ObjList, IsProtocol):
Comment = '## ' + Usage + ' ## ' + 'NOTIFY' + Comment
else:
Comment = '## ' + Usage + Comment
-
if Comment:
Comment += '\n'
-
#
# merge duplicate items
#
@@ -634,9 +783,7 @@ def GenProtocolPPiSections(ObjList, IsProtocol):
PreviousComment = Dict[Statement, SortedArch]
Comment = PreviousComment + Comment
Dict[Statement, SortedArch] = Comment
-
- NewSectionDict = GenMetaFileMisc.TransferDict(Dict)
-
+ NewSectionDict = GenMetaFileMisc.TransferDict(Dict, 'INF_PPI_PROTOCOL')
#
# generate the section contents
#
@@ -645,7 +792,7 @@ def GenProtocolPPiSections(ObjList, IsProtocol):
Content = GenSection('Protocols', NewSectionDict)
else:
Content = GenSection('Ppis', NewSectionDict)
-
+
return Content
## GenPcdSections
@@ -662,7 +809,6 @@ def GenPcdSections(ModuleObject):
for Pcd in ModuleObject.GetPcdList():
HelpTextList = Pcd.GetHelpTextList()
HelpStr = _GetHelpStr(HelpTextList)
-
Statement = ''
CName = Pcd.GetCName()
TokenSpaceGuidCName = Pcd.GetTokenSpaceGuidCName()
@@ -673,7 +819,6 @@ def GenPcdSections(ModuleObject):
else:
Dict = Sdict()
ItemTypeDict[ItemType] = Dict
-
FFE = Pcd.GetFeatureFlag()
Statement += TokenSpaceGuidCName + '.' + CName
if DefaultValue:
@@ -682,18 +827,14 @@ def GenPcdSections(ModuleObject):
Statement += '|' + FFE
elif FFE:
Statement += '||' + FFE
-
#
# Generate comment
#
Usage = Pcd.GetValidUsage()
-
- #
# if FeatureFlag Pcd, then assume all Usage is CONSUMES
- #
if ItemType == DT.TAB_INF_FEATURE_PCD:
Usage = DT.USAGE_ITEM_CONSUMES
- if Usage == DT.ITEM_UNDEFINED or (ItemType == DT.TAB_INF_FEATURE_PCD):
+ if Usage == DT.ITEM_UNDEFINED:
# generate list of generic comment
Comment = GenGenericCommentF(HelpStr)
else:
@@ -704,12 +845,9 @@ def GenPcdSections(ModuleObject):
Comment = ' # ' + Comment
else:
Comment = ''
-
Comment = '## ' + Usage + Comment
-
if Comment:
Comment += '\n'
-
#
# Merge duplicate entries
#
@@ -719,15 +857,11 @@ def GenPcdSections(ModuleObject):
if (Statement, SortedArch) in Dict:
PreviousComment = Dict[Statement, SortedArch]
Comment = PreviousComment + Comment
- Dict[Statement, SortedArch] = Comment
-
+ Dict[Statement, SortedArch] = Comment
for ItemType in ItemTypeDict:
- #
# First we need to transfer the Dict to use SortedArch as key
- #
Dict = ItemTypeDict[ItemType]
- NewSectionDict = GenMetaFileMisc.TransferDict(Dict)
-
+ NewSectionDict = GenMetaFileMisc.TransferDict(Dict, 'INF_PCD')
if NewSectionDict:
Content += GenSection(ItemType, NewSectionDict)
#
@@ -736,7 +870,7 @@ def GenPcdSections(ModuleObject):
else:
Content += GenAsBuiltPacthPcdSections(ModuleObject)
Content += GenAsBuiltPcdExSections(ModuleObject)
-
+
return Content
## GenPcdSections
@@ -746,8 +880,8 @@ def GenAsBuiltPacthPcdSections(ModuleObject):
PatchPcdDict = {}
for BinaryFile in ModuleObject.GetBinaryFileList():
if not BinaryFile.AsBuiltList:
- continue
- for PatchPcd in BinaryFile.AsBuiltList[0].PatchPcdList:
+ continue
+ for PatchPcd in BinaryFile.AsBuiltList[0].PatchPcdList:
TokenSpaceName = ''
PcdCName = PatchPcd.CName
PcdValue = PatchPcd.DefaultValue
@@ -758,31 +892,38 @@ def GenAsBuiltPacthPcdSections(ModuleObject):
HelpString = ''
for HelpStringItem in HelpTextList:
for HelpLine in GetSplitValueList(HelpStringItem.String, '\n'):
- HelpString += '# ' + HelpLine + '\n'
-
- TokenSpaceName, PcdCName = GenMetaFileMisc.ObtainPcdName(ModuleObject.PackageDependencyList,
- TokenSpaceGuidValue,
+ HelpString += '## ' + HelpLine + '\n'
+ TokenSpaceName, PcdCName = GenMetaFileMisc.ObtainPcdName(ModuleObject.PackageDependencyList,
+ TokenSpaceGuidValue,
Token)
- if TokenSpaceName == '' or PcdCName == '':
- Logger.Error("Upt",
+ if TokenSpaceName == '' or PcdCName == '':
+ Logger.Error("Upt",
ToolError.RESOURCE_NOT_AVAILABLE,
- ST.ERR_INSTALL_FILE_DEC_FILE_ERROR%(TokenSpaceGuidValue, Token),
- File=ModuleObject.GetFullPath())
- Statement = HelpString[:-3] + TokenSpaceName + '.' + PcdCName + ' | ' + PcdValue + ' | ' + PcdOffset
-
- if len(BinaryFile.SupArchList) == 0:
- if PatchPcdDict.has_key('COMMON'):
- PatchPcdDict['COMMON'].append(Statement)
+ ST.ERR_INSTALL_FILE_DEC_FILE_ERROR % (TokenSpaceGuidValue, Token),
+ File=ModuleObject.GetFullPath())
+ Statement = HelpString + TokenSpaceName + '.' + PcdCName + ' | ' + PcdValue + ' | ' + \
+ PcdOffset + DT.TAB_SPACE_SPLIT
+ #
+ # Use binary file's Arch to be Pcd's Arch
+ #
+ ArchList = []
+ FileNameObjList = BinaryFile.GetFileNameList()
+ if FileNameObjList:
+ ArchList = FileNameObjList[0].GetSupArchList()
+ if len(ArchList) == 0:
+ if PatchPcdDict.has_key(DT.TAB_ARCH_COMMON):
+ if Statement not in PatchPcdDict[DT.TAB_ARCH_COMMON]:
+ PatchPcdDict[DT.TAB_ARCH_COMMON].append(Statement)
else:
- PatchPcdDict['COMMON'] = [Statement]
+ PatchPcdDict[DT.TAB_ARCH_COMMON] = [Statement]
else:
- for Arch in BinaryFile.SupArchList:
+ for Arch in ArchList:
if PatchPcdDict.has_key(Arch):
- PatchPcdDict[Arch].append(Statement)
+ if Statement not in PatchPcdDict[Arch]:
+ PatchPcdDict[Arch].append(Statement)
else:
PatchPcdDict[Arch] = [Statement]
- return GenSection('PatchPcd', PatchPcdDict)
-
+ return GenSection(DT.TAB_INF_PATCH_PCD, PatchPcdDict)
## GenPcdSections
#
#
@@ -790,42 +931,49 @@ def GenAsBuiltPcdExSections(ModuleObject):
PcdExDict = {}
for BinaryFile in ModuleObject.GetBinaryFileList():
if not BinaryFile.AsBuiltList:
- continue
+ continue
for PcdExItem in BinaryFile.AsBuiltList[0].PcdExValueList:
TokenSpaceName = ''
PcdCName = PcdExItem.CName
- PcdValue = PcdExItem.DefaultValue
TokenSpaceGuidValue = PcdExItem.TokenSpaceGuidValue
Token = PcdExItem.Token
HelpTextList = PcdExItem.HelpTextList
HelpString = ''
for HelpStringItem in HelpTextList:
for HelpLine in GetSplitValueList(HelpStringItem.String, '\n'):
- HelpString += '# ' + HelpLine + '\n'
- TokenSpaceName, PcdCName = GenMetaFileMisc.ObtainPcdName(ModuleObject.PackageDependencyList,
+ HelpString += '## ' + HelpLine + '\n'
+ TokenSpaceName, PcdCName = GenMetaFileMisc.ObtainPcdName(ModuleObject.PackageDependencyList,
TokenSpaceGuidValue, Token)
-
- if TokenSpaceName == '' or PcdCName == '':
+ if TokenSpaceName == '' or PcdCName == '':
Logger.Error("Upt",
ToolError.RESOURCE_NOT_AVAILABLE,
- ST.ERR_INSTALL_FILE_DEC_FILE_ERROR%(TokenSpaceGuidValue, Token),
- File=ModuleObject.GetFullPath())
-
- Statement = HelpString[:-3] + TokenSpaceName + '.' + PcdCName + ' | ' + PcdValue
-
- if len(BinaryFile.SupArchList) == 0:
+ ST.ERR_INSTALL_FILE_DEC_FILE_ERROR % (TokenSpaceGuidValue, Token),
+ File=ModuleObject.GetFullPath())
+
+ Statement = HelpString + TokenSpaceName + DT.TAB_SPLIT + PcdCName + DT.TAB_SPACE_SPLIT
+
+ #
+ # Use binary file's Arch to be Pcd's Arch
+ #
+ ArchList = []
+ FileNameObjList = BinaryFile.GetFileNameList()
+ if FileNameObjList:
+ ArchList = FileNameObjList[0].GetSupArchList()
+
+ if len(ArchList) == 0:
if PcdExDict.has_key('COMMON'):
PcdExDict['COMMON'].append(Statement)
else:
PcdExDict['COMMON'] = [Statement]
else:
- for Arch in BinaryFile.SupArchList:
+ for Arch in ArchList:
if PcdExDict.has_key(Arch):
- PcdExDict[Arch].append(Statement)
+ if Statement not in PcdExDict[Arch]:
+ PcdExDict[Arch].append(Statement)
else:
PcdExDict[Arch] = [Statement]
return GenSection('PcdEx', PcdExDict)
-
+
## GenSpecialSections
# generate special sections for Event/BootMode/Hob
#
@@ -843,7 +991,6 @@ def GenSpecialSections(ObjectList, SectionName):
HelpTextList = Obj.GetHelpTextList()
HelpStr = _GetHelpStr(HelpTextList)
CommentStr = GenGenericCommentF(HelpStr)
-
if SectionName == 'Hob':
Type = Obj.GetHobType()
elif SectionName == 'Event':
@@ -852,25 +999,20 @@ def GenSpecialSections(ObjectList, SectionName):
Type = Obj.GetSupportedBootModes()
else:
assert(SectionName)
-
Usage = Obj.GetUsage()
Statement = ' ' + Type + ' ## ' + Usage
-
if CommentStr in ['#\n', '#\n#\n']:
CommentStr = '#\n#\n#\n'
#
- # the first head comment line should start with '##\n',
- # if it starts with '#\n', then add one '#'
+ # the first head comment line should start with '##\n', if it starts with '#\n', then add one '#'
# else add '##\n' to meet the format defined in INF spec
#
if CommentStr.startswith('#\n'):
CommentStr = '#' + CommentStr
elif CommentStr:
CommentStr = '##\n' + CommentStr
-
if CommentStr and not CommentStr.endswith('\n#\n'):
- CommentStr = CommentStr + '#\n'
-
+ CommentStr = CommentStr + '#\n'
NewStateMent = CommentStr + Statement
SupArch = Obj.GetSupArchList()
SupArch.sort()
@@ -879,20 +1021,17 @@ def GenSpecialSections(ObjectList, SectionName):
NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [NewStateMent]
else:
NewSectionDict[SortedArch] = [NewStateMent]
-
SectionContent = GenSection(SectionName, NewSectionDict)
SectionContent = SectionContent.strip()
if SectionContent:
Content = '# ' + ('\n' + '# ').join(GetSplitValueList(SectionContent, '\n'))
Content = Content.lstrip()
#
- # add two empty line after the generated section content to differentiate
- # it between other possible sections
- #
- if Content:
+ # add two empty line after the generated section content to differentiate it between other possible sections
+ #
+ if Content:
Content += '\n#\n#\n'
return Content
-
## GenBuildOptions
#
#
@@ -912,7 +1051,6 @@ def GenBuildOptions(ModuleObject):
NewSectionDict[Arch] = NewSectionDict[Arch] + [BuildOptionDict[Arch]]
else:
NewSectionDict[Arch] = [BuildOptionDict[Arch]]
-
Content = GenSection('BuildOptions', NewSectionDict)
else:
BuildOptionDict = {}
@@ -920,7 +1058,7 @@ def GenBuildOptions(ModuleObject):
if not BinaryFile.AsBuiltList:
continue
for BuilOptionItem in BinaryFile.AsBuiltList[0].BinaryBuildFlagList:
- Statement = '#' + BuilOptionItem.AsBuiltOptionFlags
+ Statement = '#' + BuilOptionItem.AsBuiltOptionFlags
if len(BinaryFile.SupArchList) == 0:
if BuildOptionDict.has_key('COMMON'):
if Statement not in BuildOptionDict['COMMON']:
@@ -936,11 +1074,9 @@ def GenBuildOptions(ModuleObject):
else:
BuildOptionDict[Arch] = ['## @AsBuilt']
BuildOptionDict[Arch].append(Statement)
-
Content = GenSection('BuildOptions', BuildOptionDict)
-
- return Content
+ return Content
## GenBinaries
#
#
@@ -951,7 +1087,6 @@ def GenBinaries(ModuleObject):
BinariesDict = UserExtension.GetBinariesDict()
if BinariesDict:
break
-
for BinaryFile in ModuleObject.GetBinaryFileList():
FileNameObjList = BinaryFile.GetFileNameList()
for FileNameObj in FileNameObjList:
@@ -960,10 +1095,8 @@ def GenBinaries(ModuleObject):
FFE = FileNameObj.GetFeatureFlag()
ArchList = FileNameObj.GetSupArchList()
ArchList.sort()
- SortedArch = ' '.join(ArchList)
-
+ SortedArch = ' '.join(ArchList)
Key = (FileName, FileType, FFE, SortedArch)
-
if Key in BinariesDict:
ValueList = BinariesDict[Key]
for ValueItem in ValueList:
@@ -973,16 +1106,19 @@ def GenBinaries(ModuleObject):
else:
NewSectionDict[SortedArch] = [Statement]
#
- # as we already generated statement for this DictKey
- # here set the Valuelist to be empty to avoid generate duplicate entries
- # as the DictKey may have multiple entries
+ # as we already generated statement for this DictKey here set the Valuelist to be empty
+ # to avoid generate duplicate entries as the DictKey may have multiple entries
#
BinariesDict[Key] = []
else:
- Statement = GenBinaryStatement(Key, None)
+ if FileType == 'SUBTYPE_GUID' and FileNameObj.GetGuidValue():
+ Statement = GenBinaryStatement(Key, None, FileNameObj.GetGuidValue())
+ else:
+ Statement = GenBinaryStatement(Key, None)
if SortedArch in NewSectionDict:
NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [Statement]
else:
- NewSectionDict[SortedArch] = [Statement]
-
- return GenSection('Binaries', NewSectionDict) \ No newline at end of file
+ NewSectionDict[SortedArch] = [Statement]
+ Content = GenSection('Binaries', NewSectionDict)
+
+ return Content