#5 Upgrade to 3.11 and switch bodhi-server to python 3
Merged 3 years ago by bowlofeggs. Opened 3 years ago by bowlofeggs.
rpms/ bowlofeggs/bodhi 3.11  into  master

@@ -1,60 +0,0 @@ 

- From 1da1afda045ac7eda3f32fe6c7cc0385c64849d8 Mon Sep 17 00:00:00 2001

- From: Randy Barlow <randy@electronsweatshop.com>

- Date: Wed, 26 Sep 2018 19:42:53 -0400

- Subject: [PATCH 1/2] Explicitly name the skopeo-lite src/dest_creds

-  parameters.

- 

- The bodhi-skopeo-lite copy command accepts the source and

- destination credentials via two different long-form (i.e., --)

- flags. Click 6.0 named the resulting parameter by the second name,

- and Click 7.0 names them by the first. This commit names the

- parameter that click should use explicitly so that both flags can

- work with both Click 6 and 7.

- 

- re #2621

- 

- Signed-off-by: Randy Barlow <randy@electronsweatshop.com>

- ---

-  bodhi/server/scripts/skopeo_lite.py | 11 ++++++-----

-  1 file changed, 6 insertions(+), 5 deletions(-)

- 

- diff --git a/bodhi/server/scripts/skopeo_lite.py b/bodhi/server/scripts/skopeo_lite.py

- index df0db013..0e752512 100644

- --- a/bodhi/server/scripts/skopeo_lite.py

- +++ b/bodhi/server/scripts/skopeo_lite.py

- @@ -738,7 +738,7 @@ class Copier(object):

-  

-  

-  @main.command()

- -@click.option('--src-creds', '--screds', metavar='USERNAME[:PASSWORD]',

- +@click.option('--src-creds', '--screds', 'src_creds', metavar='USERNAME[:PASSWORD]',

-                help='Use USERNAME[:PASSWORD] for accessing the source registry')

-  @click.option('--src-tls-verify', type=bool, default=True,

-                help=('require HTTPS and verify certificates when talking to the '

- @@ -746,7 +746,7 @@ class Copier(object):

-  @click.option('--src-cert-dir', metavar='PATH',

-                help=('use certificates at PATH (*.crt, *.cert, *.key) to connect to the '

-                      'source registry'))

- -@click.option('--dest-creds', '--dcreds', metavar='USERNAME[:PASSWORD]',

- +@click.option('--dest-creds', '--dcreds', 'dest_creds', metavar='USERNAME[:PASSWORD]',

-                help='Use USERNAME[:PASSWORD] for accessing the destination registry')

-  @click.option('--dest-tls-verify', type=bool, default=True,

-                help=('require HTTPS and verify certificates when talking to the '

- @@ -756,10 +756,11 @@ class Copier(object):

-                      'destination registry'))

-  @click.argument('src', metavar='SOURCE-IMAGE-NAME')

-  @click.argument('dest', metavar='DEST-IMAGE-NAME')

- -def copy(src, dest, screds, src_tls_verify, src_cert_dir, dcreds, dest_tls_verify, dest_cert_dir):

- +def copy(src, dest, src_creds, src_tls_verify, src_cert_dir, dest_creds, dest_tls_verify,

- +         dest_cert_dir):

-      """Copy an image from one location to another."""

- -    src = parse_spec(src, screds, src_tls_verify, src_cert_dir)

- -    dest = parse_spec(dest, dcreds, dest_tls_verify, dest_cert_dir)

- +    src = parse_spec(src, src_creds, src_tls_verify, src_cert_dir)

- +    dest = parse_spec(dest, dest_creds, dest_tls_verify, dest_cert_dir)

-  

-      if src.registry != dest.registry:

-          tempdir = tempfile.mkdtemp()

- -- 

- 2.19.1

- 

@@ -1,65 +0,0 @@ 

- From 4ea99ff3056abf3dc3f4488609ab33b3de272386 Mon Sep 17 00:00:00 2001

- From: Randy Barlow <randy@electronsweatshop.com>

- Date: Wed, 26 Sep 2018 19:45:51 -0400

- Subject: [PATCH 2/2] Adjust two unit tests to work with Click 6 and 7.

- 

- Click 6 uses lowercase letters in an error message in a spot that

- Click 7 uses uppercase letters. This commit adjusts the tests based

- on the detected Click version.

- 

- fixes #2621

- 

- Signed-off-by: Randy Barlow <randy@electronsweatshop.com>

- ---

-  bodhi/tests/client/test___init__.py | 17 +++++++++++++++--

-  1 file changed, 15 insertions(+), 2 deletions(-)

- 

- diff --git a/bodhi/tests/client/test___init__.py b/bodhi/tests/client/test___init__.py

- index 37cd98da..14c44b46 100644

- --- a/bodhi/tests/client/test___init__.py

- +++ b/bodhi/tests/client/test___init__.py

- @@ -25,6 +25,7 @@ import unittest

-  import copy

-  

-  from click import testing

- +import click

-  import fedora.client

-  import mock

-  import munch

- @@ -1399,9 +1400,15 @@ class TestEdit(unittest.TestCase):

-                            '--password', 's3kr3t', '--notes', 'this is an edited note',

-                            '--url', 'http://localhost:6543'])

-          self.assertEqual(result.exit_code, 2)

- +        # Click 7.0 capitalizes UPDATE, and < 7 does not.

- +        if [int(n) for n in click.__version__.split('.')] < [7, 0]:

- +            label = 'update'

- +        else:

- +            label = 'UPDATE'

-          expected = u'Usage: edit [OPTIONS] UPDATE\n\n' \

- -                   u'Error: Invalid value for "update": ' \

- +                   u'Error: Invalid value for "{}": ' \

-                     u'Please provide an Update ID or an Update Title\n'

- +        expected = expected.format(label)

-  

-          self.assertEqual(result.output, expected)

-  

- @@ -1417,9 +1424,15 @@ class TestEdit(unittest.TestCase):

-                            '--password', 's3kr3t', '--notes', 'this is an edited note',

-                            '--url', 'http://localhost:6543'])

