本文整理汇总了Python中PackageUtils.PackageUtils.buildRPMSForGivenPackage方法的典型用法代码示例。如果您正苦于以下问题:Python PackageUtils.buildRPMSForGivenPackage方法的具体用法?Python PackageUtils.buildRPMSForGivenPackage怎么用?Python PackageUtils.buildRPMSForGivenPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageUtils.PackageUtils
的用法示例。
在下文中一共展示了PackageUtils.buildRPMSForGivenPackage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildPackage
# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import buildRPMSForGivenPackage [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)
if len(listDependentPackages) != 0:
self.logger.info("Installing the build time dependent packages......")
for pkg in listDependentPackages:
self.installPackage(pkg,chrootID,destLogPath,listInstalledPackages)
self.logger.info("Finished installing the build time dependent packages......")
self.adjustGCCSpecs(package, chrootID, destLogPath)
pkgUtils = PackageUtils(self.logName,self.logPath)
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.")
raise e
if chrootID is not None:
chrUtils.destroyChroot(chrootID)
示例2: buildCoreToolChainPackages
# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import buildRPMSForGivenPackage [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
示例3: buildPackage
# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import buildRPMSForGivenPackage [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)
示例4: _buildPackage
# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import buildRPMSForGivenPackage [as 别名]
def _buildPackage(self):
try:
self.sandbox.create(self.package + "-" + self.version)
tUtils = ToolChainUtils(self.logName, self.logPath)
if self.sandbox.hasToolchain():
tUtils.installExtraToolchainRPMS(self.sandbox, self.package, self.version)
else:
tUtils.installToolchainRPMS(self.sandbox, self.package, self.version, availablePackages=self.doneList)
listDependentPackages, listTestPackages, listInstalledPackages, listInstalledRPMs = (
self._findDependentPackagesAndInstalledRPM(self.sandbox))
pkgUtils = PackageUtils(self.logName, self.logPath)
if listDependentPackages:
self.logger.debug("Installing the build time dependent packages......")
for pkg in listDependentPackages:
packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg)
self._installPackage(pkgUtils, packageName, packageVersion, self.sandbox, self.logPath,listInstalledPackages, listInstalledRPMs)
for pkg in listTestPackages:
flag = False
packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg)
for depPkg in listDependentPackages:
depPackageName, depPackageVersion = StringUtils.splitPackageNameAndVersion(depPkg)
if depPackageName == packageName:
flag = True
break;
if flag == False:
self._installPackage(pkgUtils, packageName,packageVersion, self.sandbox, self.logPath,listInstalledPackages, listInstalledRPMs)
pkgUtils.installRPMSInOneShot(self.sandbox)
self.logger.debug("Finished installing the build time dependent packages....")
pkgUtils.adjustGCCSpecs(self.sandbox, self.package, self.version)
pkgUtils.buildRPMSForGivenPackage(self.sandbox, self.package, self.version,
self.logPath)
self.logger.debug("Successfully built the package: " + self.package)
except Exception as e:
self.logger.error("Failed while building package: " + self.package)
self.logger.debug("Sandbox: " + self.sandbox.getID() +
" not deleted for debugging.")
logFileName = os.path.join(self.logPath, self.package + ".log")
fileLog = os.popen('tail -n 100 ' + logFileName).read()
self.logger.info(fileLog)
raise e
if self.sandbox:
self.sandbox.destroy()
示例5: _buildPackage
# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import buildRPMSForGivenPackage [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)