當前位置: 首頁>>代碼示例>>Python>>正文


Python PackageUtils.ensureLMDBForRPMDB方法代碼示例

本文整理匯總了Python中PackageUtils.PackageUtils.ensureLMDBForRPMDB方法的典型用法代碼示例。如果您正苦於以下問題:Python PackageUtils.ensureLMDBForRPMDB方法的具體用法?Python PackageUtils.ensureLMDBForRPMDB怎麽用?Python PackageUtils.ensureLMDBForRPMDB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PackageUtils.PackageUtils的用法示例。


在下文中一共展示了PackageUtils.ensureLMDBForRPMDB方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: installToolChainRPMS

# 需要導入模塊: from PackageUtils import PackageUtils [as 別名]
# 或者: from PackageUtils.PackageUtils import ensureLMDBForRPMDB [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


注:本文中的PackageUtils.PackageUtils.ensureLMDBForRPMDB方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。