def select_bootstrap(repomd, cachedir, bootstrapdir): cfgmgr = configmgr lvl = msger.get_loglevel() msger.set_loglevel('quiet') repo_rpmver = misc.get_rpmver_in_repo(repomd) if not repo_rpmver: msger.set_loglevel(lvl) return (None, None) # Check avaliable bootstrap bootstrap_env = bootstrap.Bootstrap(homedir=bootstrapdir) for bs in bootstrap_env.list(): if compare_rpmversion(repo_rpmver, bs['rpm']): return (bs['name'], {}) for bsname, bsrepo in list(cfgmgr.bootstraps.items()): repolist = [] for repo in list(bsrepo.keys()): repolist.append(bsrepo[repo]) rpmver = None try: repomd = misc.get_metadata_from_repos(repolist, cachedir) rpmver = misc.get_rpmver_in_repo(repomd) except errors.CreatorError as e: msger.set_loglevel(lvl) raise if not rpmver: continue if compare_rpmversion(repo_rpmver, rpmver): msger.set_loglevel(lvl) return (bsname, bsrepo) msger.set_loglevel(lvl) return (None, None)
def select_bootstrap(repomd, cachedir, bootstrapdir): cfgmgr = configmgr lvl = msger.get_loglevel() msger.set_loglevel('quiet') repo_rpmver = misc.get_rpmver_in_repo(repomd) if not repo_rpmver: msger.set_loglevel(lvl) return (None, None) # Check avaliable bootstrap bootstrap_env = bootstrap.Bootstrap(homedir = bootstrapdir) for bs in bootstrap_env.list(): if compare_rpmversion(repo_rpmver, bs['rpm']): return (bs['name'], {}) for bsname, bsrepo in cfgmgr.bootstraps.items(): repolist = [] for repo in bsrepo.keys(): repolist.append(bsrepo[repo]) rpmver = None try: repomd = misc.get_metadata_from_repos(repolist, cachedir) rpmver = misc.get_rpmver_in_repo(repomd) except errors.CreatorError, e: msger.set_loglevel(lvl) raise if not rpmver: continue if compare_rpmversion(repo_rpmver, rpmver): msger.set_loglevel(lvl) return (bsname, bsrepo)