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


Python PackageUtils.installRPMSInAOneShot方法代碼示例

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


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

示例1: buildPackage

# 需要導入模塊: from PackageUtils import PackageUtils [as 別名]
# 或者: from PackageUtils.PackageUtils import installRPMSInAOneShot [as 別名]
    def buildPackage(self,package):
        #do not build if RPM is already built
        #test only if the package is in the testForceRPMS with rpmCheck
        #build only if the package is not in the testForceRPMS with rpmCheck
        if self.checkIfPackageIsAlreadyBuilt(package):
            if not constants.rpmCheck:
                self.logger.info("Skipping building the package:"+package)
                return
            elif constants.rpmCheck and package not in constants.testForceRPMS:
                self.logger.info("Skipping testing the package:"+package)
                return

        #should initialize a logger based on package name
        chrUtils = ChrootUtils(self.logName,self.logPath)
        chrootName="build-"+package
        chrootID=None
        isToolChainPackage=False
        if package in constants.listToolChainPackages:
            isToolChainPackage=True
        try:
            chrootID = self.prepareBuildRoot(chrootName,isToolChainPackage)
            destLogPath=constants.logPath+"/build-"+package
            if not os.path.isdir(destLogPath):
                cmdUtils = CommandUtils()
                cmdUtils.runCommandInShell("mkdir -p "+destLogPath)

            listInstalledPackages=self.findInstalledPackages(chrootID)
            listDependentPackages=self.findBuildTimeRequiredPackages(package)
            if constants.rpmCheck and package in constants.testForceRPMS:
                testPackages=set(constants.listMakeCheckRPMPkgtoInstall)-set(listInstalledPackages)-set([package])
                listDependentPackages.extend(testPackages)

            pkgUtils = PackageUtils(self.logName,self.logPath)
            if len(listDependentPackages) != 0:
                self.logger.info("Installing the build time dependent packages......")
                for pkg in listDependentPackages:
                    self.installPackage(pkgUtils, pkg,chrootID,destLogPath,listInstalledPackages)
                pkgUtils.installRPMSInAOneShot(chrootID,destLogPath)
                self.logger.info("Finished installing the build time dependent packages......")

            pkgUtils.adjustGCCSpecs(package, chrootID, destLogPath)
            pkgUtils.buildRPMSForGivenPackage(package,chrootID,self.listBuildOptionPackages,self.pkgBuildOptionFile,destLogPath)
            self.logger.info("Successfully built the package:"+package)
        except Exception as e:
            self.logger.error("Failed while building package:" + package)
            self.logger.debug("Chroot with ID: " + chrootID + " not deleted for debugging.")
            logFileName = os.path.join(destLogPath, package + ".log")
            fileLog = os.popen('tail -n 100 ' + logFileName).read()
            self.logger.debug(fileLog)
            raise e
        if chrootID is not None:
            chrUtils.destroyChroot(chrootID)
開發者ID:pbidkar,項目名稱:photon,代碼行數:54,代碼來源:PackageBuilder.py

示例2: _buildPackage

# 需要導入模塊: from PackageUtils import PackageUtils [as 別名]
# 或者: from PackageUtils.PackageUtils import installRPMSInAOneShot [as 別名]
    def _buildPackage(self):
        #do not build if RPM is already built
        #test only if the package is in the testForceRPMS with rpmCheck
        #build only if the package is not in the testForceRPMS with rpmCheck
        if self._checkIfPackageIsAlreadyBuilt():
            if not constants.rpmCheck:
                self.logger.info("Skipping building the package:" + self.package)
                return
            elif constants.rpmCheck and self.package not in constants.testForceRPMS:
                self.logger.info("Skipping testing the package:" + self.package)
                return

        chrUtils = ChrootUtils(self.logName, self.logPath)
        chrootID = None
        try:
            chrootID = self._prepareBuildRoot()
            listDependentPackages, listInstalledPackages, listInstalledRPMs = (
                self._findDependentPackagesAndInstalledRPM(chrootID))

            pkgUtils = PackageUtils(self.logName, self.logPath)
            if listDependentPackages:
                self.logger.info("Installing the build time dependent packages......")
                for pkg in listDependentPackages:
                    self._installPackage(pkgUtils, pkg, chrootID, self.logPath,
                                         listInstalledPackages, listInstalledRPMs)
                pkgUtils.installRPMSInAOneShot(chrootID, self.logPath)
                self.logger.info("Finished installing the build time dependent packages....")

            pkgUtils.adjustGCCSpecs(self.package, chrootID, self.logPath)
            pkgUtils.buildRPMSForGivenPackage(self.package, chrootID,
                                              self.logPath)
            self.logger.info("Successfully built the package:" + self.package)
        except Exception as e:
            self.logger.error("Failed while building package:" + self.package)
            self.logger.debug("Chroot with ID: " + chrootID +
                              " not deleted for debugging.")
            logFileName = os.path.join(self.logPath, self.package + ".log")
            fileLog = os.popen('tail -n 100 ' + logFileName).read()
            self.logger.debug(fileLog)
            raise e
        if chrootID is not None:
            chrUtils.destroyChroot(chrootID)
開發者ID:vinaykul,項目名稱:photon,代碼行數:44,代碼來源:PackageBuilder.py

示例3: buildPackage

# 需要導入模塊: from PackageUtils import PackageUtils [as 別名]
# 或者: from PackageUtils.PackageUtils import installRPMSInAOneShot [as 別名]
 def buildPackage(self,package):
     #should initialize a logger based on package name
     chrUtils = ChrootUtils(self.logName,self.logPath)
     chrootName="build-"+package
     chrootID=None
     isToolChainPackage=False
     if package in constants.listToolChainPackages:
         isToolChainPackage=True
     try:
         chrootID = self.prepareBuildRoot(chrootName,isToolChainPackage)
         destLogPath=constants.logPath+"/build-"+package
         if not os.path.isdir(destLogPath):
             cmdUtils = CommandUtils()
             cmdUtils.runCommandInShell("mkdir -p "+destLogPath)
         
         listInstalledPackages=self.findInstalledPackages(chrootID)
         self.logger.info("List of installed packages")
         self.logger.info(listInstalledPackages)
         listDependentPackages=self.findBuildTimeRequiredPackages(package)
         
         pkgUtils = PackageUtils(self.logName,self.logPath)
         if len(listDependentPackages) != 0:
             self.logger.info("Installing the build time dependent packages......")
             for pkg in listDependentPackages:
                 self.installPackage(pkgUtils, pkg,chrootID,destLogPath,listInstalledPackages)
             pkgUtils.installRPMSInAOneShot(chrootID,destLogPath)
             self.logger.info("Finished installing the build time dependent packages......")
         pkgUtils.adjustGCCSpecs(package, chrootID, destLogPath)
         pkgUtils.buildRPMSForGivenPackage(package,chrootID,destLogPath)
         self.logger.info("Successfully built the package:"+package)
     except Exception as e:
         self.logger.error("Failed while building package:" + package)
         self.logger.debug("Chroot with ID: " + chrootID + " not deleted for debugging.")
         logFileName = os.path.join(destLogPath, package + ".log")
         fileLog = os.popen('tail -n 20 ' + logFileName).read()
         self.logger.debug(fileLog)
         raise e
     if chrootID is not None:
         chrUtils.destroyChroot(chrootID)
開發者ID:corebug,項目名稱:photon,代碼行數:41,代碼來源:PackageBuilder.py


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