diff --git a/0001-Remove-Graphql-for-packaging.patch b/0001-Remove-Graphql-for-packaging.patch new file mode 100644 index 0000000..f1a6187 --- /dev/null +++ b/0001-Remove-Graphql-for-packaging.patch @@ -0,0 +1,553 @@ +From f96278906447fe2b3aa15d6fb0a0dc28e6dddf83 Mon Sep 17 00:00:00 2001 +From: Clement Verna +Date: Wed, 18 Nov 2020 21:08:24 +0100 +Subject: [PATCH] Remove Graphql for packaging + +Signed-off-by: Clement Verna + +diff --git a/bodhi/server/graphql_schemas.py b/bodhi/server/graphql_schemas.py +deleted file mode 100644 +index 2acf57f7..00000000 +--- a/bodhi/server/graphql_schemas.py ++++ /dev/null +@@ -1,62 +0,0 @@ +-# Copyright © 2020 Red Hat Inc., and others. +-# +-# This file is part of Bodhi. +-# +-# This program is free software; you can redistribute it and/or +-# modify it under the terms of the GNU General Public License +-# as published by the Free Software Foundation; either version 2 +-# of the License, or (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +-"""Defines schemas related to GraphQL objects.""" +-from graphene import relay, Field, String +-from graphene_sqlalchemy import SQLAlchemyObjectType +- +-from bodhi.server.models import ( +- Release as ReleaseModel, +- Update as UpdateModel, +- BuildrootOverride as BuildrootOverrideModel +-) +- +- +-class Release(SQLAlchemyObjectType): +- """Type object representing a distribution release from bodhi.server.models like Fedora 27.""" +- +- class Meta: +- """Allow to set different options to the class.""" +- +- model = ReleaseModel +- interfaces = (relay.Node, ) +- state = Field(String) +- package_manager = Field(String) +- +- +-class Update(SQLAlchemyObjectType): +- """Type object representing an update from bodhi.server.models.""" +- +- class Meta: +- """Allow to set different options to the class.""" +- +- model = UpdateModel +- interfaces = (relay.Node, ) +- status = Field(String) +- request = Field(String) +- date_approved = Field(String) +- +- +-class BuildrootOverride(SQLAlchemyObjectType): +- """Type object representing an update from bodhi.server.models.""" +- +- class Meta: +- """Allow to set different options to the class.""" +- +- model = BuildrootOverrideModel +- interfaces = (relay.Node, ) +- submitter = Field(String) +diff --git a/bodhi/server/services/graphql.py b/bodhi/server/services/graphql.py +deleted file mode 100644 +index 1d68f320..00000000 +--- a/bodhi/server/services/graphql.py ++++ /dev/null +@@ -1,179 +0,0 @@ +-# Copyright © 2020 Red Hat Inc., and others. +-# +-# This file is part of Bodhi. +-# +-# This program is free software; you can redistribute it and/or +-# modify it under the terms of the GNU General Public License +-# as published by the Free Software Foundation; either version 2 +-# of the License, or (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +-"""Defines API endpoints related to GraphQL objects.""" +-import graphene +-from cornice import Service +-from webob_graphql import serve_graphql_request +- +-from bodhi.server.config import config +-from bodhi.server.models import Build as BuildModel, User as UserModel +-from bodhi.server.graphql_schemas import ( +- Release, +- ReleaseModel, +- Update, +- UpdateModel, +- BuildrootOverride, +- BuildrootOverrideModel +-) +- +-graphql = Service(name='graphql', path='/graphql', description='graphql service') +- +- +-@graphql.get() +-@graphql.post() +-def graphql_get(request): +- """ +- Perform a GET request. +- +- Args: +- request (pyramid.Request): The current request. +- Returns: +- The GraphQL response to the request. +- """ +- context = {'session': request.session} +- return serve_graphql_request( +- request, schema, graphiql_enabled=config.get('graphiql_enabled'), +- context_value=context) +- +- +-class Query(graphene.ObjectType): +- """Allow querying objects.""" +- +- allReleases = graphene.List(Release) +- getReleases = graphene.Field( +- lambda: graphene.List(Release), name=graphene.String(), +- id_prefix=graphene.String(), composed_by_bodhi=graphene.Boolean(), +- state=graphene.String()) +- +- getUpdates = graphene.Field( +- lambda: graphene.List(Update), stable_karma=graphene.Int(), +- stable_days=graphene.Int(), unstable_karma=graphene.Int(), +- status=graphene.String(), request=graphene.String(), +- pushed=graphene.Boolean(), critpath=graphene.Boolean(), +- date_approved=graphene.String(), alias=graphene.String(), +- user_id=graphene.Int(), release_name=graphene.String()) +- +- getBuildrootOverrides = graphene.Field( +- lambda: graphene.List(BuildrootOverride), +- submission_date=graphene.DateTime(), +- expiration_date=graphene.DateTime(), +- build_nvr=graphene.String(), +- submitter_username=graphene.String()) +- +- def resolve_allReleases(self, info): +- """Answer Queries by fetching data from the Schema.""" +- query = Release.get_query(info) # SQLAlchemy query +- return query.all() +- +- def resolve_getReleases(self, info, **args): +- """Answer Release queries with a given argument.""" +- query = Release.get_query(info) +- +- id_prefix = args.get("id_prefix") +- if id_prefix is not None: +- query = query.filter(ReleaseModel.id_prefix == id_prefix) +- +- name = args.get("name") +- if name is not None: +- query = query.filter(ReleaseModel.name == name) +- +- composed_by_bodhi = args.get("composed_by_bodhi") +- if composed_by_bodhi is not None: +- query = query.filter(ReleaseModel.composed_by_bodhi == composed_by_bodhi) +- +- state = args.get("state") +- if state is not None: +- query = query.filter(ReleaseModel.state == state) +- +- return query.all() +- +- def resolve_getUpdates(self, info, **args): +- """Answer Release queries with a given argument.""" +- query = Update.get_query(info) +- +- stable_karma = args.get("stable_karma") +- if stable_karma is not None: +- query = query.filter(UpdateModel.stable_karma == stable_karma) +- +- stable_days = args.get("stable_days") +- if stable_days is not None: +- query = query.filter(UpdateModel.stable_days == stable_days) +- +- unstable_karma = args.get("unstable_karma") +- if unstable_karma is not None: +- query = query.filter(UpdateModel.unstable_karma == unstable_karma) +- +- status = args.get("status") +- if status is not None: +- query = query.filter(UpdateModel.status == status) +- +- request = args.get("request") +- if request is not None: +- query = query.filter(UpdateModel.request == request) +- +- pushed = args.get("pushed") +- if pushed is not None: +- query = query.filter(UpdateModel.pushed == pushed) +- +- critpath = args.get("critpath") +- if critpath is not None: +- query = query.filter(UpdateModel.critpath == critpath) +- +- date_approved = args.get("date_approved") +- if date_approved is not None: +- query = query.filter(UpdateModel.date_approved == date_approved) +- +- alias = args.get("alias") +- if alias is not None: +- query = query.filter(UpdateModel.alias == alias) +- +- user_id = args.get("user_id") +- if user_id is not None: +- query = query.filter(UpdateModel.user_id == user_id) +- +- release_name = args.get("release_name") +- if release_name is not None: +- query = query.join(UpdateModel.release).filter(ReleaseModel.name == release_name) +- +- return query.all() +- +- def resolve_getBuildrootOverrides(self, info, **args): +- """Answer Release queries with a given argument.""" +- query = BuildrootOverride.get_query(info) +- +- submission_date = args.get("submission_date") +- if submission_date is not None: +- query = query.filter(BuildrootOverrideModel.submission_date == submission_date) +- +- expiration_date = args.get("expiration_date") +- if expiration_date is not None: +- query = query.filter(BuildrootOverrideModel.expiration_date == expiration_date) +- +- build_nvr = args.get("build_nvr") +- if build_nvr is not None: +- query = query.join(BuildrootOverrideModel.build).filter(BuildModel.nvr == build_nvr) +- +- submitter_username = args.get("submitter_username") +- if submitter_username is not None: +- query = query.join(BuildrootOverrideModel.submitter).filter( +- UserModel.name == submitter_username) +- +- return query.all() +- +- +-schema = graphene.Schema(query=Query) +diff --git a/bodhi/tests/server/services/test_graphql.py b/bodhi/tests/server/services/test_graphql.py +deleted file mode 100644 +index 3bd9e29d..00000000 +--- a/bodhi/tests/server/services/test_graphql.py ++++ /dev/null +@@ -1,251 +0,0 @@ +-# Copyright © 2020 Red Hat, Inc. and others. +-# +-# This file is part of Bodhi. +-# +-# This program is free software; you can redistribute it and/or +-# modify it under the terms of the GNU General Public License +-# as published by the Free Software Foundation; either version 2 +-# of the License, or (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program; if not, write to the Free Software +-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +-import datetime +- +-from graphene.test import Client +- +-from bodhi.tests.server import base +-from bodhi.server.services.graphql import schema +-from bodhi.server import models +- +- +-class TestGraphQLService(base.BasePyTestCase): +- """This class contains tests for a /graphql endpoint.""" +- def test_get(self): +- """Ensure that a GraphQL response is returned""" +- res = self.app.get('/graphql?query={%0A%20 allReleases{%0A%20%20%20 name%0A%20 }%0A}') +- assert res.body == b'{"data":{"allReleases":[{"name":"F17"}]}}' +- +- def test_allReleases(self): +- """Testing allReleases.""" +- base.BaseTestCaseMixin.create_release(self, version='22') +- client = Client(schema) +- self.db.commit() +- +- executed = client.execute("""{ allReleases{ name }}""") +- assert executed == { +- "data": { +- "allReleases": [{ +- "name": "F17" +- }, { +- "name": "F22" +- }] +- } +- } +- +- def test_enumfields(self): +- """Testing enum fields on releases.""" +- base.BaseTestCaseMixin.create_release(self, version='22') +- client = Client(schema) +- self.db.commit() +- +- executed = client.execute("""{ allReleases{ state packageManager }}""") +- assert executed == { +- 'data': { +- 'allReleases': [{ +- 'packageManager': 'unspecified', +- 'state': 'current' +- }, { +- 'packageManager': 'unspecified', +- 'state': 'current' +- }] +- } +- } +- +- def test_getReleases(self): +- """Testing getReleases query.""" +- base.BaseTestCaseMixin.create_release(self, version='22') +- client = Client(schema) +- self.db.commit() +- +- executed = client.execute("""{ getReleases(idPrefix: "FEDORA"){ name }}""") +- assert executed == { +- "data": { +- "getReleases": [{ +- "name": "F17" +- }, { +- "name": "F22" +- }] +- } +- } +- +- executed = client.execute("""{ getReleases(name: "F17"){ id }}""") +- assert executed == { +- "data": { +- "getReleases": [{ +- "id": "UmVsZWFzZTox" +- }] +- } +- } +- +- executed = client.execute("""{ getReleases(composedByBodhi: true){ name }}""") +- assert executed == { +- "data": { +- "getReleases": [{ +- "name": "F17" +- }, { +- "name": "F22" +- }] +- } +- } +- +- executed = client.execute( +- """{ getReleases(state: "current", composedByBodhi: true){ name }}""") +- assert executed == { +- "data": { +- "getReleases": [{ +- "name": "F17" +- }, { +- "name": "F22" +- }] +- } +- } +- +- def test_getUpdates(self): +- """Testing getUpdates query.""" +- release = base.BaseTestCaseMixin.create_release(self, version='22') +- self.create_update(build_nvrs=['TurboGears-2.1-1.el5'], +- release_name=release.name) +- up2 = self.create_update(build_nvrs=['freetype-2.10.2-1.fc32'], +- release_name=release.name) +- up2.alias = "FEDORA-2020-3223f9ec8b" +- up2.stable_days = 1 +- up2.date_approved = datetime.datetime(2019, 10, 13, 16, 16, 22, 438484) +- self.db.commit() +- client = Client(schema) +- +- executed = client.execute("""{ getUpdates(stableDays: 1, +- dateApproved: "2019-10-13 16:16:22.438484") +- { alias request unstableKarma }}""") +- assert executed == { +- "data": { +- "getUpdates": [{ +- "alias": "FEDORA-2020-3223f9ec8b", +- "request": "testing", +- "unstableKarma": -3 +- }] +- } +- } +- +- executed = client.execute("""{ getUpdates(stableKarma: 3, status: "pending", +- critpath: false, pushed: false, request:"testing"){ stableDays +- userId }}""") +- assert executed == { +- 'data': { +- 'getUpdates': [{ +- 'stableDays': 0, +- 'userId': 1 +- }, { +- 'stableDays': 0, +- 'userId': 1 +- }, { +- 'stableDays': 1, +- 'userId': 1 +- }] +- } +- } +- +- executed = client.execute("""{ getUpdates(stableDays: 1, +- unstableKarma: -3, alias: "FEDORA-2020-3223f9ec8b") +- { dateApproved request }}""") +- assert executed == { +- 'data': { +- 'getUpdates': [{ +- 'dateApproved': "2019-10-13 16:16:22.438484", +- 'request': 'testing' +- }] +- } +- } +- +- executed = client.execute("""{ getUpdates(critpath: false, stableDays: 1, +- userId: 1){ request unstableKarma }}""") +- assert executed == { +- 'data': { +- 'getUpdates': [{ +- 'request': 'testing', +- 'unstableKarma': -3, +- }] +- } +- } +- +- executed = client.execute("""{ getUpdates(releaseName: "F22"){ request }}""") +- assert executed == { +- 'data': { +- 'getUpdates': [{ +- 'request': 'testing', +- }, { +- 'request': 'testing', +- }] +- } +- } +- +- def test_getBuildrootOverrides(self): +- """Testing getBuildOverrides query.""" +- release = models.Release.get('F17') +- +- package = models.RpmPackage(name='just-testing') +- self.db.add(package) +- build = models.RpmBuild(nvr='just-testing-1.0-2.fc17', package=package, release=release) +- self.db.add(build) +- another_user = models.User(name='aUser') +- self.db.add(another_user) +- +- expiration_date = datetime.datetime(2020, 10, 13, 16, 16, 22, 438484) +- submission_date = datetime.datetime(2020, 10, 12, 16, 16, 22, 438484) +- +- override = models.BuildrootOverride(build=build, submitter=another_user, +- notes='Crazy! 😱', +- expiration_date=expiration_date, +- submission_date=submission_date) +- self.db.add(override) +- self.db.flush() +- client = Client(schema) +- self.db.commit() +- +- executed = client.execute("""{ getBuildrootOverrides(buildNvr: "just-testing-1.0-2.fc17") +- { submissionDate expirationDate }}""") +- assert executed == { +- 'data': { +- 'getBuildrootOverrides': [{ +- 'expirationDate': "2020-10-13T16:16:22.438484", +- 'submissionDate': "2020-10-12T16:16:22.438484", +- }] +- } +- } +- +- executed = client.execute("""{ getBuildrootOverrides(submissionDate: "2020-10-12T16:16:22.438484", +- expirationDate: "2020-10-13T16:16:22.438484") +- { notes }}""") +- assert executed == { +- 'data': { +- 'getBuildrootOverrides': [{ +- 'notes': "Crazy! 😱" +- }] +- } +- } +- +- executed = client.execute("""{ getBuildrootOverrides(submitterUsername: "aUser", +- expirationDate: "2020-10-13T16:16:22.438484") +- { notes }}""") +- assert executed == { +- 'data': { +- 'getBuildrootOverrides': [{ +- 'notes': "Crazy! 😱" +- }] +- } +- } +diff --git a/requirements.txt b/requirements.txt +index b66508b5..a7cf46df 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -10,9 +10,6 @@ dogpile.cache + pyasn1-modules # Due to an unfortunate dash in its name, installs break if pyasn1 is installed first + fedora_messaging + feedgen>=0.7.0 +-graphene +-graphene-sqlalchemy +-koji + jinja2 + markdown>=3.0 + prometheus_client +@@ -28,5 +25,4 @@ PyYAML + simplemediawiki + sqlalchemy + waitress +-WebOb-GraphQL + whitenoise +diff --git a/setup.py b/setup.py +index 1cb2f24b..c0269319 100644 +--- a/setup.py ++++ b/setup.py +@@ -111,7 +111,7 @@ client_setup = { + 'keywords': 'fedora', + 'packages': client_pkgs, + 'include_package_data': False, +- 'install_requires': ['click', 'python-fedora >= 0.9.0', 'koji'], ++ 'install_requires': ['click', 'python-fedora >= 0.9.0'], + 'entry_points': ''' + [console_scripts] + bodhi = bodhi.client:cli +-- +2.28.0 + diff --git a/b75af1bc.patch b/b75af1bc.patch deleted file mode 100644 index ee686d4..0000000 --- a/b75af1bc.patch +++ /dev/null @@ -1,70 +0,0 @@ -From b75af1bcdf90e44f4f8906bc3fd07d7f1583da99 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= -Date: Mon, 18 May 2020 15:58:37 +0200 -Subject: [PATCH] Don't use dummy_threading in tests, the module is gone in - Python 3.9 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The suggested usage of `dummy_threading` is: - - try: - import threading - except ImportError: - import dummy_threading as threading - -To support installations without the threading module: - https://docs.python.org/3.6/library/dummy_threading.html - -Installations without the threading module are no longer possible since Python 3.7: - https://docs.python.org/3.7/library/dummy_threading.html - -And hence this module was removed from Python 3.9. - https://bugs.python.org/issue37312 - -In the tests the dummy_thread module was used in a non-traditional way to -prevent the ComposerThread class from spawning new threads. -Instead, we reset the ComposerThread.start() and ComposerThread.join() methods. - -Fixes https://github.com/fedora-infra/bodhi/issues/4007 -Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1814243 - -Signed-off-by: Miro Hrončok ---- - bodhi/tests/server/tasks/test_composer.py | 13 +++++-------- - 1 file changed, 5 insertions(+), 8 deletions(-) - -diff --git a/bodhi/tests/server/tasks/test_composer.py b/bodhi/tests/server/tasks/test_composer.py -index a157e8f1f..f4a51d38b 100644 ---- a/bodhi/tests/server/tasks/test_composer.py -+++ b/bodhi/tests/server/tasks/test_composer.py -@@ -19,7 +19,6 @@ - from urllib.error import HTTPError, URLError - import urllib.parse as urlparse - import datetime --import dummy_threading - import errno - import json - import os -@@ -153,15 +152,13 @@ def setup_method(self, method): - super(TestComposer, self).setup_method(method) - self._new_compose_stage_dir = tempfile.mkdtemp() - -- # Since the ComposerThread is a subclass of Thread and since it is already constructed -- # before we have a chance to alter it, we need to change its superclass to be -- # dummy_threading.Thread so that the test suite doesn't launch real Threads. Threads cannot -+ # We don't want the test suite to launch real Threads. Threads cannot - # use the same database sessions, and that means that changes that threads make will not - # appear in other thread's sessions, which cause a lot of problems in these tests. -- # Mock was not able to make this change since the __bases__ attribute cannot be removed, but -- # we don't really need this to be cleaned up since we don't want any tests launching theads -- # anyway. -- ComposerThread.__bases__ = (dummy_threading.Thread,) -+ # We don't really need this to be cleaned up since we don't want any tests launching threads -+ # anyway, so we don't bother with mock. -+ ComposerThread.start = lambda self: self.run() -+ ComposerThread.join = lambda self, timeout=None: None - test_config = base.original_config.copy() - test_config['compose_stage_dir'] = self._new_compose_stage_dir - test_config['compose_dir'] = os.path.join(self._new_compose_stage_dir, 'compose') diff --git a/bodhi.spec b/bodhi.spec index a3b804a..42ef4a8 100644 --- a/bodhi.spec +++ b/bodhi.spec @@ -11,19 +11,18 @@ %global cov_fail_under 90 Name: bodhi -Version: 5.2.2 -Release: 4%{?dist} -#Release: 0.beta.1.%{commit_short}%{?dist} + +Version: 5.6.1 +Release: 1%{?dist} +#Release: 0.beta.1.%%{commit_short}%%{?dist} BuildArch: noarch License: GPLv2+ Summary: A modular framework that facilitates publishing software updates URL: https://github.com/fedora-infra/bodhi Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz -#Source0: %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz - -# Python 3.9 compatibility -Patch1: %{url}/commit/b75af1bc.patch +#Source0: %%{url}/archive/%%{commit}/%%{name}-%%{commit}.tar.gz +Patch0: 0001-Remove-Graphql-for-packaging.patch BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -325,6 +324,12 @@ install -pm0644 docs/_build/man/*.1 %{buildroot}%{_mandir}/man1/ %changelog + +* Mon Nov 30 2020 Clément Verna - 5.6.1-1 +- Update to 5.6.1 + https://github.com/fedora-infra/bodhi/releases/tag/5.6.1 +- Remove Graphql from the server. + * Sat Aug 01 2020 Fedora Release Engineering - 5.2.2-4 - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/sources b/sources index 77d886e..718ba38 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (bodhi-5.2.2.tar.gz) = 13ae40463898bf41e5452174d481018f2ac8284631ad5a8f9972bdaafcc9677d7fcecc9d114a5bbaa3d07cc215a4abbe0e68f8da7f33298b8afff9adf9aa0e49 +SHA512 (bodhi-5.6.1.tar.gz) = ca55a622911b3ab4d12ae71245415e2b65e515c1ccc3f96f11908b88fff2ea0a74961da8a42e3c2cb9dcfc4fa5eaa2f99858c1f8cbe45374ad10b527725a3423