From d48d9ef9975e28326ea24f8b7bfc598d11575dbd Mon Sep 17 00:00:00 2001 From: FrantiĊĦek Zatloukal Date: Nov 01 2018 15:53:01 +0000 Subject: Provide both python2 and python3 libs Taskotron now consists of three packages: * taskotron-runner (runtask + disposable client deps) * python2-libtaskotron * python3-libtaskotron --- diff --git a/libtaskotron.spec b/libtaskotron.spec index 4d6b277..4fd9e4f 100644 --- a/libtaskotron.spec +++ b/libtaskotron.spec @@ -1,6 +1,6 @@ Name: libtaskotron # NOTE: if you update version, *make sure* to also update `libtaskotron/__init__.py` -Version: 0.9.1 +Version: 0.9.2 Release: 1%{?dist} Summary: Taskotron Support Library @@ -10,131 +10,162 @@ Source0: https://qa.fedoraproject.org/releases/%{name}/%{name}-%{version} BuildArch: noarch -Requires: libtaskotron-config = %{version}-%{release} -Requires: libtaskotron-core = %{version}-%{release} -Requires: libtaskotron-fedora = %{version}-%{release} -Requires: libtaskotron-disposable = %{version}-%{release} - %description -Libtaskotron is a support library for running taskotron tasks. The top level -libtaskotron package is a meta-package which will install all sub-packages. +Libtaskotron is a support library for running taskotron tasks. -# ********* libtaskotron-core ********* +# ********* python2-libtaskotron ********* -%package -n libtaskotron-core -Summary: The minimal, core parts of libtaskotron +%package -n python2-libtaskotron +Summary: libtaskotron python2 libraries -Requires: ansible >= 2.3 -Requires: libtaskotron-config = %{version}-%{release} -Requires: python2-configparser >= 3.5.0b2 -Requires: python2-jinja2 >= 2.8 -Requires: python2-resultsdb_api >= 2.0.0 -Requires: python2-requests >= 2.7.0 +Requires: ansible +Requires: createrepo_c +Requires: dnf +Requires: python2-configparser +Requires: python2-fedora +Requires: python2-hawkey +Requires: python2-jinja2 +Requires: python2-koji +Requires: python2-progressbar +Requires: python2-requests +Requires: python2-resultsdb_api +Requires: python2-rpm Requires: python2-setuptools -Requires: python2-xunitparser >= 1.3.3 +Requires: python2-xunitparser # used by 'synchronize' task in ansible Requires: rsync %if 0%{?fedora} <= 27 -Requires: python-progressbar >= 2.3 -Requires: PyYAML >= 3.11 +Requires: PyYAML +Requires: python-munch %else -Requires: python2-progressbar >= 2.3 -Requires: python2-pyyaml >= 3.11 +Requires: python2-pyyaml +Requires: python2-munch %endif -BuildRequires: ansible >= 2.3 -BuildRequires: grep +BuildRequires: python2-configparser BuildRequires: python2-devel -BuildRequires: python2-configparser >= 3.5.0b2 -BuildRequires: python2-mock >= 2.0.0 -BuildRequires: python2-pytest >= 2.7.3 -BuildRequires: python2-pytest-cov >= 2.2.1 -BuildRequires: python2-resultsdb_api >= 2.0.0 -BuildRequires: python2-requests >= 2.7.0 +BuildRequires: python2-fedora +BuildRequires: python2-hawkey +BuildRequires: python2-koji +BuildRequires: python2-mock +BuildRequires: python2-progressbar +BuildRequires: python2-pytest +BuildRequires: python2-pytest-cov +BuildRequires: python2-requests +BuildRequires: python2-resultsdb_api +BuildRequires: python2-rpmfluff BuildRequires: python2-setuptools -BuildRequires: python2-sphinx_rtd_theme >= 0.1.9 -BuildRequires: python2-xunitparser >= 1.3.3 -BuildRequires: rsync -BuildRequires: sed +BuildRequires: python2-sphinx_rtd_theme +BuildRequires: python2-testcloud +BuildRequires: python2-xunitparser %if 0%{?fedora} <= 27 -BuildRequires: python-progressbar >= 2.3 -BuildRequires: PyYAML >= 3.11 +BuildRequires: PyYAML +BuildRequires: python-munch %else -BuildRequires: python2-progressbar >= 2.3 -BuildRequires: python2-pyyaml >= 3.11 +BuildRequires: python2-pyyaml +BuildRequires: python2-munch %endif -# ansible needs this for running (as part of the test suite) -BuildRequires: /usr/bin/python +%description -n python2-libtaskotron +Libtaskotron libraries built for Python 2. -%description -n libtaskotron-core -The minimal, core parts of libtaskotron that are needed to run tasks +# ********* python3-libtaskotron ********* -# ******* libtaskotron-config ******** - -%package -n libtaskotron-config -Summary: Configuration files needed for using libtaskotron - -%description -n libtaskotron-config -libtaskotron-config contains all of the configuration files needed for using -libtaskotron. - -# ******** libtaskotron-fedora ******** - -%package -n libtaskotron-fedora -Summary: Fedora specific module for libtaskotron +%package -n python3-libtaskotron +Summary: libtaskotron python3 libraries +Requires: ansible Requires: createrepo_c -Requires: dnf >= 0.6.4 -Requires: libtaskotron-core = %{version}-%{release} -Requires: python2-fedora >= 0.8.0 -Requires: python2-hawkey >= 0.4.13-1 -Requires: python2-koji >= 1.10.0 -Requires: python2-rpm +Requires: dnf +Requires: python3-configparser +Requires: python3-fedora +Requires: python3-hawkey +Requires: python3-jinja2 +Requires: python3-koji +Requires: python3-munch +Requires: python3-progressbar +Requires: python3-requests +Requires: python3-resultsdb_api +Requires: python3-rpm +Requires: python3-setuptools +Requires: python3-xunitparser +# used by 'synchronize' task in ansible +Requires: rsync -%if 0%{?fedora} <= 27 -Requires: python-munch >= 2.0.2 +%if 0%{?fedora} <= 28 +Requires: python3-PyYAML %else -Requires: python2-munch >= 2.0.2 +Requires: python3-pyyaml %endif -BuildRequires: python2-fedora >= 0.8.0 -BuildRequires: python2-hawkey >= 0.4.13-1 -BuildRequires: python2-rpmfluff >= 0.5.1 -BuildRequires: python2-koji >= 1.10.0 +BuildRequires: python3-configparser +BuildRequires: python3-devel +BuildRequires: python3-fedora +BuildRequires: python3-hawkey +BuildRequires: python3-koji +BuildRequires: python3-mock +BuildRequires: python3-munch +BuildRequires: python3-progressbar +BuildRequires: python3-pytest +BuildRequires: python3-pytest-cov +BuildRequires: python3-requests +BuildRequires: python3-resultsdb_api +BuildRequires: python3-rpmfluff +BuildRequires: python3-setuptools +BuildRequires: python3-sphinx_rtd_theme +BuildRequires: python3-testcloud +BuildRequires: python3-xunitparser -%if 0%{?fedora} <= 27 -BuildRequires: python-munch >= 2.0.2 +%if 0%{?fedora} <= 28 +BuildRequires: python3-PyYAML %else -BuildRequires: python2-munch >= 2.0.2 +BuildRequires: python3-pyyaml %endif -%description -n libtaskotron-fedora -Module for libtaskotron which contains all functionality which is fedora-only +%description -n python3-libtaskotron +Libtaskotron libraries built for Python 3. -# ****** libtaskotron-disposable ****** +# ****** taskotron-runner ****** -%package -n libtaskotron-disposable -Summary: disposable client module for libtaskotron +%package -n taskotron-runner +Summary: runtask binary used to execute tasks -Requires: libtaskotron-core = %{version}-%{release} +Provides: libtaskotron = %{version}-%{release} +Provides: libtaskotron-core = %{version}-%{release} +Provides: libtaskotron-fedora = %{version}-%{release} +Provides: libtaskotron-disposable = %{version}-%{release} +Provides: libtaskotron-config = %{version}-%{release} +Obsoletes: libtaskotron < 0.9.2-1 +Obsoletes: libtaskotron-core < 0.9.2-1 +Obsoletes: libtaskotron-fedora < 0.9.2-1 +Obsoletes: libtaskotron-disposable < 0.9.2-1 +Obsoletes: libtaskotron-config < 0.9.2-1 -%if 0%{?fedora} <= 28 -Requires: testcloud >= 0.1.15 -BuildRequires: testcloud >= 0.1.15 -%else -Requires: python2-testcloud >= 0.1.15 -BuildRequires: python2-testcloud >= 0.1.15 +BuildRequires: ansible +BuildRequires: grep +# used by 'synchronize' task in ansible +BuildRequires: rsync +BuildRequires: sed + +# ansible needs this for running (as part of the test suite) +# see https://bugzilla.redhat.com/show_bug.cgi?id=1639654 +BuildRequires: /usr/bin/python + +%if 0%{?fedora} <= 29 +# To keep python2 library installed on update +Requires: python2-libtaskotron = %{version}-%{release} %endif +Requires: python3-libtaskotron = %{version}-%{release} +Requires: python3-testcloud -%description -n libtaskotron-disposable -Module for libtaskotron which enables the use of disposable clients +%description -n taskotron-runner +libtaskotron's runtask binary which is used to execute taskotron tasks. # ************************************* -%pre core +%pre getent group taskotron >/dev/null || groupadd taskotron %prep @@ -145,14 +176,17 @@ getent group taskotron >/dev/null || groupadd taskotron # patch config files after testing is done, but before py[co] files are built # (so that they match the source files) %{__python2} setup.py test +%{__python3} setup.py test # adjust data path in config sed -i "/_data_dir/s#_data_dir = '../data'#_data_dir = '%{_datarootdir}/libtaskotron'#" libtaskotron/config_defaults.py grep -Fq "_data_dir = '%{_datarootdir}/libtaskotron'" libtaskotron/config_defaults.py # build files %py2_build +%py3_build %install %py2_install +%py3_install # configuration files mkdir -p %{buildroot}%{_sysconfdir}/taskotron/ @@ -179,46 +213,60 @@ install -d %{buildroot}/%{_sharedstatedir}/taskotron/images mkdir -p %{buildroot}%{_datarootdir}/libtaskotron cp -a data/* %{buildroot}%{_datarootdir}/libtaskotron -%files - -%files -n libtaskotron-core +%files -n taskotron-runner +%{_bindir}/runtask %doc README.rst %license LICENSE -%{python2_sitelib}/libtaskotron/*.py* -%{python2_sitelib}/libtaskotron/directives/*.py* -%{python2_sitelib}/libtaskotron/ext/*.py* -%{python2_sitelib}/*.egg-info -%dir %{python2_sitelib}/libtaskotron/ext/fedora -%dir %{python2_sitelib}/libtaskotron/ext -%dir %{python2_sitelib}/libtaskotron/directives +%files -n python2-libtaskotron +%{python2_sitelib}/%{name}/ +%{python2_sitelib}/%{name}-*.egg-info -%attr(755, root, root) %{_bindir}/runtask -%attr(755, root, root) %{_bindir}/taskotron_result +%dir %{_sysconfdir}/taskotron +%config(noreplace) %{_sysconfdir}/taskotron/namespaces.yaml +%config(noreplace) %{_sysconfdir}/taskotron/taskotron.yaml +%config %{_sysconfdir}/taskotron/yumrepoinfo.conf -%dir %attr(2775, root, taskotron) %{_tmppath}/taskotron -%dir %attr(2775, root, taskotron) %{_localstatedir}/log/taskotron -%dir %attr(2775, root, taskotron) %{_localstatedir}/cache/taskotron +%{_datarootdir}/libtaskotron %dir %attr(0775, root, taskotron) %{_sharedstatedir}/taskotron +%dir %attr(2775, root, taskotron) %{_localstatedir}/cache/taskotron +%dir %attr(2775, root, taskotron) %{_localstatedir}/log/taskotron %dir %attr(2775, root, taskotron) %{_sharedstatedir}/taskotron/artifacts %dir %attr(2775, root, taskotron) %{_sharedstatedir}/taskotron/images -%{_datarootdir}/libtaskotron +%dir %attr(2775, root, taskotron) %{_tmppath}/taskotron + +%doc README.rst +%license LICENSE + +%files -n python3-libtaskotron +%{_bindir}/taskotron_result + +%{python3_sitelib}/%{name}/ +%{python3_sitelib}/%{name}-*.egg-info -%files -n libtaskotron-config %dir %{_sysconfdir}/taskotron -%config(noreplace) %{_sysconfdir}/taskotron/taskotron.yaml %config(noreplace) %{_sysconfdir}/taskotron/namespaces.yaml +%config(noreplace) %{_sysconfdir}/taskotron/taskotron.yaml %config %{_sysconfdir}/taskotron/yumrepoinfo.conf -%files -n libtaskotron-fedora -%dir %{python2_sitelib}/libtaskotron/ext/fedora -%{python2_sitelib}/libtaskotron/ext/fedora/* +%{_datarootdir}/libtaskotron +%dir %attr(0775, root, taskotron) %{_sharedstatedir}/taskotron +%dir %attr(2775, root, taskotron) %{_localstatedir}/cache/taskotron +%dir %attr(2775, root, taskotron) %{_localstatedir}/log/taskotron +%dir %attr(2775, root, taskotron) %{_sharedstatedir}/taskotron/artifacts +%dir %attr(2775, root, taskotron) %{_sharedstatedir}/taskotron/images +%dir %attr(2775, root, taskotron) %{_tmppath}/taskotron -%files -n libtaskotron-disposable -%dir %{python2_sitelib}/libtaskotron/ext/disposable -%{python2_sitelib}/libtaskotron/ext/disposable/* +%doc README.rst +%license LICENSE %changelog +* Thu Nov 01 2018 Frantisek Zatloukal - 0.9.2-1 +- New packaging scheme +- Build the library both for Python 2 and Python 3 +- Binaries will use Python 3 by default +- runtask is now in taskotron-runner, which obsoletes libtaskotron-disposable + * Tue Oct 30 2018 Frantisek Zatloukal - 0.9.1-1 - Fedora 29 GA diff --git a/libtaskotron/__init__.py b/libtaskotron/__init__.py index ba05c9c..d77b575 100644 --- a/libtaskotron/__init__.py +++ b/libtaskotron/__init__.py @@ -4,4 +4,4 @@ # See the LICENSE file for more details on Licensing from __future__ import absolute_import -__version__ = '0.9.1' +__version__ = '0.9.2' diff --git a/libtaskotron/taskotron_result.py b/libtaskotron/taskotron_result.py index e7ba63d..f09c780 100644 --- a/libtaskotron/taskotron_result.py +++ b/libtaskotron/taskotron_result.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3 from libtaskotron.check import CheckDetail, export_YAML, import_YAML import argparse diff --git a/setup.py b/setup.py index 6690d81..fdc6a63 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,6 @@ from setuptools import setup, Command from utils import build - class PyTest(Command): user_options = [] def initialize_options(self): @@ -10,7 +9,11 @@ class PyTest(Command): pass def run(self): import subprocess - errno = subprocess.call(['py.test']) + import sys + if (sys.version_info > (3, 0)): + errno = subprocess.call(['pytest-3']) + else: + errno = subprocess.call(['py.test']) raise SystemExit(errno)