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


Python PackageUtils.buildRPMSForGivenPackageInContainer方法代码示例

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


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

示例1: _buildPackage

# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import buildRPMSForGivenPackageInContainer [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

        #should initialize a logger based on package name
        containerTaskName = "build-" + self.package
        containerID = None
        chrootID = None
        isToolChainPackage = False
        if self.package in constants.listToolChainPackages:
            isToolChainPackage = True
        destLogPath = constants.logPath + "/build-" + self.package
        try:
            containerID, chrootID = self._prepareBuildContainer(
                containerTaskName, self.package, isToolChainPackage)

            tcUtils = ToolChainUtils(self.logName, self.logPath)
            if self.package in constants.perPackageToolChain:
                self.logger.debug(constants.perPackageToolChain[self.package])
                tcUtils.installCustomToolChainRPMSinContainer(
                    containerID,
                    constants.perPackageToolChain[self.package],
                    self.package)

            listDependentPackages, listInstalledPackages, listInstalledRPMs = (
                self._findDependentPackagesAndInstalledRPM(containerID))

            pkgUtils = PackageUtils(self.logName, self.logPath)
            if listDependentPackages:
                self.logger.info("BuildContainer-buildPackage: " +
                                 "Installing dependent packages..")
                self.logger.info(listDependentPackages)
                for pkg in listDependentPackages:
                    self._installPackage(pkgUtils, pkg, containerID, destLogPath,
                                         listInstalledPackages, listInstalledRPMs)
                pkgUtils.installRPMSInAOneShotInContainer(containerID, destLogPath)
                self.logger.info("Finished installing the build time dependent packages....")

            self.logger.info("BuildContainer-buildPackage: Start building the package: " +
                             self.package)
            pkgUtils.adjustGCCSpecsInContainer(self.package, containerID, destLogPath)
            pkgUtils.buildRPMSForGivenPackageInContainer(
                self.package,
                containerID,
                destLogPath)
            self.logger.info("BuildContainer-buildPackage: Successfully built the package: " +
                             self.package)
        except Exception as e:
            self.logger.error("Failed while building package:" + self.package)
            if containerID is not None:
                self.logger.debug("Container " + containerID.short_id +
                                  " retained for debugging.")
            logFileName = os.path.join(destLogPath, self.package + ".log")
            fileLog = os.popen('tail -n 20 ' + logFileName).read()
            self.logger.debug(fileLog)
            raise e

        # Remove the container
        if containerID is not None:
            containerID.remove(force=True)
        # Remove the dummy chroot
        if chrootID is not None:
            chrUtils = ChrootUtils(self.logName, self.logPath)
            chrUtils.destroyChroot(chrootID)
开发者ID:vinaykul,项目名称:photon,代码行数:74,代码来源:PackageBuilder.py


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