From 149792c5aaf8dd8e18127070a07ebf7624a9be74 Mon Sep 17 00:00:00 2001 From: Randy Barlow Date: Oct 15 2018 17:43:07 +0000 Subject: Backport some patches for compatibility with click-7.0.0. Signed-off-by: Randy Barlow --- diff --git a/0000-Explicitly-name-the-skopeo-lite-src-dest_creds-param.patch b/0000-Explicitly-name-the-skopeo-lite-src-dest_creds-param.patch new file mode 100644 index 0000000..ad2ade9 --- /dev/null +++ b/0000-Explicitly-name-the-skopeo-lite-src-dest_creds-param.patch @@ -0,0 +1,60 @@ +From 1da1afda045ac7eda3f32fe6c7cc0385c64849d8 Mon Sep 17 00:00:00 2001 +From: Randy Barlow +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 +--- + 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 + diff --git a/0001-Adjust-two-unit-tests-to-work-with-Click-6-and-7.patch b/0001-Adjust-two-unit-tests-to-work-with-Click-6-and-7.patch new file mode 100644 index 0000000..9936e74 --- /dev/null +++ b/0001-Adjust-two-unit-tests-to-work-with-Click-6-and-7.patch @@ -0,0 +1,65 @@ +From 4ea99ff3056abf3dc3f4488609ab33b3de272386 Mon Sep 17 00:00:00 2001 +From: Randy Barlow +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 +--- + 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 + diff --git a/bodhi.spec b/bodhi.spec index c100e26..78f7442 100644 --- a/bodhi.spec +++ b/bodhi.spec @@ -3,7 +3,7 @@ Name: bodhi Version: 3.10.1 -Release: 1%{?dist} +Release: 2%{?dist} BuildArch: noarch License: GPLv2+ @@ -12,6 +12,11 @@ Group: Applications/Internet 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} @@ -447,6 +452,9 @@ virtualenv --python=%{__python3} --system-site-packages --no-pip --never-downloa %changelog +* Mon Oct 15 2018 Randy Barlow - 3.10.1-2 +- Backport some patches for compatibility with click-7.0.0. + * Tue Oct 09 2018 Randy Barlow - 3.10.1-1 - Update to 3.10.1. - https://bodhi.fedoraproject.org/docs/user/release_notes.html#v3-10-1