Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-distroinfo for openSUSE:Factory checked in at 2023-03-15 18:54:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-distroinfo (Old) and /work/SRC/openSUSE:Factory/.python-distroinfo.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-distroinfo" Wed Mar 15 18:54:40 2023 rev:5 rq:1071883 version:0.6.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-distroinfo/python-distroinfo.changes 2021-12-09 19:46:47.309167314 +0100 +++ /work/SRC/openSUSE:Factory/.python-distroinfo.new.31432/python-distroinfo.changes 2023-03-15 18:54:53.404505436 +0100 @@ -1,0 +2,9 @@ +Tue Mar 14 22:38:10 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.6.2: + * Add twine\_python parameter to upload-pypi + * Use python3 in build-python-release + * Add new filtering option and tests + * Add new unit tests and fixes others + +------------------------------------------------------------------- Old: ---- distroinfo-0.5.1.tar.gz New: ---- distroinfo-0.6.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-distroinfo.spec ++++++ --- /var/tmp/diff_new_pack.Bwtuvm/_old 2023-03-15 18:54:53.936508266 +0100 +++ /var/tmp/diff_new_pack.Bwtuvm/_new 2023-03-15 18:54:53.940508288 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-distroinfo # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-distroinfo -Version: 0.5.1 +Version: 0.6.2 Release: 0 Summary: Parsing, validation and query functions for packaging metadata License: Apache-2.0 ++++++ distroinfo-0.5.1.tar.gz -> distroinfo-0.6.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/.zuul.yaml new/distroinfo-0.6.2/.zuul.yaml --- old/distroinfo-0.5.1/.zuul.yaml 2021-09-13 15:58:06.000000000 +0200 +++ new/distroinfo-0.6.2/.zuul.yaml 2023-03-03 10:46:47.000000000 +0100 @@ -59,8 +59,9 @@ run: playbooks/dlrn-master.yaml nodeset: nodes: - - name: rdo-centos-8 - label: rdo-centos-8 + - name: rdo-centos-8-stream + label: rdo-centos-8-stream + required-projects: - DLRN @@ -84,4 +85,7 @@ - distroinfo-dlrn-master release: jobs: - - upload-pypi + - upload-pypi: + vars: + release_python: python3 + twine_python: python3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/AUTHORS new/distroinfo-0.6.2/AUTHORS --- old/distroinfo-0.5.1/AUTHORS 2021-09-13 15:58:48.000000000 +0200 +++ new/distroinfo-0.6.2/AUTHORS 2023-03-03 10:48:48.000000000 +0100 @@ -1,4 +1,5 @@ Alan Pevec <alan.pe...@redhat.com> +Alfredo Moralejo <amora...@redhat.com> Cédric Jeanneret <cjean...@redhat.com> Jakub RužiÄka <jruzi...@redhat.com> Javier Pena <jp...@redhat.com> @@ -8,4 +9,5 @@ Zuul CI <z...@softwarefactory-project.io> admin <ad...@softwarefactory-project.io> danpawlik <dpaw...@redhat.com> +karolinku <kk...@redhat.com> yatinkarel <yka...@redhat.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/ChangeLog new/distroinfo-0.6.2/ChangeLog --- old/distroinfo-0.5.1/ChangeLog 2021-09-13 15:58:48.000000000 +0200 +++ new/distroinfo-0.6.2/ChangeLog 2023-03-03 10:48:48.000000000 +0100 @@ -1,6 +1,22 @@ CHANGES ======= +0.6.2 +----- + +* Add twine\_python parameter to upload-pypi + +0.6.1 +----- + +* Use python3 in build-python-release + +0.6.0 +----- + +* Add new filtering option and tests +* Add new unit tests and fixes others + 0.5.1 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/PKG-INFO new/distroinfo-0.6.2/PKG-INFO --- old/distroinfo-0.5.1/PKG-INFO 2021-09-13 15:58:49.017749300 +0200 +++ new/distroinfo-0.6.2/PKG-INFO 2023-03-03 10:48:48.847440200 +0100 @@ -1,231 +1,11 @@ Metadata-Version: 2.1 Name: distroinfo -Version: 0.5.1 +Version: 0.6.2 Summary: python module for parsing, validating and querying distribution/packaging metadata stored in human readable and reviewable text/YAML files Home-page: https://github.com/softwarefactory-project/distroinfo Author: Jakub Ruzicka Author-email: d...@lists.rdoproject.org License: Apache Software License -Description: distroinfo - ========== - - ``distroinfo`` is 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 of - `rdoinfo <https://github.com/redhat-openstack/rdoinfo>`__ parser 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. - - ``distroinfo`` is a part of `Software Factory - project <https://softwarefactory-project.io/docs/>`__ - - STATUS - ------ - - ``distroinfo`` is available from Fedora/EPEL repos and is **BEING - INTEGRATED**. - - `rdopkg <https://github.com/softwarefactory-project/rdopkg>`__ and - `DLRN <https://github.com/softwarefactory-project/DLRN>`__ are first - adopters. - - ``rdoinfo`` compatibility is ensured through offline and online tests. - - CI is enabled. - - See `distroinfo - reviews <https://softwarefactory-project.io/dashboard/project_distroinfo>`__. - - Use github - `Issues <https://github.com/softwarefactory-project/distroinfo/issues>`__ - to make requests and report bugs. - - Installation - ------------ - - from source - ~~~~~~~~~~~ - - If you want to hack ``distroinfo`` or 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 --user - - You may set the preference over ``distroinfo`` RPM by correctly - positioning ``~/.local/bin/distroinfo`` in 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 --version - - Required python modules are listed in - `requirements.txt <requirements.txt>`__. - - from Fedora/EPEL repos (default) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - ``distroinfo`` is available on **Fedora 27** and newer: - - :: - - dnf install python2-distroinfo - - including Python 3 version: - - :: - - dnf install python3-distroinfo - - On CentOS/RHEL 7, ``distroinfo`` is available from - `EPEL <https://fedoraproject.org/wiki/EPEL>`__. - - On **CentOS 7**: - - :: - - yum install epel-release - yum install python2-distroinfo - - On **RHEL 7**: - - :: - - yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - yum install python2-distroinfo - - from PyPI - ~~~~~~~~~ - - For your convenience, ``distroinfo`` is available from the Cheese Shop: - - :: - - pip install distroinfo - - Usage - ----- - - You can **fetch info files from an URL** by specifying ``remote_info`` - base 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 can **fetch info files from a remote git repository** using - ``remote_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 can **fetch info files from a local directory** using - ``local_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 use ``query`` module: - - :: - - 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 with ``packages`` and ``releases`` as - dictionaries indexed by project/release name for easier access using - ``info_dicts=True``: - - :: - - info = di.get_info(info_dicts=True) - nova = info['packages']['nova'] - - Until proper documentation is in place, please refer to: - - - `rdoinfo <https://github.com/redhat-openstack/rdoinfo>`__ for prime - example of ``distroinfo`` format usage - - `rdoinfo integration - tests <https://github.com/softwarefactory-project/distroinfo/blob/master/tests/integration/test_rdoinfo_online.py>`__ - for code examples - - `dlrn.drivers.rdoinfo <https://github.com/softwarefactory-project/DLRN/blob/master/dlrn/drivers/rdoinfo.py>`__ - for a real world code that uses tags and - ``remote_git_info``/``local_info`` - - `distroinfo.info <https://github.com/softwarefactory-project/distroinfo/blob/master/distroinfo/info.py>`__ - to RTFS - - Command Line Interface - ---------------------- - - A simple CLI is provided in ``scripts/di.py`` which can be used to test - basic ``distroinfo`` functionality, 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.json - - Additional ``docopt`` module is required to run the CLI. - - Bugs - ---- - - Please use the `github - Issues <https://github.com/softwarefactory-project/distroinfo/issues>`__ - to report bugs. - - -Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 @@ -238,3 +18,247 @@ Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Description-Content-Type: text/x-rst +License-File: LICENSE + +distroinfo +========== + +``distroinfo`` is 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 of +`rdoinfo <https://github.com/redhat-openstack/rdoinfo>`__ parser 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. + +``distroinfo`` is a part of `Software Factory +project <https://softwarefactory-project.io/docs/>`__ + +STATUS +------ + +``distroinfo`` is available from Fedora/EPEL repos and is **BEING +INTEGRATED**. + +`rdopkg <https://github.com/softwarefactory-project/rdopkg>`__ and +`DLRN <https://github.com/softwarefactory-project/DLRN>`__ are first +adopters. + +``rdoinfo`` compatibility is ensured through offline and online tests. + +CI is enabled. + +See `distroinfo +reviews <https://softwarefactory-project.io/dashboard/project_distroinfo>`__. + +Use github +`Issues <https://github.com/softwarefactory-project/distroinfo/issues>`__ +to make requests and report bugs. + +Installation +------------ + +from source +~~~~~~~~~~~ + +If you want to hack ``distroinfo`` or 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 --user + +You may set the preference over ``distroinfo`` RPM by correctly +positioning ``~/.local/bin/distroinfo`` in 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 --version + +Required python modules are listed in +`requirements.txt <requirements.txt>`__. + +from Fedora/EPEL repos (default) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``distroinfo`` is available on **Fedora 27** and newer: + +:: + + dnf install python2-distroinfo + +including Python 3 version: + +:: + + dnf install python3-distroinfo + +On CentOS/RHEL 7, ``distroinfo`` is available from +`EPEL <https://fedoraproject.org/wiki/EPEL>`__. + +On **CentOS 7**: + +:: + + yum install epel-release + yum install python2-distroinfo + +On **RHEL 7**: + +:: + + yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + yum install python2-distroinfo + +from PyPI +~~~~~~~~~ + +For your convenience, ``distroinfo`` is available from the Cheese Shop: + +:: + + pip install distroinfo + +Usage +----- + +You can **fetch info files from an URL** by specifying ``remote_info`` +base 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 can **fetch info files from a remote git repository** using +``remote_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 can **fetch info files from a local directory** using +``local_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 use ``query`` module: + +:: + + 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 with ``packages`` and ``releases`` as +dictionaries indexed by project/release name for easier access using +``info_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: + +- `rdoinfo <https://github.com/redhat-openstack/rdoinfo>`__ for prime + example of ``distroinfo`` format usage +- `rdoinfo integration + tests <https://github.com/softwarefactory-project/distroinfo/blob/master/tests/integration/test_rdoinfo_online.py>`__ + for code examples +- `dlrn.drivers.rdoinfo <https://github.com/softwarefactory-project/DLRN/blob/master/dlrn/drivers/rdoinfo.py>`__ + for a real world code that uses tags and + ``remote_git_info``/``local_info`` +- `distroinfo.info <https://github.com/softwarefactory-project/distroinfo/blob/master/distroinfo/info.py>`__ + to RTFS + +Command Line Interface +---------------------- + +A simple CLI is provided in ``scripts/di.py`` which can be used to test +basic ``distroinfo`` functionality, 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.json + +Additional ``docopt`` module is required to run the CLI. + +Bugs +---- + +Please use the `github +Issues <https://github.com/softwarefactory-project/distroinfo/issues>`__ +to report bugs. + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/README.rst new/distroinfo-0.6.2/README.rst --- old/distroinfo-0.5.1/README.rst 2021-09-13 15:58:06.000000000 +0200 +++ new/distroinfo-0.6.2/README.rst 2023-03-03 10:46:47.000000000 +0100 @@ -178,6 +178,30 @@ 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: - `rdoinfo <https://github.com/redhat-openstack/rdoinfo>`__ for prime diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/distroinfo/query.py new/distroinfo-0.6.2/distroinfo/query.py --- old/distroinfo-0.5.1/distroinfo/query.py 2021-09-13 15:58:06.000000000 +0200 +++ new/distroinfo-0.6.2/distroinfo/query.py 2023-03-03 10:46:47.000000000 +0100 @@ -100,11 +100,17 @@ def _match_pkg(rexen, pkg): for attr, rex in rexen.items(): + exclusion = False + if rex[0] == "~": + exclusion = True + rex = rex[1:] val = pkg.get(attr) if val is None: return False if isinstance(val, six.string_types): - if not re.search(rex, val): + if exclusion is False and not re.search(rex, val): + return False + if exclusion is True and re.search(rex, val): return False elif isinstance(val, Iterable): # collection matches if any item of collection matches @@ -113,7 +119,9 @@ if re.search(rex, e): found = True break - if not found: + if found is False and exclusion is False: + return False + elif found is True and exclusion is True: return False else: raise exception.InvalidPackageFilter( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/distroinfo.egg-info/PKG-INFO new/distroinfo-0.6.2/distroinfo.egg-info/PKG-INFO --- old/distroinfo-0.5.1/distroinfo.egg-info/PKG-INFO 2021-09-13 15:58:48.000000000 +0200 +++ new/distroinfo-0.6.2/distroinfo.egg-info/PKG-INFO 2023-03-03 10:48:48.000000000 +0100 @@ -1,231 +1,11 @@ Metadata-Version: 2.1 Name: distroinfo -Version: 0.5.1 +Version: 0.6.2 Summary: python module for parsing, validating and querying distribution/packaging metadata stored in human readable and reviewable text/YAML files Home-page: https://github.com/softwarefactory-project/distroinfo Author: Jakub Ruzicka Author-email: d...@lists.rdoproject.org License: Apache Software License -Description: distroinfo - ========== - - ``distroinfo`` is 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 of - `rdoinfo <https://github.com/redhat-openstack/rdoinfo>`__ parser 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. - - ``distroinfo`` is a part of `Software Factory - project <https://softwarefactory-project.io/docs/>`__ - - STATUS - ------ - - ``distroinfo`` is available from Fedora/EPEL repos and is **BEING - INTEGRATED**. - - `rdopkg <https://github.com/softwarefactory-project/rdopkg>`__ and - `DLRN <https://github.com/softwarefactory-project/DLRN>`__ are first - adopters. - - ``rdoinfo`` compatibility is ensured through offline and online tests. - - CI is enabled. - - See `distroinfo - reviews <https://softwarefactory-project.io/dashboard/project_distroinfo>`__. - - Use github - `Issues <https://github.com/softwarefactory-project/distroinfo/issues>`__ - to make requests and report bugs. - - Installation - ------------ - - from source - ~~~~~~~~~~~ - - If you want to hack ``distroinfo`` or 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 --user - - You may set the preference over ``distroinfo`` RPM by correctly - positioning ``~/.local/bin/distroinfo`` in 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 --version - - Required python modules are listed in - `requirements.txt <requirements.txt>`__. - - from Fedora/EPEL repos (default) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - ``distroinfo`` is available on **Fedora 27** and newer: - - :: - - dnf install python2-distroinfo - - including Python 3 version: - - :: - - dnf install python3-distroinfo - - On CentOS/RHEL 7, ``distroinfo`` is available from - `EPEL <https://fedoraproject.org/wiki/EPEL>`__. - - On **CentOS 7**: - - :: - - yum install epel-release - yum install python2-distroinfo - - On **RHEL 7**: - - :: - - yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - yum install python2-distroinfo - - from PyPI - ~~~~~~~~~ - - For your convenience, ``distroinfo`` is available from the Cheese Shop: - - :: - - pip install distroinfo - - Usage - ----- - - You can **fetch info files from an URL** by specifying ``remote_info`` - base 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 can **fetch info files from a remote git repository** using - ``remote_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 can **fetch info files from a local directory** using - ``local_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 use ``query`` module: - - :: - - 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 with ``packages`` and ``releases`` as - dictionaries indexed by project/release name for easier access using - ``info_dicts=True``: - - :: - - info = di.get_info(info_dicts=True) - nova = info['packages']['nova'] - - Until proper documentation is in place, please refer to: - - - `rdoinfo <https://github.com/redhat-openstack/rdoinfo>`__ for prime - example of ``distroinfo`` format usage - - `rdoinfo integration - tests <https://github.com/softwarefactory-project/distroinfo/blob/master/tests/integration/test_rdoinfo_online.py>`__ - for code examples - - `dlrn.drivers.rdoinfo <https://github.com/softwarefactory-project/DLRN/blob/master/dlrn/drivers/rdoinfo.py>`__ - for a real world code that uses tags and - ``remote_git_info``/``local_info`` - - `distroinfo.info <https://github.com/softwarefactory-project/distroinfo/blob/master/distroinfo/info.py>`__ - to RTFS - - Command Line Interface - ---------------------- - - A simple CLI is provided in ``scripts/di.py`` which can be used to test - basic ``distroinfo`` functionality, 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.json - - Additional ``docopt`` module is required to run the CLI. - - Bugs - ---- - - Please use the `github - Issues <https://github.com/softwarefactory-project/distroinfo/issues>`__ - to report bugs. - - -Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 @@ -238,3 +18,247 @@ Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Description-Content-Type: text/x-rst +License-File: LICENSE + +distroinfo +========== + +``distroinfo`` is 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 of +`rdoinfo <https://github.com/redhat-openstack/rdoinfo>`__ parser 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. + +``distroinfo`` is a part of `Software Factory +project <https://softwarefactory-project.io/docs/>`__ + +STATUS +------ + +``distroinfo`` is available from Fedora/EPEL repos and is **BEING +INTEGRATED**. + +`rdopkg <https://github.com/softwarefactory-project/rdopkg>`__ and +`DLRN <https://github.com/softwarefactory-project/DLRN>`__ are first +adopters. + +``rdoinfo`` compatibility is ensured through offline and online tests. + +CI is enabled. + +See `distroinfo +reviews <https://softwarefactory-project.io/dashboard/project_distroinfo>`__. + +Use github +`Issues <https://github.com/softwarefactory-project/distroinfo/issues>`__ +to make requests and report bugs. + +Installation +------------ + +from source +~~~~~~~~~~~ + +If you want to hack ``distroinfo`` or 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 --user + +You may set the preference over ``distroinfo`` RPM by correctly +positioning ``~/.local/bin/distroinfo`` in 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 --version + +Required python modules are listed in +`requirements.txt <requirements.txt>`__. + +from Fedora/EPEL repos (default) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``distroinfo`` is available on **Fedora 27** and newer: + +:: + + dnf install python2-distroinfo + +including Python 3 version: + +:: + + dnf install python3-distroinfo + +On CentOS/RHEL 7, ``distroinfo`` is available from +`EPEL <https://fedoraproject.org/wiki/EPEL>`__. + +On **CentOS 7**: + +:: + + yum install epel-release + yum install python2-distroinfo + +On **RHEL 7**: + +:: + + yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + yum install python2-distroinfo + +from PyPI +~~~~~~~~~ + +For your convenience, ``distroinfo`` is available from the Cheese Shop: + +:: + + pip install distroinfo + +Usage +----- + +You can **fetch info files from an URL** by specifying ``remote_info`` +base 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 can **fetch info files from a remote git repository** using +``remote_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 can **fetch info files from a local directory** using +``local_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 use ``query`` module: + +:: + + 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 with ``packages`` and ``releases`` as +dictionaries indexed by project/release name for easier access using +``info_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: + +- `rdoinfo <https://github.com/redhat-openstack/rdoinfo>`__ for prime + example of ``distroinfo`` format usage +- `rdoinfo integration + tests <https://github.com/softwarefactory-project/distroinfo/blob/master/tests/integration/test_rdoinfo_online.py>`__ + for code examples +- `dlrn.drivers.rdoinfo <https://github.com/softwarefactory-project/DLRN/blob/master/dlrn/drivers/rdoinfo.py>`__ + for a real world code that uses tags and + ``remote_git_info``/``local_info`` +- `distroinfo.info <https://github.com/softwarefactory-project/distroinfo/blob/master/distroinfo/info.py>`__ + to RTFS + +Command Line Interface +---------------------- + +A simple CLI is provided in ``scripts/di.py`` which can be used to test +basic ``distroinfo`` functionality, 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.json + +Additional ``docopt`` module is required to run the CLI. + +Bugs +---- + +Please use the `github +Issues <https://github.com/softwarefactory-project/distroinfo/issues>`__ +to report bugs. + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/distroinfo.egg-info/pbr.json new/distroinfo-0.6.2/distroinfo.egg-info/pbr.json --- old/distroinfo-0.5.1/distroinfo.egg-info/pbr.json 2021-09-13 15:58:48.000000000 +0200 +++ new/distroinfo-0.6.2/distroinfo.egg-info/pbr.json 2023-03-03 10:48:48.000000000 +0100 @@ -1 +1 @@ -{"git_version": "cffe66f", "is_release": true} \ No newline at end of file +{"git_version": "6d9ce5c", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/tests/assets/info/rdoinfo/deps.yml new/distroinfo-0.6.2/tests/assets/info/rdoinfo/deps.yml --- old/distroinfo-0.5.1/tests/assets/info/rdoinfo/deps.yml 2021-09-13 15:58:06.000000000 +0200 +++ new/distroinfo-0.6.2/tests/assets/info/rdoinfo/deps.yml 2023-03-03 10:46:47.000000000 +0100 @@ -14,9 +14,9 @@ rdo-dependency: # This is the conf for dependencies in rdo-common not being entirely managed # in review.r.o but using cbs-tags for automatic tagging - distgit: https://github.com/rdo-common/%(project)s + distgit: http://review.rdoproject.org/r/deps/%(project)s.git patches: - master-distgit: https://github.com/rdo-common/%(project)s + master-distgit: http://review.rdoproject.org/r/deps/%(project)s.git review-patches: review-origin: tags: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/tests/test_common.py new/distroinfo-0.6.2/tests/test_common.py --- old/distroinfo-0.5.1/tests/test_common.py 2021-09-13 15:58:06.000000000 +0200 +++ new/distroinfo-0.6.2/tests/test_common.py 2023-03-03 10:46:47.000000000 +0100 @@ -75,7 +75,7 @@ 'conf': 'rdo-dependency', 'upstream': 'https://github.com/sphinx-doc/sphinx', 'patches': None, - 'distgit': 'https://github.com/rdo-common/python-sphinx', + 'distgit': 'http://review.rdoproject.org/r/deps/python-sphinx.git' } assert_dict_contains(pkg, expected=sphinx) assert 'tags' in pkg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distroinfo-0.5.1/tests/unit/test_query.py new/distroinfo-0.6.2/tests/unit/test_query.py --- old/distroinfo-0.5.1/tests/unit/test_query.py 2021-09-13 15:58:06.000000000 +0200 +++ new/distroinfo-0.6.2/tests/unit/test_query.py 2023-03-03 10:46:47.000000000 +0100 @@ -1,4 +1,6 @@ import copy +import six +import unittest from distroinfo.info import DistroInfo from distroinfo import query @@ -98,6 +100,7 @@ assert(not finding) +@unittest.skipIf(six.PY2, "Test fails randomly in python2") def test_find_element_in_sub_dict_list(): di = DistroInfo('minimal.yml', local_info=common.get_test_info_path('minimal')) @@ -107,3 +110,60 @@ assert(finding) assert(finding == info['releases'][0]) + + +def test_single_filter_pkgs_found(): + di = DistroInfo('minimal.yml', + local_info=common.get_test_info_path('minimal')) + info = di.get_info() + pkgs = info['packages'] + + rexen = {"project": "keystonemiddleware"} + finding = query.filter_pkgs(pkgs, rexen) + + assert(isinstance(finding, list)) + assert(len(finding) == 1) + assert("keystonemiddleware" in finding[0]["name"]) + + +def test_multiple_filter_found(): + di = DistroInfo('minimal.yml', + local_info=common.get_test_info_path('minimal')) + info = di.get_info() + pkgs = info['packages'] + + rexen = {"project": "nova", "maintainers": "s...@redhat.com"} + finding = query.filter_pkgs(pkgs, rexen) + + # expected number of foung pkgs is 2 + assert(isinstance(finding, list)) + assert(len(finding) == 2) + + +def test_filter_pkgs_not_found(): + di = DistroInfo('minimal.yml', + local_info=common.get_test_info_path('minimal')) + info = di.get_info() + pkgs = info['packages'] + + rexen = {"project": "nosuchproject", "tags": "newton"} + finding = query.filter_pkgs(pkgs, rexen) + + # no package should be found + assert(isinstance(finding, list)) + assert(len(finding) == 0) + + +def test_exclusion_filter_found(): + di = DistroInfo('minimal.yml', + local_info=common.get_test_info_path('minimal')) + info = di.get_info() + pkgs = info['packages'] + rexen = {"tags": "~newton"} + + finding = query.filter_pkgs(pkgs, rexen) + + assert(finding) + assert(isinstance(finding, list)) + assert(len(finding) == 1) + assert("newton" not in finding[0]["tags"])