Exemple #1
0
    def readAlreadyAvailablePackages(self):
        listAvailablePackages = []
        listRPMFiles = []
        listDirectorys = []
        listDirectorys.append(constants.rpmPath)

        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
 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
    def _readAlreadyAvailablePackages(self):
        listAvailablePackages = set()
        listFoundRPMPackages = set()
        listRPMFiles = set()
        listDirectorys = set()
        mapPackageVersion = {}
        mapPackageRelease = {}
        listDirectorys.add(constants.rpmPath)
        if constants.inputRPMSPath is not None:
            listDirectorys.add(constants.inputRPMSPath)

        while listDirectorys:
            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.add(dirEntryPath)
                elif os.path.isdir(dirEntryPath):
                    listDirectorys.add(dirEntryPath)
        pkgUtils = PackageUtils(self.logName, self.logPath)
        for rpmfile in listRPMFiles:
            package, version, release = pkgUtils.findPackageInfoFromRPMFile(
                rpmfile)
            if package in mapPackageVersion:
                mapPackageVersion[package].append(version)
                mapPackageRelease[package].append(release)
            else:
                mapPackageVersion[package] = [version]
                mapPackageRelease[package] = [release]
        for package in mapPackageVersion:
            if SPECS.getData().isRPMPackage(package):
                numVersions = SPECS.getData().getNumberOfVersions(package)
                flag = True
                for index in range(0, numVersions):
                    specVersion = SPECS.getData().getVersion(package, index)
                    specRelease = SPECS.getData().getRelease(package, index)
                    if specVersion not in mapPackageVersion[
                            package] and specRelease not in mapPackageRelease[
                                package]:
                        flag = False
                if flag:
                    listFoundRPMPackages.add(package)
        #Mark package available only if all sub packages are available
        for package in listFoundRPMPackages:
            basePkg = SPECS.getData().getSpecName(package)
            if basePkg in listAvailablePackages:
                continue
            listRPMPackages = SPECS.getData().getRPMPackages(basePkg)
            packageIsAlreadyBuilt = True
            for rpmpkg in listRPMPackages:
                if rpmpkg not in listFoundRPMPackages:
                    packageIsAlreadyBuilt = False
            if packageIsAlreadyBuilt:
                listAvailablePackages.add(package)
        self.logger.info("List of Already built packages")
        self.logger.info(listAvailablePackages)
        return listAvailablePackages
Exemple #4
0
    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
Exemple #5
0
    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