-          self.assertEqual(result.exit_code, 2)

- +        # Click 7.0 capitalizes UPDATE, and < 7 does not.

- +        if [int(n) for n in click.__version__.split('.')] < [7, 0]:

- +            label = 'update'

- +        else:

- +            label = 'UPDATE'

-          expected = u'Usage: edit [OPTIONS] UPDATE\n\n' \

- -                   u'Error: Invalid value for "update": ' \

- +                   u'Error: Invalid value for "{}": ' \

-                     u'Please provide an Update ID or an Update Title\n'

- +        expected = expected.format(label)

-  

-          self.assertEqual(result.output, expected)

-  

- -- 

- 2.19.1

- 

file modified
+71 -114
@@ -2,8 +2,8 @@ 

  %global bashcomproot    %(dirname %{bashcompdir} 2>/dev/null)

  

  Name:           bodhi

- Version:        3.10.1

- Release:        2%{?dist}

+ Version:        3.11.0

+ Release:        1%{?dist}

  BuildArch:      noarch

  

  License:        GPLv2+
@@ -12,44 +12,13 @@ 

  URL:            https://github.com/fedora-infra/bodhi

  Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz

  

- # Patch 0 and 1 both come from https://github.com/fedora-infra/bodhi/pull/2620 and correct Bodhi to

- # work with click >= 7.0.0.

- Patch0:         0000-Explicitly-name-the-skopeo-lite-src-dest_creds-param.patch

- Patch1:         0001-Adjust-two-unit-tests-to-work-with-Click-6-and-7.patch

- 

- BuildRequires: %{py2_dist alembic}

- BuildRequires: %{py2_dist arrow}

- BuildRequires: %{py2_dist bleach}

  BuildRequires: %{py2_dist click}

- BuildRequires: %{py2_dist colander}

- BuildRequires: %{py2_dist cornice_sphinx} >= 0.3

- BuildRequires: %{py2_dist cornice} >= 3.1.0

- BuildRequires: %{py2_dist cryptography}

- BuildRequires: %{py2_dist fedmsg}

- BuildRequires: %{py2_dist feedgen}

- BuildRequires: %{py2_dist flake8}

  BuildRequires: %{py2_dist iniparse}

- BuildRequires: %{py2_dist jinja2}

- BuildRequires: %{py2_dist kitchen}

- BuildRequires: %{py2_dist markdown}

  BuildRequires: %{py2_dist mock}

- BuildRequires: %{py2_dist pylibravatar}

- BuildRequires: %{py2_dist pyramid-fas-openid}

- BuildRequires: %{py2_dist pyramid-mako}

- BuildRequires: %{py2_dist pyramid-tm}

- BuildRequires: %{py2_dist pyramid}

+ BuildRequires: %{py2_dist munch}

  BuildRequires: %{py2_dist pytest-cov}

  BuildRequires: %{py2_dist pytest}

- BuildRequires: %{py2_dist python-bugzilla}

- BuildRequires: %{py2_dist python-fedora}

- BuildRequires: %{py2_dist python-openid}

- BuildRequires: %{py2_dist pyyaml}

