From a902eef410feabeacc2831c49bc84a6d30fa0364 Mon Sep 17 00:00:00 2001 From: Randy Barlow Date: Jan 13 2017 17:20:03 +0000 Subject: Apply four patches that have been hotfixed in production. Also, Conditionally depend on python-click or python2-click, since Fedora 24 doesn't have python2-click. --- diff --git a/0000-Reload-builds-and-releases-after-we-commit-the-trans.patch b/0000-Reload-builds-and-releases-after-we-commit-the-trans.patch new file mode 100644 index 0000000..21e66de --- /dev/null +++ b/0000-Reload-builds-and-releases-after-we-commit-the-trans.patch @@ -0,0 +1,35 @@ +From 04d04f31e08ba30aa289e5593f42fec748df9835 Mon Sep 17 00:00:00 2001 +From: Patrick Uiterwijk +Date: Wed, 30 Nov 2016 18:25:33 +0000 +Subject: [PATCH] Reload builds and releases after we commit the transaction + +Signed-off-by: Patrick Uiterwijk +--- + bodhi/server/services/updates.py | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/bodhi/server/services/updates.py b/bodhi/server/services/updates.py +index 5afd03b0..28ac2cef 100644 +--- a/bodhi/server/services/updates.py ++++ b/bodhi/server/services/updates.py +@@ -375,6 +375,17 @@ def new_update(request): + # the builds as signed. + transaction.commit() + ++ # After we commit the transaction, we need to get the builds and releases again, since they ++ # were tied to the previous session that has now been terminated. ++ builds = [] ++ releases = set() ++ for build in data['builds']: ++ # At this moment, we are sure the builds are in the database (that is what the commit ++ # was for actually). ++ build = Build.get(nvr, request.db) ++ builds.append(build) ++ releases.add(build.release) ++ + if data.get('edited'): + + log.info('Editing update: %s' % data['edited']) +-- +2.11.0 + diff --git a/0001-Skip-builds-that-are-not-assigned-to-a-release.patch b/0001-Skip-builds-that-are-not-assigned-to-a-release.patch new file mode 100644 index 0000000..f4fb35d --- /dev/null +++ b/0001-Skip-builds-that-are-not-assigned-to-a-release.patch @@ -0,0 +1,28 @@ +From 0981e62941d827f292b190e4b0e29868a2189bcd Mon Sep 17 00:00:00 2001 +From: Patrick Uiterwijk +Date: Thu, 1 Dec 2016 02:44:56 +0000 +Subject: [PATCH] Skip builds that are not assigned to a release + +Signed-off-by: Patrick Uiterwijk +--- + bodhi/server/consumers/signed.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/bodhi/server/consumers/signed.py b/bodhi/server/consumers/signed.py +index 4868662c..9284fd8d 100644 +--- a/bodhi/server/consumers/signed.py ++++ b/bodhi/server/consumers/signed.py +@@ -64,6 +64,10 @@ class SignedHandler(fedmsg.consumers.FedmsgConsumer): + log.info("Build was not submitted, skipping") + return + ++ if not build.release: ++ log.info('Build is not assigned to release, skipping') ++ return ++ + if build.release.pending_testing_tag != tag: + log.info("Tag is not pending_testing tag, skipping") + return +-- +2.11.0 + diff --git a/0002-Lock-the-buildsystem-while-logging-in.patch b/0002-Lock-the-buildsystem-while-logging-in.patch new file mode 100644 index 0000000..e0f0a3f --- /dev/null +++ b/0002-Lock-the-buildsystem-while-logging-in.patch @@ -0,0 +1,52 @@ +From 2596dc814f05ce7575816e01857b2b1bdcfed4e9 Mon Sep 17 00:00:00 2001 +From: Patrick Uiterwijk +Date: Fri, 2 Dec 2016 18:00:52 +0000 +Subject: [PATCH] Lock the buildsystem while logging in + +Signed-off-by: Patrick Uiterwijk +--- + bodhi/server/buildsys.py | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/bodhi/server/buildsys.py b/bodhi/server/buildsys.py +index fbbcd347..6fbe5f6f 100644 +--- a/bodhi/server/buildsys.py ++++ b/bodhi/server/buildsys.py +@@ -14,6 +14,7 @@ + + import time + import logging ++from threading import Lock + + from os.path import join, expanduser + +@@ -314,18 +315,20 @@ def get_krb_conf(config): + + def get_session(): + """ Get a new buildsystem instance """ +- global _buildsystem +- if not _buildsystem: +- log.warning('No buildsystem configured; assuming testing') +- return DevBuildsys() +- return _buildsystem() ++ global _buildsystem, _buildsystem_login_lock ++ with _buildsystem_login_lock: ++ if not _buildsystem: ++ log.warning('No buildsystem configured; assuming testing') ++ return DevBuildsys() ++ return _buildsystem() + + + def setup_buildsystem(settings): +- global _buildsystem, _koji_hub ++ global _buildsystem, _koji_hub, _buildsystem_login_lock + if _buildsystem: + return + ++ _buildsystem_login_lock = Lock() + _koji_hub = settings.get('koji_hub') + buildsys = settings.get('buildsystem') + +-- +2.11.0 + diff --git a/0003-Set-krb_rdns-to-False.patch b/0003-Set-krb_rdns-to-False.patch new file mode 100644 index 0000000..b1f9f7a --- /dev/null +++ b/0003-Set-krb_rdns-to-False.patch @@ -0,0 +1,26 @@ +From 49354037f7a46796a332821ec6c40e8bf30932fd Mon Sep 17 00:00:00 2001 +From: Patrick Uiterwijk +Date: Fri, 16 Dec 2016 00:53:56 +0000 +Subject: [PATCH] Set krb_rdns to False + +Signed-off-by: Patrick Uiterwijk +--- + bodhi/server/buildsys.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/bodhi/server/buildsys.py b/bodhi/server/buildsys.py +index fbbcd347..e24bd4fb 100644 +--- a/bodhi/server/buildsys.py ++++ b/bodhi/server/buildsys.py +@@ -291,7 +291,7 @@ class DevBuildsys(Buildsystem): + + def koji_login(config): + """ Login to Koji and return the session """ +- koji_client = koji.ClientSession(_koji_hub, {}) ++ koji_client = koji.ClientSession(_koji_hub, {'krb_rdns': False}) + if not koji_client.krb_login(**get_krb_conf(config)): + log.error('Koji krb_login failed') + return koji_client +-- +2.11.0 + diff --git a/bodhi.spec b/bodhi.spec index b2ef3a6..e5040ac 100644 --- a/bodhi.spec +++ b/bodhi.spec @@ -3,7 +3,7 @@ Name: bodhi Version: 2.3.3 -Release: 2%{?dist} +Release: 3%{?dist} BuildArch: noarch License: GPLv2+ @@ -11,6 +11,14 @@ Summary: A modular framework that facilitates publishing software updates Group: Applications/Internet URL: https://github.com/fedora-infra/bodhi Source0: https://github.com/fedora-infra/bodhi/archive/%{version}.tar.gz +# https://github.com/fedora-infra/bodhi/pull/1137 +Patch0: 0000-Reload-builds-and-releases-after-we-commit-the-trans.patch +# https://github.com/fedora-infra/bodhi/pull/1139 +Patch1: 0001-Skip-builds-that-are-not-assigned-to-a-release.patch +# https://github.com/fedora-infra/bodhi/pull/1142 +Patch2: 0002-Lock-the-buildsystem-while-logging-in.patch +# https://github.com/fedora-infra/bodhi/pull/1163 +Patch3: 0003-Set-krb_rdns-to-False.patch # For the tests BuildRequires: python2 @@ -73,7 +81,11 @@ BuildRequires: fedmsg BuildRequires: python-sphinx # For the bodhi-client and push.py +%if 0%{?fedora} >= 26 BuildRequires: python2-click +%else +BuildRequires: python-click +%endif %if 0%{?rhel} <= 7 BuildRequires: python-webob @@ -100,7 +112,12 @@ Group: Applications/Internet Requires: koji yum Requires: python-fedora >= 0.3.5 Requires: python-kitchen -Requires: python2-click +%if 0%{?fedora} >= 26 +Requires: python2-click +%else +Requires: python-click +%endif + Requires: python2-bodhi == %{version}-%{release} @@ -143,7 +160,11 @@ Requires: python-pyramid-mako #Requires: python-pyramid-debugtoolbar Requires: python-pyramid-tm Requires: python-waitress +%if 0%{?fedora} >= 26 Requires: python2-click +%else +Requires: python-click +%endif Requires: python-colander Requires: python-cornice @@ -203,6 +224,11 @@ updates for a software distribution. %prep %setup -q -n bodhi-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 + # Kill some dev deps sed -i '/pyramid_debugtoolbar/d' setup.py sed -i '/pyramid_debugtoolbar/d' development.ini.example @@ -323,6 +349,12 @@ PYTHONPATH=. %{__python2} setup.py nosetests %changelog +* Fri Jan 13 2017 Randy Barlow - 2.3.3-3 +- Apply four patches from git that are currently hotfixed on + bodhi.fedoraproject.org. +- Conditionally depend on python-click or python2-click, since Fedora + 24 doesn't have python2-click. + * Sun Jan 08 2017 Randy Barlow - 2.3.3-2 - Require python2-click instead of python-click (#1411141). - Backport a unit test patch so the tests will pass in 2017.