当前位置: 首页>>代码示例>>Python>>正文


Python PackageUtils.findRPMFileForGivenPackage方法代码示例

本文整理汇总了Python中PackageUtils.PackageUtils.findRPMFileForGivenPackage方法的典型用法代码示例。如果您正苦于以下问题:Python PackageUtils.findRPMFileForGivenPackage方法的具体用法?Python PackageUtils.findRPMFileForGivenPackage怎么用?Python PackageUtils.findRPMFileForGivenPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PackageUtils.PackageUtils的用法示例。


在下文中一共展示了PackageUtils.findRPMFileForGivenPackage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: installToolChainRPMS

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
    def installToolChainRPMS(self, chrootID, packageName, logPath=None):
        if logPath is None:
            logPath = self.logPath
        cmdUtils = CommandUtils()
        self.prepareBuildRoot(chrootID)
        self.logger.info("Installing Tool Chain RPMS.......")
        rpmFiles = ""
        packages = ""
        for package in constants.listToolChainRPMsToInstall:
            pkgUtils = PackageUtils(self.logName, self.logPath)
            rpmFile = None
            if constants.rpmCheck:
                rpmFile = pkgUtils.findRPMFileForGivenPackage(package)
            else:
                if (packageName not in constants.listToolChainRPMsToInstall or
                        constants.listToolChainRPMsToInstall.index(packageName) >
                        constants.listToolChainRPMsToInstall.index(package)):
                    rpmFile = pkgUtils.findRPMFileForGivenPackage(package)
            if rpmFile is None:
                # sqlite-autoconf package was renamed, but it still published as sqlite-autoconf
                if (package == "sqlite") and (platform.machine() == "x86_64"):
                    package = "sqlite-autoconf"
                rpmFile = self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo)
                if rpmFile is None:
                    if package in constants.listOfRPMsProvidedAfterBuild:
                        self.logger.info("No old version of " + package +
                                         " exists, skip until the new version is built")
                        continue
                    self.logger.error("Unable to find rpm " + package +
                                      " in current and previous versions")
                    raise Exception("Input Error")
            rpmFiles += " " + rpmFile
            packages += " " + package

        self.logger.debug("Installing toolchain rpms:" + packages)
        cmd = (self.rpmCommand + " -i -v --nodeps --noorder --force --root " +
               chrootID +" --define \'_dbpath /var/lib/rpm\' "+ rpmFiles)
        retVal = cmdUtils.runCommandInShell(cmd, logPath + "/install_toolchain_rpms.log")
        if not retVal:
            self.logger.debug("Command Executed:" + cmd)
            self.logger.error("Installing tool chain  failed")
            raise Exception("RPM installation failed")
        self.logger.info("Successfully installed default Tool Chain RPMS in Chroot:" + chrootID)
        print("Building Package: ".format(packageName))
        print(constants.perPackageToolChain)
        if packageName in constants.perPackageToolChain:
            print(constants.perPackageToolChain[packageName])
            self.installCustomToolChainRPMS(chrootID, constants.perPackageToolChain[packageName],
                                            packageName)
        #convert rpm db to lmdb (if required)
        convertLogFile = self.logPath+"/rpmdbconvert.log"
        pkgUtilsConvert=PackageUtils(self.logName,self.logPath)
        pkgUtilsConvert.ensureLMDBForRPMDB(chrootID, convertLogFile)
开发者ID:vinaykul,项目名称:photon,代码行数:55,代码来源:ToolChainUtils.py

示例2: prepareBuildRoot

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
    def prepareBuildRoot(self,chrootID):
        self.logger.info("Preparing build environment")
        cmdUtils = CommandUtils()
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+"/tmp")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath)
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/RPMS/x86_64")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/RPMS/noarch")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/SOURCES")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/SPECS")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/LOGS")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/BUILD")
        cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/BUILDROOT")

        package="filesystem"
        pkgUtils=PackageUtils(self.logName,self.logPath)
        rpmFile=pkgUtils.findRPMFileForGivenPackage(package)
        if rpmFile is None:
            specFile=constants.specData.getSpecFile(package)
            cmd=self.rpmbuildCommand+" -ba --nocheck --define \'_topdir "+chrootID+constants.topDirPath+"\' --define \'_dbpath "+chrootID+"/var/lib/rpm\' --define \'dist "+constants.dist+"\' "+specFile
            self.logger.info(cmd)
            cmdUtils.runCommandInShell(cmd,self.logPath+"/filesystem.log")
            filesystemrpmFile = cmdUtils.findFile(package+"-[0-9]*.rpm", chrootID+constants.topDirPath+"/RPMS")
            filesystemsrpmFile = cmdUtils.findFile(package+"-[0-9]*.src.rpm", chrootID+constants.topDirPath+"/SRPMS")
            if len(filesystemrpmFile) > 0:
                shutil.copy2(filesystemrpmFile[0],constants.rpmPath+"/x86_64/")
            if len(filesystemsrpmFile) > 0:
                shutil.copy2(filesystemsrpmFile[0],constants.sourceRpmPath+"/")
            rpmFile=pkgUtils.findRPMFileForGivenPackage(package)
            if rpmFile is None:
                self.logger.error("Cannot find filesystem rpm")
                raise Exception("Cannot find filesystem rpm")
        
        self.logger.debug("Installing filesystem rpms:" + package)
        if os.geteuid()==0:
            cmd=self.rpmCommand + " -i --nodeps --root "+chrootID+" --define '_dbpath /var/lib/rpm' "+ rpmFile
        else:
            cmd=self.rpmCommand + " -i --nodeps --badreloc --relocate /="+chrootID+" --define '_dbpath "+chrootID+"/var/lib/rpm' "+ rpmFile
        process = subprocess.Popen("%s" %cmd,shell=True,stdout=subprocess.PIPE)
        retval = process.wait()
        if retval != 0:
            self.logger.error("Installing filesystem rpm failed")
            raise Exception("RPM installation failed")
        
        prepareChrootCmd=self.prepareBuildRootCmd+" "+chrootID
        logFile=constants.logPath+"/prepareBuildRoot.log"
        returnVal=cmdUtils.runCommandInShell(prepareChrootCmd,logFile)
        if not returnVal:
            self.logger.error("Prepare build root script failed.Unable to prepare chroot.")
            raise Exception("Prepare build root script failed")

        self.logger.info("Successfully prepared chroot:"+chrootID)
开发者ID:MrScriptMaster,项目名称:photon,代码行数:53,代码来源:ToolChainUtils.py

示例3: loadPackagesData

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
 def loadPackagesData(self):
     listPackages =  constants.specData.getListPackages()
     listPackages.sort()
     listRPMFiles = []
     cmdUtils = CommandUtils()
     for package in listPackages:
         release = constants.specData.getRelease(package)
         version = constants.specData.getVersion(package)
         listRPMPackages = constants.specData.getRPMPackages(package)
         srpmFileName = package+"-"+version+"-"+release+".src.rpm"
         srpmFiles = cmdUtils.findFile(srpmFileName, constants.sourceRpmPath)
         srpmFile = None
         if len(srpmFiles) == 1:
             srpmFile = srpmFiles[0]
         debugrpmFileName = package+"-debuginfo-"+version+"-"+release+"*"
         debugrpmFiles = cmdUtils.findFile(debugrpmFileName, constants.rpmPath)
         debugrpmFile = None
         if len(debugrpmFiles) == 1:
             debugrpmFile = debugrpmFiles[0]
         pkgUtils = PackageUtils(self.logName,self.logPath)
         for rpmPkg in listRPMPackages:
             rpmFile = pkgUtils.findRPMFileForGivenPackage(rpmPkg)
             if rpmFile is not None:
                 listRPMFiles.append(rpmFile)
                 listPkgAttributes = {"sourcerpm":srpmFile, "rpm":rpmFile, "debugrpm":debugrpmFile}
                 self.pkgList[rpmPkg] = listPkgAttributes
                 self.logger.debug("Added "+rpmPkg +" rpm package to the list")
             else:
                 self.logger.error("Missing rpm file for package:"+rpmPkg)
开发者ID:megacoder,项目名称:photon,代码行数:31,代码来源:PackageInfo.py

