From 702d68544d20e9cc3f2eb820dacb12f5fd76e8b0 Mon Sep 17 00:00:00 2001 From: Mohan Boddu Date: Jul 31 2019 08:32:56 +0000 Subject: Use package.cfg for epel8+ branches Signed-off-by: Mohan Boddu Merges: https://pagure.io/fedpkg/pull-request/348 --- diff --git a/fedpkg/utils.py b/fedpkg/utils.py index ea25439..fcaa6ec 100644 --- a/fedpkg/utils.py +++ b/fedpkg/utils.py @@ -350,11 +350,25 @@ def get_stream_branches(server_url, package_name): # Please remember to review the data regularly, there are only stream # branches, or some new replacement of PDC fixes the issue as well, it # should be ok to remove if from this list. - return [ - item for item in branches - if not re.match(r'^(f|el|epel)\d+$', item['name']) and - item['name'] != 'master' - ] + stream_branches = [] + for item in branches: + if item['name'] == 'master': + continue + elif re.match(r'^(f|el)\d+$', item['name']): + continue + # epel7 is regular release branch + # epel8 and above should be considered a stream branch to use + # package.cfg file in the branch. + elif 'epel7' == item['name']: + continue + # epel8-playground and above playground branches should be considered + # as release branches so that it will use epelX-playground-candidate + # target to build. + elif re.match(r'^epel\d+-playground$', item['name']): + continue + else: + stream_branches.append(item) + return stream_branches def expand_release(rel, active_releases): @@ -379,5 +393,9 @@ def expand_release(rel, active_releases): return active_releases['epel'] elif rel in active_releases['fedora'] or rel in active_releases['epel']: return [rel] + # if epelX-playground branch then return the release to use + # epelX-playground-candidate target + elif re.match(r'^epel\d+-playground$', rel): + return [rel] else: return None diff --git a/test/test_utils.py b/test/test_utils.py index 74db227..1ee4ce8 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -468,13 +468,15 @@ class TestGetStreamBranches(unittest.TestCase): {'name': 'f28'}, {'name': 'epel7'}, {'name': 'master'}, + {'name': 'epel8'}, + {'name': 'epel8-playground'} ], 'next': None } get.return_value = rv result = utils.get_stream_branches('http://localhost/', 'pkg') - self.assertEqual([{'name': '8'}, {'name': '10'}], list(result)) + self.assertEqual([{'name': '8'}, {'name': '10'}, {'name': 'epel8'}], list(result)) class TestExpandRelease(unittest.TestCase):