def GetDistributionPackage(self, WorkspaceDir, PackageList, ModuleList): # Backup WorkspaceDir Root = WorkspaceDir # # Get Packages # if PackageList: for PackageFile in PackageList: PackageFileFullPath = mws.join(Root, PackageFile) WorkspaceDir = mws.getWs(Root, PackageFile) DecObj = DecPomAlignment(PackageFileFullPath, WorkspaceDir, CheckMulDec=True) PackageObj = DecObj # # Parser inf file one bye one # ModuleInfFileList = PackageObj.GetModuleFileList() for File in ModuleInfFileList: WsRelPath = os.path.join(PackageObj.GetPackagePath(), File) WsRelPath = os.path.normpath(WsRelPath) if ModuleList and WsRelPath in ModuleList: Logger.Error("UPT", OPTION_VALUE_INVALID, ST.ERR_NOT_STANDALONE_MODULE_ERROR%\ (WsRelPath, PackageFile)) Filename = os.path.normpath\ (os.path.join(PackageObj.GetRelaPath(), File)) os.path.splitext(Filename) # # Call INF parser to generate Inf Object. # Actually, this call is not directly call, but wrapped by # Inf class in InfPomAlignment. # try: ModuleObj = InfPomAlignment( Filename, WorkspaceDir, PackageObj.GetPackagePath()) # # Add module to package # ModuleDict = PackageObj.GetModuleDict() ModuleDict[(ModuleObj.GetGuid(), \ ModuleObj.GetVersion(), \ ModuleObj.GetName(), \ ModuleObj.GetCombinePath())] = ModuleObj PackageObj.SetModuleDict(ModuleDict) except FatalError, ErrCode: if ErrCode.message == EDK1_INF_ERROR: Logger.Warn("UPT", ST.WRN_EDK1_INF_FOUND % Filename) else: raise self.PackageSurfaceArea\ [(PackageObj.GetGuid(), PackageObj.GetVersion(), \ PackageObj.GetCombinePath())] = PackageObj
def _GenBinaries(self): Logger.Debug(2, "Generate %s ..." % DT.TAB_BINARIES) BinariesDict = {} # # Get all Binary data # BinaryObj = self.Parser.InfBinariesSection.GetBinary() BinaryData = BinaryObj.keys() # # 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 # if BinaryObj and not self.Parser.InfSourcesSection.GetSources(): self.BinaryModule = True else: self.BinaryModule = False BinaryFileObjectList = [] AsBuildLibraryClassList = [] AsBuildBuildOptionList = [] AsBuildIns = AsBuiltObject() # # Library AsBuild Info # for LibItem in self.Parser.InfLibraryClassSection.GetLibraryClasses(): AsBuildLibIns = AsBuildLibraryClassObject() AsBuildLibIns.SetLibGuid(LibItem.GetFileGuid()) AsBuildLibIns.SetLibVersion(LibItem.GetVersion()) AsBuildLibIns.SetSupArchList(LibItem.GetSupArchList()) AsBuildLibraryClassList.append(AsBuildLibIns) AsBuildIns.SetLibraryInstancesList(AsBuildLibraryClassList) # # BuildOption AsBuild Info # for BuildOptionItem in self.Parser.InfBuildOptionSection.GetBuildOptions( ): AsBuildBuildOptionList.append(BuildOptionItem) AsBuildIns.SetBuildFlagsList(AsBuildBuildOptionList) # # PatchPcd and PcdEx # AsBuildIns = self._GenAsBuiltPcds(self.Parser.InfPcdSection.GetPcds(), AsBuildIns) # # Parse the DEC file that contains the GUID value of the GUID CName which is used by # SUBTYPE_GUID type binary file in the Binaries section in the INF file # DecObjList = [] if not self.PackagePath: WorkSpace = os.path.normpath(self.WorkSpace) TempPath = ModulePath = os.path.normpath(self.ModulePath) while ModulePath: TempPath = ModulePath ModulePath = os.path.dirname(ModulePath) PackageName = TempPath DecFilePath = os.path.normpath(os.path.join( WorkSpace, PackageName)) if DecFilePath: for File in os.listdir(DecFilePath): if File.upper().endswith('.DEC'): DecFileFullPath = os.path.normpath( os.path.join(DecFilePath, File)) DecObjList.append( DecPomAlignment(DecFileFullPath, self.WorkSpace)) BinariesDict, AsBuildIns, BinaryFileObjectList = GenBinaryData( BinaryData, BinaryObj, BinariesDict, AsBuildIns, BinaryFileObjectList, self.GetSupArchList(), self.BinaryModule, DecObjList) BinariesDict2 = {} for Key in BinariesDict: ValueList = BinariesDict[Key] if len(ValueList) > 1: BinariesDict2[Key] = ValueList else: # # if there is no TagName, ToolCode, HelpStr, # then do not need to put them into userextension # (Target, Family, TagName, HelpStr) = ValueList[0] if not (Target or Family or TagName or HelpStr): continue else: BinariesDict2[Key] = ValueList self.SetBinaryFileList(self.GetBinaryFileList() + BinaryFileObjectList) if BinariesDict2: UserExtension = CommonObject.UserExtensionObject() UserExtension.SetBinariesDict(BinariesDict2) UserExtension.SetIdentifier('BinaryFileModifiers') UserExtension.SetUserID('EDK2') self.SetUserExtensionList(self.GetUserExtensionList() + [UserExtension])