本文整理匯總了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)