def buildInstalledPkgRepoSack(self): sack = PackageSack() ainstRoot = AinstRoot(self._installRoot) if not ainstRoot.isValidAinstRoot(): Log.cout(Log.DEBUG, '%s is invalid ainst root' % self._installRoot) return None reader = AinstRootReader(ainstRoot) installPkgMetas = reader.getInstallPkgMetas() if installPkgMetas is None: Log.cout(Log.DEBUG, 'Get install meta of %s failed' % self._installRoot) return None for pkgVer, rpmPath in installPkgMetas: pkg = LocalRpmPackage(rpmPath) if pkg.init(): sack.addPackageObject(pkg) return sack
def _initLocalRepos(self, repoSack, localRepos): if not localRepos: return True if not repoSack: repoSack = MultiPackageSack() for local in localRepos: fileNames = file_util.listDir(local) if not fileNames: continue pkgSack = PackageSack() for name in fileNames: path = local + '/' + name pkg = LocalRpmPackage(path) if pkg.init(): pkgSack.addPackageObject(pkg) repoSack.addPackageSack(local, pkgSack) return True
def _initLocalRepos(self, repoSack, localRepos): if not localRepos: return True if not repoSack: repoSack = MultiPackageSack() for local in localRepos: fileNames = file_util.listDir(local) if not fileNames: continue pkgSack = PackageSack() for name in fileNames: path = local + "/" + name pkg = LocalRpmPackage(path) if pkg.init(): pkgSack.addPackageObject(pkg) repoSack.addPackageSack(local, pkgSack) return True