- BuildRequires: %{py2_dist responses}

- BuildRequires: %{py2_dist simplemediawiki}

- BuildRequires: %{py2_dist sphinx}

- BuildRequires: %{py2_dist sqlalchemy_schemadisplay}

- BuildRequires: %{py2_dist sqlalchemy}

- BuildRequires: %{py2_dist webtest}

+ BuildRequires: %{py2_dist python-fedora} >= 0.9

  BuildRequires: %{py3_dist alembic}

  BuildRequires: %{py3_dist arrow}

  BuildRequires: %{py3_dist bleach}
@@ -69,7 +38,6 @@ 

  BuildRequires: %{py3_dist pylibravatar}

  BuildRequires: %{py3_dist pyramid-fas-openid}

  BuildRequires: %{py3_dist pyramid-mako}

- BuildRequires: %{py3_dist pyramid-tm}

  BuildRequires: %{py3_dist pyramid}

  BuildRequires: %{py3_dist pytest-cov}

  BuildRequires: %{py3_dist pytest}
@@ -80,20 +48,14 @@ 

  BuildRequires: %{py3_dist simplemediawiki}

  BuildRequires: %{py3_dist sphinx}

  BuildRequires: %{py3_dist sqlalchemy}

+ BuildRequires: %{py3_dist sqlalchemy_schemadisplay}

  BuildRequires: %{py3_dist webtest}

  BuildRequires: /usr/bin/virtualenv

- BuildRequires: koji

  BuildRequires: liberation-mono-fonts

- BuildRequires: packagedb-cli

  BuildRequires: pkgconfig(bash-completion)

  BuildRequires: pungi >= 4.1.20

- BuildRequires: python2-createrepo_c

  BuildRequires: python2-devel

- BuildRequires: python2-dnf

- BuildRequires: python2-dogpile-cache

  BuildRequires: python2-koji

- BuildRequires: python2-librepo

- BuildRequires: python2-pillow

  BuildRequires: python3-createrepo_c

  BuildRequires: python3-devel

  BuildRequires: python3-dnf
@@ -127,11 +89,11 @@ 

  %package composer

  Summary: Bodhi composer backend

  

- Requires: %{py2_dist jinja2}

+ Requires: %{py3_dist jinja2}

  Requires: bodhi-server == %{version}-%{release}

  Requires: pungi >= 4.1.20

- Requires: python2-createrepo_c

- Requires: python2-hawkey

+ Requires: python3-createrepo_c

+ Requires: python3-hawkey

  Requires: skopeo

  

  
@@ -201,7 +163,7 @@ 

  Requires: %{py3_dist kitchen}

  Requires: %{py3_dist python-fedora} >= 0.9

  Requires: %{py3_dist six}

- Requires: koji

+ Requires: /usr/bin/koji

  Requires: python3-bodhi == %{version}-%{release}

  Requires: python3-dnf

  Requires: python3-koji
@@ -217,43 +179,40 @@ 

  Summary: A modular framework that facilitates publishing software updates

  Group: Applications/Internet

  

- Requires: %{py2_dist alembic}

- Requires: %{py2_dist arrow}

- Requires: %{py2_dist bleach}

- Requires: %{py2_dist click}

- Requires: %{py2_dist colander}

- Requires: %{py2_dist cornice} >= 3.1.0

- Requires: %{py2_dist cryptography}

- Requires: %{py2_dist fedmsg}

- Requires: %{py2_dist feedgen}

- Requires: %{py2_dist kitchen}

- Requires: %{py2_dist markdown}

- Requires: %{py2_dist psycopg2}

- Requires: %{py2_dist pylibravatar}

- Requires: %{py2_dist pyramid-fas-openid}

- Requires: %{py2_dist pyramid-mako}

- Requires: %{py2_dist pyramid-tm}

- Requires: %{py2_dist pyramid}

- Requires: %{py2_dist python-bugzilla}

- Requires: %{py2_dist python-fedora}

- Requires: %{py2_dist python-openid}

- Requires: %{py2_dist simplemediawiki}

- Requires: %{py2_dist six}

- Requires: %{py2_dist sqlalchemy}

- Requires: %{py2_dist waitress}

- Requires: python2-bodhi-client == %{version}-%{release}

- Requires: fedmsg

- Requires: fedmsg-base

+ Requires: %{py3_dist alembic}

+ Requires: %{py3_dist arrow}

+ Requires: %{py3_dist bleach}

+ Requires: %{py3_dist click}

+ Requires: %{py3_dist colander}

+ Requires: %{py3_dist cornice} >= 3.1.0

+ Requires: %{py3_dist cryptography}

