## @file InfPomAlignment.py
# This file contained the adapter for convert INF parser object to POM Object
#
# Copyright (c) 2011, 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
# distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
'''
InfPomAlignment
'''
##
# Import modules
#
## InfPomAlignment
#
# Inherit from ModuleObject
#
## Construct of InfPomAlignment
# Skip means that UPT don't care the syntax of INF, this may be the not
# distributed INF files during creation or the INF files checked for
# dependency rule during remove.
#
self.LibModuleTypeList = []
self.CustomMakefile = []
#
# Call GenInfPomObjects function to fill POM object.
#
if Skip:
else:
##
# Generate all POM objects, the original input comes
# from INF parser's output
#
#
# Call INF Parser to get information from INF file
#
#
# Call GenBinaries after Module Header for Binary INF consideration.
#
## Convert [Defines] section content to InfDefObject
#
# Convert [Defines] section content to InfDefObject
#
# @param Defines The content under [Defines] section
# @param ModuleHeader An object of ModuleHeaderClass
# @param Arch The supported ARCH
#
#
# Get all defines information form InfParser Object
#
#
# Should only have one ArchString Item.
#
#
# Get data from Sdict()
#
#
# The INF's filename (without the directory path or the extension)
# must be used for the value of the
# ModuleSurfaceArea.Header.Name element
#
#
# CombinePath and ModulePath
#
ModuleRelativePath = ModulePath[ModulePath.find(self.GetPackagePath()) + len(self.GetPackagePath()) + 1:]
#
# For Define Seciton Items.
#
#
#
if DefineObj.GetUefiSpecificationVersion() != None:
if DefineObj.GetPiSpecificationVersion() != None:
NewSpecList = []
#
# must exist items in INF define section
#
if DefineObj.GetModuleType() == None:
else:
if ModuleType:
#
# Drivers and applications are not allowed to have a MODULE_TYPE of "BASE". Only
# libraries are permitted to a have a MODULE_TYPE of "BASE".
#
if DefineObj.GetBaseName() == None:
else:
if DefineObj.GetInfVersion() == None:
else:
if DefineObj.GetFileGuid() == None:
else:
if DefineObj.GetVersionString() == None:
#
# VERSION_STRING is missing from the [Defines] section, tools must assume that the module's version is 0.
#
else:
#
# Get version of INF
#
#
# EDK2 inf
#
else:
#
# EDK1 inf
#
Logger.Error("Parser", PARSER_ERROR, ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF, ExtraData=self.FullPath,
#
# if there is Shadow, Should judge the MODULE_TYPE in
# SEC, PEI_CORE and PEIM
#
Logger.Error("InfParser", FORMAT_INVALID, ST.ERR_INF_PARSER_DEFINE_SHADOW_INVALID, File=self.FullPath)
if DefineObj.GetPcdIsDriver() != None:
#
# LIBRARY_CLASS
#
#
# CUSTOM_MAKEFILE
#
#
# Externs in Defines section
# Only one define section, so just call once.
#
if not HasCalledFlag:
#
# each module has only one module header
#
#
#
#
# put all define statement into user-extension sections
#
if DefinesDictNew:
#
# Get all meta-file header information
# the record is list of items formated:
# [LineValue, Arch, StartLine, ID, Third]
#
#
# Put header information into POM object
#
## GenModuleHeaderLibClass
#
#
for LibraryItem in LibraryList:
## GenModuleHeaderExterns
#
#
for EntryPoint in EntryPointList:
Image = ExternObject()
#
# Future enhancement
#
#
# UNLOAD_IMAGE
#
for UnloadImage in UnloadImageList:
Image = ExternObject()
#
# Future enhancement
#
#
# CONSTRUCTOR
#
for ConstructorItem in ConstructorList:
Image = ExternObject()
#
# Future enhancement
#
#
# DESTRUCTOR
#
for DestructorItem in DestructorList:
Image = ExternObject()
#
# Future enhancement
#
## GenModuleHeaderExterns
#
for Key in SpecialCommentsList:
HobList = []
if Item.GetHelpString():
EventList = []
Event = EventObject()
if Item.GetHelpString():
BootModeList = []
if Item.GetHelpString():
## GenBuildOptions
#
# Gen BuildOptions of Inf
# [<Family>:]<ToolFlag>=Flag
#
#
#
# Get all BuildOptions
#
if not GlobalData.gIS_BINARY_INF:
BuildOptionDict = {}
for BuildOptionObj in BuildOptionsList:
if not BuildOptionsContent:
continue
if not BuildOptionDict:
return
else:
#
# Not process this information, will be processed in GenBinaries()
#
pass
## GenLibraryClasses
#
# Get LibraryClass of Inf
# <LibraryClassKeyWord>|<LibraryInstance>
#
# @param ContainerFile: The Inf file full path
#
if not GlobalData.gIS_BINARY_INF:
#
# Get all LibraryClasses
#
for Item in LibraryClassData:
if HelpStringObj != None:
## GenPackages
#
# Gen Packages of Inf
#
#
# @param ContainerFile: The Inf file full path
#
#
# Get all Packages
#
#
# Go through each arch
#
for PackageItemObj in PackageObj:
#
# Need package information for dependency check usage
#
elif Skip:
continue
else:
## GenPcds
#
# Gen Pcds of Inf
# <TokenSpaceGuidCName>.<PcdCName>[|<Value> [|<FFE>]]
#
# @param ContainerFile: The Inf file full path
#
if not GlobalData.gIS_BINARY_INF:
#
# Get all Pcds
#
#
# Go through each arch
#
for PcdItemObj in PcdData:
if CommentList:
for CommentItem in CommentList:
## GenSources
#
# Gen Sources of Inf
# <Filename>[|<Family>[|<TagName>[|<ToolCode>[|<PcdFeatureFlag>]]]]
#
# @param ContainerFile: The Inf file full path
#
#
# Get all SourceFiles
#
#
# Go through each arch
#
SourceList = []
for Item in SourceData:
## GenUserExtensions
#
# Gen UserExtensions of Inf
#
#
# UserExtensions
#
if SmmDepexList:
if DxeDepexList:
if PeiDepexList:
## GenDepexes
#
# Gen Depex of Inf
#
# @param ContainerFile: The Inf file full path
#
#
# Get all Depexes
#
SmmDepexList = []
DxeDepexList = []
PeiDepexList = []
ModuleTypeList = []
if IsLibraryClass:
if not self.GetIsLibraryModList():
if ModuleType:
else:
if not ModuleTypeList:
else:
if not ModuleType:
for ModuleType in ModuleTypeList:
DepexIns = DepexObject()
if IsLibraryClass:
else:
if Depex.GetModuleType():
if Depex.HelpString:
if ModuleType in SMM_LIST:
if ModuleType in DXE_LIST:
if ModuleType in PEI_LIST:
if IsLibraryClass:
else:
#End of for ModuleType in ModuleTypeList
#End of for Depex in DepexData
## GenBinaries
#
# <FileType>|<Filename>|<Target>[|<TokenSpaceGuidCName>.<PcdCName>]
#
# @param ContainerFile: The Inf file full path
#
BinariesDict = {}
#
# Get all Binary data
#
#
# If the INF file does not contain a [Sources] section, and the INF file does contain a [Binaries] section,
# then the ModuleSurfaceArea.BinaryModule attribute must be set to true. Otherwise, do not use the attribute
#
else:
BinaryFileObjectList = []
#
# Library AsBuild Info
#
#
# BuildOption AsBuild Info
#
#
# PatchPcd and PcdEx
#
BinariesDict2 = {}
for Key in BinariesDict:
else:
#
# if there is no TagName, ToolCode, HelpStr,
# then do not need to put them into userextension
#
continue
else:
if BinariesDict2:
## GenAsBuiltPcds
#
#
AsBuildPatchPcdList = []
AsBuildPcdExList = []
#
# Pcd AsBuild Info
#
else:
else:
return AsBuildIns
## GenGuidProtocolPpis
#
# <CName>=<GuidValue>
#
#
#
GuidProtocolPpiList = []
#
# Depend on CommentList content
# generate muti-guid-obj
#
if CommentList:
for GuidComentItem in CommentList:
for Item in ProtocolData:
for CommentItem in CommentList:
for CommentItem in CommentList:
## GenMiscFiles
#
# Gen MiscellaneousFiles of Inf
#
# @param ContainerFile: The Inf file full path
#
pass