def getpackages(self, **kwargs): """ Valid parameters: :param local_info_repo: local rdoinfo repo to use instead of fetching the default one using rdopkg. :param tags: OpenStack release tags to use (mitaka, newton, etc). """ local_info_repo = kwargs.get('local_info_repo') tags = kwargs.get('tags') inforepo = None if local_info_repo: inforepo = rdoinfo.RdoinfoRepo(local_repo_path=local_info_repo, apply_tag=tags, include_fns=[]) elif self.config_options.rdoinfo_repo: inforepo = rdoinfo.RdoinfoRepo(rdopkg_cfg['HOME_DIR'], self.config_options.rdoinfo_repo, apply_tag=tags, include_fns=[]) inforepo.init() else: inforepo = rdoinfo.get_default_inforepo(apply_tag=tags, include_fns=[]) # rdopkg will clone/pull rdoinfo repo as needed (~/.rdopkg/rdoinfo) inforepo.init() pkginfo = inforepo.get_info() self.packages = pkginfo["packages"] if tags: # FIXME allow list of tags? self.packages = rdoinfo.filter_pkgs(self.packages, {'tags': tags}) return self.packages
def getpkginfo(local_info_repo=None): inforepo = None if local_info_repo: inforepo = rdoinfo.RdoinfoRepo(local_repo_path=local_info_repo, verbose=False) else: inforepo = rdoinfo.RdoinfoRepo(rdopkg.conf.cfg['HOME_DIR'], rdopkg.conf.cfg['RDOINFO_REPO'], verbose=False) # rdopkg will clone/pull rdoinfo repo as needed (~/.rdopkg/rdoinfo) inforepo.init() return inforepo.get_info()
def info(pkgs=None, local_info=None, apply_tag=None, force_fetch=False): if local_info: inforepo = rdoinfo.RdoinfoRepo(local_repo_path=local_info, apply_tag=apply_tag) else: inforepo = rdoinfo.get_default_inforepo(apply_tag=apply_tag) inforepo.init(force_fetch=force_fetch) if pkgs: filters = {} for pf in pkgs: attr, sep, rex = pf.partition(':') if not sep: # filter by name by default attr = 'name' rex = pf filters[attr] = rex inforepo.print_pkgs(filters) else: inforepo.print_summary() print('') print("Supply regex filter(s) to list package details, e.g.:\n{t.cmd}" " rdopkg info nova\n" " rdopkg info conf:client maintainers:jruzicka\n" " rdopkg info '.*'" "{t.normal}".format(t=log.term))
def findpkg(query, strict=False, local_info=None, force_fetch=False): if local_info: inforepo = rdoinfo.RdoinfoRepo(local_repo_path=local_info) else: inforepo = rdoinfo.get_default_inforepo() inforepo.init(force_fetch=force_fetch) pkg = inforepo.find_package(query, strict=strict) if not pkg: raise exception.InvalidRDOPackage( msg="No package found in rdoinfo for query: %s" % query) rdoinfo.print_pkg(pkg)
def info_tags_diff(local_info=None, apply_tag=None): if local_info: inforepo = rdoinfo.RdoinfoRepo(local_repo_path=local_info, apply_tag=apply_tag) else: inforepo = rdoinfo.get_default_inforepo(apply_tag=apply_tag) info1 = inforepo.get_info(gitrev='HEAD~') info2 = inforepo.get_info() tdiff = rdoinfo.tags_diff(info1, info2) if not tdiff: sys.stderr.write("No tag changes detected.\n") else: for pkg, changes in tdiff: print("%s %s" % (pkg, changes))
def getpackages(local_info_repo=None, tags=None): inforepo = None if local_info_repo: inforepo = rdoinfo.RdoinfoRepo(local_repo_path=local_info_repo, apply_tag=tags) else: inforepo = rdoinfo.get_default_inforepo(apply_tag=tags) # rdopkg will clone/pull rdoinfo repo as needed (~/.rdopkg/rdoinfo) inforepo.init() pkginfo = inforepo.get_info() packages = pkginfo["packages"] if tags: # FIXME allow list of tags? packages = rdoinfo.filter_pkgs(packages, {'tags': tags}) return packages
def _get_rdoinfo(): inforepo = rdoinfo.RdoinfoRepo(cfg['HOME_DIR'], cfg['RDOINFO_REPO']) inforepo.init(force_fetch=False) return inforepo.get_info()