本文整理汇总了Python中PackageUtils.PackageUtils.findPackageInfoFromRPMFile方法的典型用法代码示例。如果您正苦于以下问题:Python PackageUtils.findPackageInfoFromRPMFile方法的具体用法?Python PackageUtils.findPackageInfoFromRPMFile怎么用?Python PackageUtils.findPackageInfoFromRPMFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageUtils.PackageUtils
的用法示例。
在下文中一共展示了PackageUtils.findPackageInfoFromRPMFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readAlreadyAvailablePackages
# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findPackageInfoFromRPMFile [as 别名]
def readAlreadyAvailablePackages(self):
listAvailablePackages=[]
listRPMFiles=[]
listDirectorys=[]
listDirectorys.append(constants.rpmPath)
if constants.inputRPMSPath is not None:
listDirectorys.append(constants.inputRPMSPath)
while len(listDirectorys) > 0:
dirPath=listDirectorys.pop()
for dirEntry in os.listdir(dirPath):
dirEntryPath = os.path.join(dirPath, dirEntry)
if os.path.isfile(dirEntryPath) and dirEntryPath.endswith(".rpm"):
listRPMFiles.append(dirEntryPath)
elif os.path.isdir(dirEntryPath):
listDirectorys.append(dirEntryPath)
pkgUtils = PackageUtils(self.logName,self.logPath)
for rpmfile in listRPMFiles:
package,version,release = pkgUtils.findPackageInfoFromRPMFile(rpmfile)
if constants.specData.isRPMPackage(package):
specVersion=constants.specData.getVersion(package)
specRelease=constants.specData.getRelease(package)
if version == specVersion and release == specRelease:
listAvailablePackages.append(package)
self.logger.info("List of Already built packages")
self.logger.info(listAvailablePackages)
return listAvailablePackages
示例2: readAlreadyAvailablePackages
# 需要导入模块: from PackageUtils import PackageUtils [as 别名]
# 或者: from PackageUtils.PackageUtils import findPackageInfoFromRPMFile [as 别名]
def readAlreadyAvailablePackages(self):
listAvailablePackages=[]
listFoundRPMPackages=[]
listRPMFiles=[]
listDirectorys=[]
listDirectorys.append(constants.rpmPath)
if constants.inputRPMSPath is not None:
listDirectorys.append(constants.inputRPMSPath)
while len(listDirectorys) > 0:
dirPath=listDirectorys.pop()
for dirEntry in os.listdir(dirPath):
dirEntryPath = os.path.join(dirPath, dirEntry)
if os.path.isfile(dirEntryPath) and dirEntryPath.endswith(".rpm"):
listRPMFiles.append(dirEntryPath)
elif os.path.isdir(dirEntryPath):
listDirectorys.append(dirEntryPath)
pkgUtils = PackageUtils(self.logName,self.logPath)
for rpmfile in listRPMFiles:
package,version,release = pkgUtils.findPackageInfoFromRPMFile(rpmfile)
if constants.specData.isRPMPackage(package):
specVersion=constants.specData.getVersion(package)
specRelease=constants.specData.getRelease(package)
if version == specVersion and release == specRelease:
listFoundRPMPackages.append(package)
#Mark package available only if all sub packages are available
for package in listFoundRPMPackages:
basePkg = constants.specData.getSpecName(package)
if basePkg in listAvailablePackages:
continue;
listRPMPackages = constants.specData.getRPMPackages(basePkg)
packageIsAlreadyBuilt = True
for rpmpkg in listRPMPackages:
if rpmpkg not in listFoundRPMPackages:
packageIsAlreadyBuilt = False
if packageIsAlreadyBuilt:
listAvailablePackages.append(package)
self.logger.info("List of Already built packages")
self.logger.info(listAvailablePackages)
return listAvailablePackages