示例4: installToolChain

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
    def installToolChain(self,chrootID):
        self.logger.info("Installing toolchain.....")
        self.prepareBuildRoot(chrootID)
        cmdUtils = CommandUtils()

        rpmFiles = ""
        packages = ""
        for package in constants.listToolChainRPMPkgsToInstall:
            pkgUtils=PackageUtils(self.logName,self.logPath)
            rpmFile=pkgUtils.findRPMFileForGivenPackage(package)
            if rpmFile is None:
                rpmFile=self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo)
                if rpmFile is None:
                    if package == "util-linux-devel":
                        self.logger.info("No old verion of util-linux-devel exists, skip until the new version is built")
                        continue
                    if package == "flex-devel":
                        self.logger.info("No old verion of flex-devel exists, skip until the new version is built")
                        continue

                    self.logger.error("Unable to find rpm "+ package +" in current and previous versions")
                    raise Exception("Input Error")
            rpmFiles += " " + rpmFile
            packages += " " + package

        self.logger.debug("Installing toolchain rpms:" + packages)
        cmd=self.rpmCommand + " -i --nodeps --force --root "+chrootID+" --define \'_dbpath /var/lib/rpm\' "+ rpmFiles
        process = subprocess.Popen("%s" %cmd,shell=True,stdout=subprocess.PIPE)
        retval = process.wait()
        if retval != 0:
            self.logger.error("Installing toolchain rpms failed")
            raise Exception("RPM installation failed")
        
        self.logger.info("Installed toolchain successfully on chroot:"+chrootID)
开发者ID:jacob-vmware,项目名称:photon,代码行数:36,代码来源:ToolChainUtils.py

示例5: buildCoreToolChainPackages

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
 def buildCoreToolChainPackages(self):
     self.logger.info("Building core tool chain packages.....")
     chrootID=None
     try:
         pkgUtils=PackageUtils(self.logName,self.logPath)
         for package in constants.listCoreToolChainRPMPackages:
             rpmPkg=pkgUtils.findRPMFileForGivenPackage(package)
             if rpmPkg is not None:
                 continue
             chrUtils = ChrootUtils(self.logName,self.logPath)
             chrootName="build-core-toolchain"
             destLogPath=constants.logPath+"/build-"+package
             if not os.path.isdir(destLogPath):
                 cmdUtils = CommandUtils()
                 cmdUtils.runCommandInShell("mkdir -p "+destLogPath)
             returnVal,chrootID = chrUtils.createChroot(chrootName)
             if not returnVal:
                 self.logger.error("Creating chroot failed")
                 raise Exception("creating chroot failed")
             self.installToolChainRPMS(chrootID)
             pkgUtils.adjustGCCSpecs(package, chrootID, destLogPath)
             pkgUtils.buildRPMSForGivenPackage(package, chrootID,destLogPath)
             chrUtils.destroyChroot(chrootID)
             chrootID=None
         self.logger.info("Successfully built toolchain")
         if chrootID is not None:
             chrUtils.destroyChroot(chrootID)
     except Exception as e:
         self.logger.error("Unable to build tool chain.")
         # print stacktrace
         traceback.print_exc()
         raise e
开发者ID:jacob-vmware,项目名称:photon,代码行数:34,代码来源:ToolChainUtils.py

示例6: installCoreToolChainPackages

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
    def installCoreToolChainPackages(self,chrootID):
        self.logger.info("Installing toolchain.....")
        cmdUtils = CommandUtils()
        self.prepareBuildRoot(chrootID)

        rpmFiles = ""
        packages = ""
        for package in constants.listToolChainRPMPkgsToBuild:
            pkgUtils=PackageUtils(self.logName,self.logPath)
            rpmFile = None
            if package in constants.listCoreToolChainRPMPackages:
                rpmFile=pkgUtils.findRPMFileForGivenPackage(package)
            else:
                rpmFile=self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo)
            if rpmFile is None:
                self.logger.error("Unable to find rpm "+ package)
                raise Exception("Input Error")
            rpmFiles += " " + rpmFile
            packages += " " + package

        self.logger.debug("Installing core toolchain rpms:" + packages)
        cmd=self.rpmCommand + " -i --nodeps --force --root "+chrootID+" --define \'_dbpath /var/lib/rpm\' "+ rpmFiles
        process = subprocess.Popen("%s" %cmd,shell=True,stdout=subprocess.PIPE)
        retval = process.wait()
        if retval != 0:
            self.logger.error("Installing toolchain rpms failed")
            raise Exception("RPM installation failed")
            
        self.logger.info("Installed core tool chain packages successfully on chroot:"+chrootID)    