+ Requires: %{py3_dist fedmsg}

+ Requires: %{py3_dist feedgen}

+ Requires: %{py3_dist jinja2}

+ Requires: %{py3_dist kitchen}

+ Requires: %{py3_dist markdown}

+ Requires: %{py3_dist psycopg2}

+ Requires: %{py3_dist pylibravatar}

+ Requires: %{py3_dist pyramid-fas-openid}

+ Requires: %{py3_dist pyramid-mako}

+ Requires: %{py3_dist pyramid}

+ Requires: %{py3_dist python-bugzilla}

+ Requires: %{py3_dist python-fedora}

+ Requires: %{py3_dist python3-openid}

+ Requires: %{py3_dist simplemediawiki}

+ Requires: %{py3_dist six}

+ Requires: %{py3_dist sqlalchemy}

+ Requires: %{py3_dist waitress}

+ Requires: python3-bodhi-client == %{version}-%{release}

  Requires: git

  Requires: httpd

  Requires: intltool

  Requires: liberation-mono-fonts

- Requires: mod_wsgi

- Requires: packagedb-cli

- Requires: python2-dogpile-cache

- Requires: python2-koji

- Requires: python2-librepo

- Requires: python2-pillow

+ Requires: python3-dogpile-cache

+ Requires: python3-koji

+ Requires: python3-librepo

+ Requires: python3-mod_wsgi

+ Requires: python3-pillow

  

  Provides:  bundled(aajohan-comfortaa-fonts)

  Provides:  bundled(abattis-cantarell-fonts)
@@ -295,7 +254,12 @@ 

  

  

  %build

+ # We don't want the Python 2 build to see the server requirements, and this is an easy way to do

+ # that.

+ mv requirements.txt py3-requirements.txt

+ touch requirements.txt

  %py2_build

+ mv py3-requirements.txt requirements.txt

  %py3_build

  

  make %{?_smp_mflags} -C docs html
@@ -303,17 +267,11 @@ 

  

  

  %install

- # We want the /usr/bin/bodhi CLI to be Python 3 now, but we don't want the server CLIs to be Python

- # 3 yet. An easy way to do this is to install Python 3 Bodhi first, save the /usr/bin/bodhi it

- # generates, then do the Python 2 install (to overwrite the common files). Afterwards, we'll move

- # the Python 3 /usr/bin/bodhi back into place.

- %py3_install

- # We aren't ready to support Bodhi server on Python 3 yet, so let's just nuke it for now.

- rm -rf %{buildroot}/usr/lib/python%{python3_version}/site-packages/bodhi/server/

- rm -rf %{buildroot}/usr/lib/python%{python3_version}/site-packages/bodhi_server-*.egg-info

- # Let's save /usr/bin/bodhi from being overwritten, since we want it to be the Python 3 version.

- cp %{buildroot}/usr/bin/bodhi bodhi-py3

  %py2_install

+ # Let's remove all the server stuff since we don't ship Python 2 version of the server anymore.

+ rm -rf %{buildroot}/%{python2_sitelib}/%{name}_server-%{version}-py%{python2_version}.egg-info

+ rm -rf %{buildroot}/%{python2_sitelib}/%{name}/server

+ %py3_install

  

  %{__mkdir_p} %{buildroot}/var/lib/bodhi

  %{__mkdir_p} %{buildroot}/var/cache/bodhi
