public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/fedpkg] 1.48-1: Merge branch 'master' into epel7
@ 2026-08-10 21:45
0 siblings, 0 replies; only message in thread
From: @ 2026-08-10 21:45 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/fedpkg
Branch : 1.48-1
Commit : 116eae6a6a3fdaf3c389949baa0d4b9e46a1e1cf
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2020-05-18T12:19:29+00:00
Stats : +189/-0 in 1 file(s)
URL : https://src.fedoraproject.org/rpms/fedpkg/c/116eae6a6a3fdaf3c389949baa0d4b9e46a1e1cf?branch=1.48-1
Log:
Merge branch 'master' into epel7
---
diff --git a/0001-fedpkg-request-use-pdc-active-releases.patch b/0001-fedpkg-request-use-pdc-active-releases.patch
new file mode 100644
index 0000000..39b6efb
--- /dev/null
+++ b/0001-fedpkg-request-use-pdc-active-releases.patch
@@ -0,0 +1,189 @@
+From 00aed529cf22796fdae0d23f844221df640cc7c2 Mon Sep 17 00:00:00 2001
+From: mprahl <mprahl@redhat.com>
+Date: Feb 23 2018 03:01:35 +0000
+Subject: Use PDC instead of Bodhi to get the active release branches
+
+
+Fixes #187
+
+Signed-off-by: mprahl <mprahl@redhat.com>
+
+---
+
+diff --git a/fedpkg/cli.py b/fedpkg/cli.py
+index a203b91..e8ff6be 100644
+--- a/fedpkg/cli.py
++++ b/fedpkg/cli.py
+@@ -462,7 +462,7 @@ suggest_reboot=False
+ raise rpkgError('You must specify a branch if you are not in '
+ 'a git repository')
+
+- bodhi_url = config.get('{0}.bodhi'.format(name), 'url')
++ pdc_url = config.get('{0}.pdc'.format(name), 'url')
+ if branch:
+ if is_epel(branch):
+ assert_valid_epel_package(module_name, branch)
+@@ -474,7 +474,7 @@ suggest_reboot=False
+ 'Only characters, numbers, periods, dashes, '
+ 'underscores, and pluses are allowed in module branch '
+ 'names')
+- release_branches = get_release_branches(bodhi_url)
++ release_branches = get_release_branches(pdc_url)
+ if branch in release_branches:
+ if service_levels:
+ raise rpkgError(
+@@ -489,14 +489,13 @@ suggest_reboot=False
+
+ # If service levels were provided, verify them
+ if service_levels:
+- pdc_url = config.get('{0}.pdc'.format(name), 'url')
+ sl_dict = sl_list_to_dict(service_levels)
+ verify_sls(pdc_url, sl_dict)
+
+ pagure_url = config.get('{0}.pagure'.format(name), 'url')
+ pagure_token = get_pagure_token(config, name)
+ if all_releases:
+- release_branches = get_release_branches(bodhi_url)
++ release_branches = get_release_branches(pdc_url)
+ branches = [b for b in release_branches
+ if re.match(r'^(f\d+)$', b)]
+ else:
+diff --git a/fedpkg/utils.py b/fedpkg/utils.py
+index d241308..b3d704c 100644
+--- a/fedpkg/utils.py
++++ b/fedpkg/utils.py
+@@ -18,7 +18,6 @@ from six.moves.urllib.parse import urlencode
+ from six.moves.configparser import NoSectionError, NoOptionError
+ import requests
+ from requests.exceptions import ConnectionError
+-from fedora.client.bodhi import Bodhi2Client
+ from pyrpkg import rpkgError
+
+
+@@ -97,26 +96,55 @@ def new_pagure_issue(url, token, title, body):
+ url.rstrip('/'), rv.json()['issue']['id'])
+
+
+-def get_release_branches(bodhi_url):
++def get_release_branches(url):
+ """
+- Get the active Fedora release branches from Bodhi
+- :param bodhi_url: a string of the URL to Bodhi
++ Get the active Fedora release branches from PDC
++ :param url: a string of the URL to PDC
+ :return: a set containing the active Fedora release branches
+ """
+- bodhi = Bodhi2Client(bodhi_url)
+ branches = set()
+- page = 1
++ api_url = '{0}/rest_api/v1/product-versions/'.format(url.rstrip('/'))
++ query_args = {
++ 'fields': ['short', 'version'],
++ 'active': True
++ }
+ while True:
+- rv = bodhi.send_request('releases', auth=False, params={'page': page})
+- for release in rv['releases']:
+- if release['state'] == 'current':
+- branches.add(release['branch'])
+- if page < rv['pages']:
+- page += 1
+- else:
+- break
++ try:
++ rv = requests.get(api_url, params=query_args, timeout=60)
++ except ConnectionError as error:
++ error_msg = ('The connection to PDC failed while trying to get '
++ 'the active release branches. The error was: {0}'
++ .format(str(error)))
++ raise rpkgError(error_msg)
+
+- return branches
++ if not rv.ok:
++ base_error_msg = ('The following error occurred while trying to '
++ 'get the active release branches in PDC: {0}')
++ raise rpkgError(base_error_msg.format(rv.text))
++
++ rv_json = rv.json()
++ for product_version in rv_json['results']:
++ # If the version is not a digit we can ignore it (e.g. rawhide)
++ if not product_version['version'].isdigit():
++ continue
++
++ if product_version['short'] == 'epel':
++ prefix = 'epel'
++ if product_version['version'] == '6':
++ prefix = 'el'
++ branches.add('{0}{1}'.format(
++ prefix, product_version['version']))
++ elif product_version['short'] == 'fedora':
++ branches.add('f{0}'.format(product_version['version']))
++
++ if rv_json['next']:
++ # Clear the query_args because they are baked into the "next" URL
++ query_args = {}
++ api_url = rv_json['next']
++ else:
++ # We've gone through every page, so we can return the found
++ # branches
++ return branches
+
+
+ def sl_list_to_dict(sls):
+diff --git a/test/test_utils.py b/test/test_utils.py
+index cff22bd..7ca395f 100644
+--- a/test/test_utils.py
++++ b/test/test_utils.py
+@@ -115,29 +115,29 @@ class TestUtils(CliTestCase):
+ assert str(e) == ('The SL "{0}" must expire on June 1st or '
+ 'December 1st'.format(eol))
+
+- @patch('fedpkg.utils.Bodhi2Client')
+- def test_get_release_branches(self, mock_bodhi):
++ @patch('requests.get')
++ def test_get_release_branches(self, mock_request_get):
+ """Test that get_release_branches returns all the active Fedora release
+ branches.
+ """
+- mock_bodhi_client = Mock()
+- mock_bodhi_client.send_request.return_value = {
+- u'page': 1,
+- u'pages': 1,
+- u'releases': [
+- {'state': 'current', 'branch': 'el6'},
+- {'state': 'archived', 'branch': 'f24'},
+- {'state': 'current', 'branch': 'epel7'},
+- {'state': 'current', 'branch': 'f25'},
+- {'state': 'archived', 'branch': 'el5'},
+- {'state': 'archived', 'branch': 'f23'},
+- {'state': 'current', 'branch': 'f26'},
+- {'state': 'pending', 'branch': 'f27m'},
+- {'state': 'current', 'branch': 'f27'}
+- ],
+- u'rows_per_page': 20,
+- u'total': 11}
+- mock_bodhi.return_value = mock_bodhi_client
+- expected = set(['el6', 'epel7', 'f25', 'f26', 'f27'])
+- actual = utils.get_release_branches('http://bodhi.local')
++ mock_rv = Mock()
++ mock_rv.ok = True
++ # This abbreviated data returned from the product-versions PDC API
++ mock_rv.json.return_value = {
++ 'count': 7,
++ 'next': None,
++ 'previous': None,
++ 'results': [
++ {'short': 'epel', 'version': '6'},
++ {'short': 'epel', 'version': '7'},
++ {'short': 'fedora', 'version': '25'},
++ {'short': 'fedora', 'version': '26'},
++ {'short': 'fedora', 'version': '27'},
++ {'short': 'fedora', 'version': '28'},
++ {'short': 'fedora', 'version': 'rawhide'}
++ ]
++ }
++ mock_request_get.return_value = mock_rv
++ expected = set(['el6', 'epel7', 'f25', 'f26', 'f27', 'f28'])
++ actual = utils.get_release_branches('http://pdc.local')
+ self.assertEqual(expected, actual)
+
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-10 21:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 21:45 [rpms/fedpkg] 1.48-1: Merge branch 'master' into epel7
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox