#422 Provide both python2 and python3 libs
Merged 5 years ago by frantisekz. Opened 5 years ago by frantisekz.

file modified
+158 -110
@@ -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 @@ 

  

  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 @@ 

  # 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 @@ 

  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 <fzatlouk@redhat.com> - 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 <fzatlouk@redhat.com> - 0.9.1-1

  - Fedora 29 GA

  

file modified
+1 -1
@@ -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'

@@ -1,4 +1,4 @@ 

- #!/usr/bin/env python

+ #!/usr/bin/python3

  

  from libtaskotron.check import CheckDetail, export_YAML, import_YAML

  import argparse

file modified
+5 -2
@@ -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 @@ 

          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)

  

  

Taskotron now consists of three packages:
taskotron-runner (runtask + disposable client deps)
python2-libtaskotron
* python3-libtaskotron

Upgrade Path should work just fine, testing builds are available here: https://copr.fedorainfracloud.org/coprs/frantisekz/taskotron-stack-python3/

Me no understand :D I guess this will be up for @kparal to tackle...

Metadata Update from @kparal:
- Request assigned

5 years ago

rebased onto 8f03305

5 years ago

rebased onto 64076dc

5 years ago

Please update description and summary for all packages to reflect the new state.

The Requires and BuildRequires lines used to be sorted by alphabet (except for if-else-endif blocks where it made sense to group some of those together) for easier searching. Please make them sorted again.

Let's say "runtask and taskotron_result" here to make it clearer that the intention is to keep both, thanks.

Edit: Thinking more about this, why is it even needed? All old libtaskotron packages are obsoleted by taskotron_runner. So people will end up with taskotron_runner anyway, which already requires python2-libtaskotron. Why do we need this reverse dependency?

That doesn't seem right. The package has been replaced. Was something else supposed to be here?

I guess readme and license should be part of all subpackages. Previously it was just in libtaskotron-core, but that was a basic requirement of everything else, so it was also always installed. You can check some guidelines for this, I'd simply include it everywhere.

Could you make the directories and files definitions less scattered around? Some of them are at the top, some of them are down here. Put them into one place and make them sorted, please.

You can be more specific, like "Build the library for both python2 and python3, rename the subpackages. Put runtask into taskotron-runner and succeed libtaskotron-disposable with it. ..." or something like that.

rebased onto f6bf3cd

5 years ago

Okay, I've force pushed the update.

All your feedback should be addressed, thanks!
I've left some Requires/BuildRequires unsorted - the ones that are inside if fedora > xy .

Also, I've found out and fixed an issue with Python 3 tests - running just:

%{__python3} setup.py test

is not enough to actually run it with Python 3 (it runs with Python 2). I've made changes to setup.py, let me know if you like the way I've worked around the issue.

If it's okay, I'll apply the same fix to all our Py2/3 projects (I've looked into testcloud and it's affected the same way).

rebased onto b6c55cd

5 years ago

1 new commit added

  • Little bit of cleaning here and there
5 years ago

rebased onto a379306

5 years ago

1 new commit added

  • fix indentation
5 years ago

ACK. Let's hope for the best.

4 new commits added

  • Bump to 0.9.2 Because of setup.py changes
  • Finish rebasing on top of latest develop
  • Little bit of cleaning here and there
  • Provide both python2 and python3 libs
5 years ago

rebased onto 4a4de68

5 years ago

rebased onto d48d9ef

5 years ago

Commit 3db2754 fixes this pull-request

Pull-Request has been merged by frantisekz

5 years ago