开发者ID:jacob-vmware,项目名称:photon,代码行数:31,代码来源:ToolChainUtils.py

示例7: installToolChainRPMS

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
    def installToolChainRPMS(self,chrootID):
        cmdUtils = CommandUtils()
        self.prepareBuildRoot(chrootID)
        self.logger.info("Installing Tool Chain RPMS.......")
        rpmFiles = ""
        packages = ""
        for package in constants.listToolChainRPMPkgsToBuild:
            pkgUtils=PackageUtils(self.logName,self.logPath)
            rpmFile=pkgUtils.findRPMFileForGivenPackage(package)
            if rpmFile is None:
                rpmFile=self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo)
                if rpmFile is None:
                    self.logger.error("Unable to find rpm "+ package +" in current and previous versions")
                    raise "Input Error"
            rpmFiles += " " + rpmFile
            packages += " " + package

        self.logger.debug("Installing rpms:"+packages)
        cmd=self.rpmCommand + " -i --nodeps --force --root "+chrootID+" --define \'_dbpath /var/lib/rpm\' "+ rpmFiles
        process = subprocess.Popen("%s" %cmd,shell=True,stdout=subprocess.PIPE)
        retval = process.wait()
        if retval != 0:
            self.logger.error("Installing tool chain  failed")
            raise "RPM installation failed"
            
        self.logger.info("Successfully installed all Tool Chain RPMS in Chroot:"+chrootID)    
开发者ID:sarchoi,项目名称:photon,代码行数:28,代码来源:ToolChainUtils.py

示例8: installToolChain2

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
    def installToolChain2(self,chrootID,packagesInToolChain):
        self.logger.info("Installing toolchain.....")
        self.prepareBuildRoot(chrootID)
        cmdUtils = CommandUtils()

        rpmFiles = ""
        packages = ""
        for package in packagesInToolChain:
            pkgUtils=PackageUtils(self.logName,self.logPath)
            currentRpmFile=pkgUtils.findRPMFileForGivenPackage(package)

            prevPublishedRpmFile=None
            if currentRpmFile is None or ("-devel" not in package and "-lib" not in package and "perl" not in package):
                prevPublishedRpmFile=self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo)
                if prevPublishedRpmFile is None:
                    if package == "util-linux-devel":
                        self.logger.info("No old verion of util-linux-devel exists, skip until the new version is built")
                        continue
                    if package == "flex-devel":
                        self.logger.info("No old verion of flex-devel exists, skip until the new version is built")
                        continue

                    self.logger.error("Unable to find rpm "+ package +" in current and previous versions")
                    raise Exception("Input Error")

            if (currentRpmFile is not None) and (prevPublishedRpmFile is not None):
                temp = currentRpmFile[len(package)+ 1:]
                currentRpmVersion = temp[:temp.find('-')]
                temp = prevPublishedRpmFile[len(package)+1:]
                prevPublishedRpmVersion = temp[:temp.find('-')]
                if(currentRpmVersion != prevPublishedRpmVersion):
                    rpmFiles += " " + prevPublishedRpmFile
                    packages += " " + package
                rpmFiles += " " + currentRpmFile
                packages += " " + package

            else:
                if  prevPublishedRpmFile is not None:
                    rpmFiles += " " + prevPublishedRpmFile
                    packages += " " + package

                if currentRpmFile is not None:
                    rpmFiles += " " + currentRpmFile
                    packages += " " + package


        self.logger.debug("Installing toolchain rpms:" + packages)
        self.logger.debug("Installing toolchain rpms:" + rpmFiles)
        cmd=self.rpmCommand + " -i --nodeps --force --root "+chrootID+" --define \'_dbpath /var/lib/rpm\' "+ rpmFiles
        process = subprocess.Popen("%s" %cmd,shell=True,stdout=subprocess.PIPE)
        retval = process.wait()
        if retval != 0:
            self.logger.error("Installing toolchain rpms failed")
            raise Exception("RPM installation failed")
        
        self.logger.info("Installed toolchain successfully on chroot:"+chrootID)
