From e963ab662d08baa607f290195a244a176184ca7a Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Fri, 20 Sep 2019 20:19:52 +0000 Subject: [PATCH] Include contributors to repos for SIGs in TC rolls It's been the intent ever since the TC started keeping a record of what Git repositories are controlled by official SIGs, that the contributors to those repositories should be eligible to vote in TC elections. Add that feature, along with a command-line option for specifying a non-default file in the event the official one needs to be overridden, and use the same zeroing logic as is used for skipping the legacy file for retired repositories, for the same reasons. Change-Id: I65d2a620a0e4b81d0ef685a7fedb0e7800cbff9f --- openstack_election/cmds/change_owners.py | 1 + openstack_election/owners.py | 29 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/openstack_election/cmds/change_owners.py b/openstack_election/cmds/change_owners.py index 7300963e..28902830 100644 --- a/openstack_election/cmds/change_owners.py +++ b/openstack_election/cmds/change_owners.py @@ -108,6 +108,7 @@ def usage(argv=sys.argv): parser.add_argument("-a", "--after", help="Start date for matching merges") parser.add_argument("-b", "--before", help="End date for matching merges") parser.add_argument("-c", "--config", help="Path to script configuration") + parser.add_argument("-g", "--sigs", help="Path to SIGs repos file") parser.add_argument("-m", "--nonmember", help="include non-foundation-members in electorate", action="store_true") diff --git a/openstack_election/owners.py b/openstack_election/owners.py index 82da16e1..08c65504 100644 --- a/openstack_election/owners.py +++ b/openstack_election/owners.py @@ -130,6 +130,14 @@ def main(options): else: legacy_file = None + # SIGs projects file path + if options.sigs: + sigs_file = options.sigs + elif 'sigs' in config: + sigs_file = config['sigs'] + else: + sigs_file = None + # Whether to omit "extra ATCs" if options.no_extra_atcs: no_extra_atcs = options.no_extra_atcs @@ -217,6 +225,27 @@ def main(options): gov_projects[project]['deliverables'][deliverable] = \ old_projects[project]['deliverables'][deliverable] + # The set of repositories managed by special interest groups + # are added to the main dict as they're part of the technical + # committee electorate + if sigs_file: + sigs_repos = utils.load_yaml(open(sigs_file).read()) + elif projects_file: + sigs_repos = [] + else: + sigs_repos = utils.get_from_git('openstack/governance', + 'reference/sigs-repos.yaml', + {'h': ref}) + for sig in sigs_repos: + for repo in sigs_repos[sig]: + if 'sigs' not in gov_projects: + gov_projects['sigs'] = {'deliverables': {}} + if sig not in gov_projects['sigs']['deliverables']: + gov_projects['sigs']['deliverables'][sig] = {'repos': []} + for repo in sigs_repos[sig]: + gov_projects['sigs']['deliverables'][sig]['repos'].append( + repo['repo']) + # A cache of full repo names existing in Gerrit, used to filter out repos # listed in governance which don't actually exist ger_repos = utils.query_gerrit('projects/', verbose=options.verbose)