From b2ad9b4f50cfc23733fff7da8993dba90ac51925 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Fri, 28 Jul 2017 17:22:24 +0000 Subject: [PATCH] Include retired projects/deliverables in elections If a deliverable or entire project is retired within the qualifying period for an election, those contributions still count toward defining the electorate. Merge them into the list of official projects under those circumstances, but check for any possible duplicates in case of partial deliverable retirement for a multi-repo deliverable. Change-Id: If626373cdbc6ca9ad7d016b2e18b4d82a4ceaa23 Depends-On: I7ca3c9294d325085ce9139f3a86b55e5b31c79c7 --- tools/owners.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/owners.py b/tools/owners.py index c432ea0581..f9c1e77276 100644 --- a/tools/owners.py +++ b/tools/owners.py @@ -338,6 +338,36 @@ def main(argv=sys.argv): 'hb': ref, }) + # The set of retired or removed "legacy" projects from governance + # are merged into the main dict if their retired-on date falls + # later than the after parameter for the qualifying time period + # TODO(fungi): make this a configurable option + old_projects = query_gerrit( + 'gitweb', { + 'p': 'openstack/governance.git', + 'a': 'blob_plain', + 'f': 'reference/legacy.yaml', + 'hb': ref, + }) + for project in old_projects: + for deliverable in old_projects[project]['deliverables']: + if 'retired-on' in old_projects[project]['deliverables'][deliverable]: + retired = old_projects[project]['deliverables'][deliverable]['retired-on'] + elif 'retired-on' in old_projects[project]: + retired = old_projects[project]['retired-on'] + else: + retired = None + if retired: + retired = retired.isoformat() + if after and after > retired: + continue + if project not in gov_projects: + gov_projects[project] = {'deliverables': {}} + if deliverable in gov_projects[project]['deliverables']: + print('Skipping duplicate/partially retired deliverable: %s' % deliverable, file=sys.stderr) + continue + gov_projects[project]['deliverables'][deliverable] = old_projects[project]['deliverables'][deliverable] + # A mapping of short (no prefix) to full repo names existing in # Gerrit, used to handle repos which have a different namespace # in governance during transitions and also to filter out repos