开发者ID:corebug,项目名称:photon,代码行数:58,代码来源:ToolChainUtils.py

示例9: checkIfPackageIsAlreadyBuilt

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
 def checkIfPackageIsAlreadyBuilt(self, package):
     basePkg=constants.specData.getSpecName(package)
     listRPMPackages=constants.specData.getRPMPackages(basePkg)
     packageIsAlreadyBuilt=True
     pkgUtils = PackageUtils(self.logName,self.logPath)
     for pkg in listRPMPackages:
         if pkgUtils.findRPMFileForGivenPackage(pkg) is None:
             packageIsAlreadyBuilt=False
             break
     return packageIsAlreadyBuilt
开发者ID:megacoder,项目名称:photon,代码行数:12,代码来源:PackageBuilder.py

示例10: _checkIfPackageIsAlreadyBuilt

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
 def _checkIfPackageIsAlreadyBuilt(self):
     basePkg = SPECS.getData().getSpecName(self.package)
     listRPMPackages = SPECS.getData().getRPMPackages(basePkg)
     packageIsAlreadyBuilt = True
     pkgUtils = PackageUtils(self.logName, self.logPath)
     for pkg in listRPMPackages:
         if pkgUtils.findRPMFileForGivenPackage(pkg) is None:
             packageIsAlreadyBuilt = False
             break
     return packageIsAlreadyBuilt
开发者ID:vinaykul,项目名称:photon,代码行数:12,代码来源:PackageBuilder.py

示例11: installToolChainRPMSinContainer

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findRPMFileForGivenPackage [as 别名]
    def installToolChainRPMSinContainer(self, containerID):
        self.logger.info("Installing tool-chain RPMS in container: " + containerID.short_id)
        rpmFiles = ""
        packages = ""
        pkgUtils = PackageUtils(self.logName, self.logPath)
        for package in constants.listToolChainRPMPkgsToInstall:
            rpmFile = pkgUtils.findRPMFileForGivenPackage(package)
            if rpmFile is None:
                # sqlite-autoconf package was renamed, but it still published as sqlite-autoconf
#                if (package == "sqlite") and (platform.machine() == "x86_64"):
#                    package = "sqlite-autoconf"
                rpmFile = self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo)
                if rpmFile is None:
                    if package in constants.listOfRPMsProvidedAfterBuild:
                        self.logger.info("No old version of " + package +
                                         " exists, skip until the new version is built")
                        continue
                    self.logger.error("Unable to find rpm " + package +
                                      " in current and previous versions")
                    raise Exception("Input Error")
            if rpmFile.find("stage/PUBLISHRPMS"):
                rpmFile = rpmFile.replace(constants.prevPublishRPMRepo, "/publishrpms")
            if rpmFile.find("stage/PUBLISHXRPMS"):
                rpmFile = rpmFile.replace(constants.prevPublishXRPMRepo, "/publishxrpms")
            if rpmFile.find("stage/RPMS"):
                rpmFile = rpmFile.replace(constants.rpmPath, constants.topDirPath + "/RPMS")
            rpmFiles += " " + rpmFile
            packages += " " + package

        self.logger.debug("Installing tool-chain rpms: " + packages)

        cmd = "/usr/bin/bash -l -c '/usr/bin/rpm -Uvh --force --nodeps " + rpmFiles + "'"
        self.logger.info("VDBG-TCU-installToolChainRPMSinContainer: Installing rpms cmd: " + cmd)
        tcInstallLog = containerID.exec_run(cmd)
        # TODO: Find a way to collect exit status of the command that was run.
        if not tcInstallLog:
            self.logger.error("Installing tool chain in container failed")
            raise Exception("RPM installation in container failed")
        self.logger.info(tcInstallLog)
        self.logger.info("Successfully installed default tool-chain RPMS in container: " +
                         containerID.short_id)
开发者ID:vinaykul,项目名称:photon,代码行数:43,代码来源:ToolChainUtils.py


注:本文中的PackageUtils.PackageUtils.findRPMFileForGivenPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。