@@ -335,34 +293,23 @@ 

  install -d %{buildroot}%{_mandir}/man1

  install -pm0644 docs/_build/man/*.1 %{buildroot}%{_mandir}/man1/

  

- if [ ! -e %{buildroot}%{python2_sitelib}/%{name}/server/static/bootstrap ]; then

-     # setuptools on EL 7 does not install bootstrap, so we need to symlink it

-     ln -s ./bootstrap-3.1.1-fedora \

-         %{buildroot}%{python2_sitelib}/%{name}/server/static/bootstrap

- fi;

- 

- # Restore the Python 3 version of /usr/bin/bodhi.

- mv bodhi-py3 %{buildroot}/usr/bin/bodhi

- 

  

  %check

- # setuptools on EL 7 doesn't install bootstrap. This test ensures that bootstrap is present.

- if [ ! -e %{buildroot}%{python2_sitelib}/%{name}/server/static/bootstrap ]; then

-     echo "%{buildroot}%{python2_sitelib}/%{name}/server/static/bootstrap is missing, failing!"

-     /usr/bin/false

- fi;

- 

  # The tests need bodhi to be installed to pass. Let's build a virtualenv so we can install bodhi

  # there.

  virtualenv --python=%{__python2} --system-site-packages --no-pip --never-download .test-virtualenv-2

  virtualenv --python=%{__python3} --system-site-packages --no-pip --never-download .test-virtualenv-3

  

- .test-virtualenv-2/bin/python2 setup.py develop

- .test-virtualenv-2/bin/python2 /usr/bin/py.test-2

- 

  .test-virtualenv-3/bin/python3 setup.py develop

  .test-virtualenv-3/bin/python3 /usr/bin/py.test-3

  

+ # We don't support the server on Python 2, so we can kill its tests.

+ rm -rf bodhi/tests/server

+ # Since we just killed most of the tests, coverage will fail, so let's just not configure it to be

+ # required.

+ rm .coveragerc

+ .test-virtualenv-2/bin/python2 /usr/bin/py.test-2

+ 

  

  %pre server

  %{_sbindir}/groupadd -r %{name} &>/dev/null || :
@@ -381,8 +328,11 @@ 

  %files composer

  %license COPYING

  %doc README.rst

- %{python2_sitelib}/%{name}/server/consumers/masher.py*

- %{python2_sitelib}/%{name}/server/metadata.py*

+ %{python3_sitelib}/%{name}/server/consumers/masher.py

+ # The __pycache__ folder itself is owned by bodhi-server.

+ %{python3_sitelib}/%{name}/server/consumers/__pycache__/masher.*

+ %{python3_sitelib}/%{name}/server/metadata.py

+ %{python3_sitelib}/%{name}/server/__pycache__/metadata.*

  

  

  %files docs
@@ -432,6 +382,7 @@ 

  %{_bindir}/bodhi-manage-releases

  %{_bindir}/bodhi-monitor-composes

  %{_bindir}/bodhi-push

+ %{_bindir}/bodhi-sar

  %{_bindir}/bodhi-skopeo-lite

  %{_bindir}/bodhi-untag-branched

  %{_bindir}/initialize_bodhi_db
@@ -439,19 +390,25 @@ 

  %config(noreplace) %{_sysconfdir}/httpd/conf.d/bodhi.conf

  %config(noreplace) %{_sysconfdir}/fedmsg.d/*

  %dir %{_sysconfdir}/bodhi/

- %{python2_sitelib}/%{name}/server

- %{python2_sitelib}/%{name}_server-%{version}-py%{python2_version}.egg-info

+ %{python3_sitelib}/%{name}/server

+ %{python3_sitelib}/%{name}_server-%{version}-py%{python3_version}.egg-info

  %{_mandir}/man1/bodhi-*.1*

  %{_mandir}/man1/initialize_bodhi_db.1*

  %attr(-,bodhi,root) %{_datadir}/%{name}

  %attr(-,bodhi,bodhi) %config(noreplace) %{_sysconfdir}/bodhi/*

  %attr(0775,bodhi,bodhi) %{_localstatedir}/cache/bodhi

  # These excluded files are in the bodhi-consumers package so don't include them here.

- %exclude %{python2_sitelib}/%{name}/server/consumers/masher.py*

- %exclude %{python2_sitelib}/%{name}/server/metadata.py*

+ %exclude %{python3_sitelib}/%{name}/server/consumers/masher.py

+ %exclude %{python3_sitelib}/%{name}/server/consumers/__pycache__/masher.*

+ %exclude %{python3_sitelib}/%{name}/server/metadata.py

+ %exclude %{python3_sitelib}/%{name}/server/__pycache__/metadata.*

  

  

  %changelog

+ * Fri Nov 16 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.11.0-1

+ - Update to 3.11.0.

+ - Switch bodhi-server to use Python 3 (#1631858).

+ 

  * Mon Oct 15 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.10.1-2

  - Backport some patches for compatibility with click-7.0.0.

  

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (bodhi-3.10.1.tar.gz) = 9795834a9a9da62339bce3479e6ceba423f9a946a7c8f11366041e047329a558c1053ff7effd558a4562167d1d06247a90f50fe030d603db7ccd2e9e8a7ee222

+ SHA512 (bodhi-3.11.0.tar.gz) = 2475771fac8a26b7fbb4675803b309c99925aa2c33d2f6cf6932475d4c855fec4c8f5d8a72258ecf1e6bbab570d0eaa4a35e7a07918a4faaa7a8ad6cf3d25eec

This PR replaces https://src.fedoraproject.org/rpms/bodhi/pull-request/4 which was mistakenly made from a branch on the origin repository and would not allow force pushes for corrections.

2 new commits added

  • Switch bodhi-server to use Python 3 (#1631858).
  • Upgrade to 3.11.0.
3 years ago

Pull-Request has been merged by bowlofeggs

3 years ago