Package: distroinfo
distroinfois a python module for parsing, validating and querying
distribution/packaging metadata stored in human readable and reviewable
text/YAML files.This is a proper generic (re)implementation ofrdoinfoparser which
proved well suited for the task of interfacing with distribution
metadata in a human friendly way. If you consider code reviews human
friendly, that is.distroinfois a part ofSoftware Factory
projectSTATUSdistroinfois available from Fedora/EPEL repos and isBEING
INTEGRATED.rdopkgandDLRNare first
adopters.rdoinfocompatibility is ensured through offline and online tests.CI is enabled.Seedistroinfo
reviews.Use githubIssuesto make requests and report bugs.Installationfrom sourceIf you want to hackdistroinfoor just have the latest code without
waiting for next release, you can use the git repo directly:git clone https://github.com/softwarefactory-project/distroinfo
cd distroinfo
python setup.py develop --userYou may set the preference overdistroinfoRPM by correctly
positioning~/.local/bin/distroinfoin your$PATH.Or you can use virtualenv to avoid conflicts with RPM:git clone https://github.com/softwarefactory-project/distroinfo
cd distroinfo
virtualenv --system-site-packages ~/distroinfo-venv
source ~/distroinfo-venv/bin/activate
python setup.py develop
ln `which distroinfo` ~/bin/distroinfo-dev

distroinfo-dev --versionRequired python modules are listed inrequirements.txt.from Fedora/EPEL repos (default)distroinfois available onFedora 27and newer:dnf install python2-distroinfoincluding Python 3 version:dnf install python3-distroinfoOn CentOS/RHEL 7,distroinfois available fromEPEL.OnCentOS 7:yum install epel-release
yum install python2-distroinfoOnRHEL 7:yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install python2-distroinfofrom PyPIFor your convenience,distroinfois available from the Cheese Shop:pip install distroinfoUsageYou canfetch info files from an URLby specifyingremote_infobase URL:from distroinfo.info import DistroInfo

RDOINFO_RAW_URL = \
    'https://raw.githubusercontent.com/redhat-openstack/rdoinfo/master/'

di = DistroInfo('rdo-full.yml',
                remote_info=RDOINFO_RAW_URL)
info = di.get_info()Or you canfetch info files from a remote git repositoryusingremote_git_info:from distroinfo.info import DistroInfo

RDOINFO_GIT_URL = \
    'https://github.com/redhat-openstack/rdoinfo'

di = DistroInfo('rdo-full.yml',
                remote_git_info=RDOINFO_GIT_URL)
info = di.get_info()Or you canfetch info files from a local directoryusinglocal_info:from distroinfo.info import DistroInfo

INFO_PATH = '/path/to/info'

di = DistroInfo('rdo-full.yml',
                local_info=INFO_PATH)
info = di.get_info()For remote fetchers info files/repos are cached in~/.distroinfo/cache.You can navigate info structure yourself or usequerymodule:from distroinfo import query

# get a package info by strict package name
nova = query.get_package(info, 'openstack-nova')

# find a package by human reference (smart search)
keystone = query.find_package(info, 'keystone')Alternatively, you can get info withpackagesandreleasesas
dictionaries indexed by project/release name for easier access usinginfo_dicts=True:info = di.get_info(info_dicts=True)
nova = info['packages']['nova']It is also possible to filter packages matching a given criteria.
The following query will show all packages matching criteria conf: client AND tags: antelope.::# rexen is a dictionary of applied filters.
# pkg is the currently processed package.
info = di.get_info()
pkgs = info[‘packages’]
rexen = {“conf”: “client”, “tags”: “antelope”}finding = query.filter_pkgs(pkgs, rexen)It is also possible to apply negative filtering with “~” character, which
can be combined with other filters, like conf: client.::info = di.get_info()
pkgs = info[‘packages’]
rexen = {“tags”: “~newton”, “conf”: “client”}
finding = query.filter_pkgs(pkgs, rexen)When using this feature, the output will contain packages WITHOUT newton tag but
containing conf:client.Until proper documentation is in place, please refer to:rdoinfofor prime
example ofdistroinfoformat usagerdoinfo integration
testsfor code examplesdlrn.drivers.rdoinfofor a real world code that uses tags andremote_git_info/local_infodistroinfo.infoto RTFSCommand Line InterfaceA simple CLI is provided inscripts/di.pywhich can be used to test
basicdistroinfofunctionality, profile, dump parsed data, etc.An example of dumping parsed rdoinfo into both YAML and JSON files:$> ./scripts/di.py dump -y rdoinfo.yaml -j rdoinfo.json -f git \
       'https://github.com/redhat-openstack/rdoinfo' rdo-full.yml

Dumping YAML to: rdoinfo.yaml
Dumping JSON to: rdoinfo.jsonAdditionaldocoptmodule is required to run the CLI.BugsPlease use thegithub
Issuesto report bugs.