Exemple #1
0
    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 as 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

        #
        # Get Modules
        #
        if ModuleList:
            for ModuleFile in ModuleList:
                ModuleFileFullPath = mws.join(Root, ModuleFile)
                WorkspaceDir = mws.getWs(Root, ModuleFile)

                try:
                    ModuleObj = InfPomAlignment(ModuleFileFullPath,
                                                WorkspaceDir)
                    ModuleKey = (ModuleObj.GetGuid(), ModuleObj.GetVersion(),
                                 ModuleObj.GetName(),
                                 ModuleObj.GetCombinePath())
                    self.ModuleSurfaceArea[ModuleKey] = ModuleObj
                except FatalError as ErrCode:
                    if ErrCode.message == EDK1_INF_ERROR:
                        Logger.Error("UPT",
                                     EDK1_INF_ERROR,
                                     ST.WRN_EDK1_INF_FOUND %
                                     ModuleFileFullPath,
                                     ExtraData=ST.ERR_NOT_SUPPORTED_SA_MODULE)
                    else:
                        raise

        # Recover WorkspaceDir
        WorkspaceDir = Root
Exemple #2
0
 def PackFiles(self, Files):
     for File in Files:
         Cwd = os.getcwd()
         os.chdir(mws.getWs(mws.WORKSPACE, File))
         self.PackFile(File)
         os.chdir(Cwd)