| Message ID | bmm.hk63g3keks.gcc.gcc-TEST.rearnsha.163.5.0@forge-stage.sourceware.org |
|---|---|
| Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A8D24BA23C4 for <patchwork@sourceware.org>; Tue, 7 Jul 2026 10:14:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A8D24BA23C4 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39]) by sourceware.org (Postfix) with ESMTPS id 234354BA2E1F for <gcc-patches@gcc.gnu.org>; Tue, 7 Jul 2026 10:13:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 234354BA2E1F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=forge-stage.sourceware.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=forge-stage.sourceware.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 234354BA2E1F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=38.145.34.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783419213; cv=none; b=oF/rgFOFnO3wJgRIniFmns+l9JbSHdF4EUa2mAg40wlYl6X1FhpLbTzjGIToxcOSS2b1uLmB8qWqpxxDNY0EnPcG6cRmR5xh71rnRgPgy/E632ef0HLgaTDdvMiZd1F94ucpfTWZIO8mMwWErknB384ZEWLL88dXpb7V38DXa1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783419213; c=relaxed/simple; bh=ZZHnYNwyVc6rOaxrMM7nazL0t2teQ4uoMNfhHZBFecI=; h=From:Date:Subject:To:Message-ID; b=GovQ289oFjF+3p4wQTduIACEm3tzPFVks9wRrGzSIgADpjoHGwTsyFq77eA4j2L8fIL9F0vt2m0IU6lg+pp9op18rt+R1ue3f1NWmZhAF5glabpYJYZ/xzsqLCw5vXd0F+5Gc4Go/LjlnNMk/eyLSygo03GnX79z8xb5XEHtyAA= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 234354BA2E1F Received: from forge-stage.sourceware.org (localhost [IPv6:::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by forge-stage.sourceware.org (Postfix) with ESMTPS id EDC4A4310D; Tue, 07 Jul 2026 10:13:32 +0000 (UTC) From: Richard Earnshaw via Sourceware Forge <forge-bot+rearnsha@forge-stage.sourceware.org> Date: Tue, 07 Jul 2026 10:12:25 +0000 Subject: [PATCH v5 0/3] convert MAINTAINERS data to YAML. To: gcc-patches mailing list <gcc-patches@gcc.gnu.org> Cc: jefflaw@qti.qualcomm.com Message-ID: <bmm.hk63g3keks.gcc.gcc-TEST.rearnsha.163.5.0@forge-stage.sourceware.org> X-Mailer: batrachomyomachia X-Requested-Reviewer: rdfm X-Pull-Request-Organization: gcc X-Pull-Request-Repository: gcc-TEST X-Pull-Request: https://forge.sourceware.org/gcc/gcc-TEST/pulls/163 References: <bmm.hk56yzgvvk.gcc.gcc-TEST.rearnsha.163.4.0@forge-stage.sourceware.org> In-Reply-To: <bmm.hk56yzgvvk.gcc.gcc-TEST.rearnsha.163.4.0@forge-stage.sourceware.org> X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_SHORT, POISEN_SPAM_PILL, POISEN_SPAM_PILL_1, POISEN_SPAM_PILL_3, PP_MIME_FAKE_ASCII_TEXT, SPF_HELO_PASS, SPF_PASS, TXREP shortcircuit=no autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: gcc-patches mailing list <gcc-patches@gcc.gnu.org>, jefflaw@qti.qualcomm.com, rearnsha@arm.com Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
| Series | convert MAINTAINERS data to YAML. | |
Message
Richard Earnshaw via Sourceware Forge
July 7, 2026, 10:12 a.m. UTC
Hi gcc-patches mailing list,
Richard Earnshaw via Sourceware Forge <forge-bot+rearnsha@forge-stage.sourceware.org> has requested that the following forgejo pull request
be published on the mailing list.
Created on: 2026-05-29 15:13:48+00:00
Latest update: 2026-07-07 10:12:26+00:00
Changes: 8 changed files, 6956 additions, 248 deletions
Head revision: rearnsha/gcc-TEST ref MAINT-yaml commit c963db2262568530628f406d3776b9e4ca3831f1
Base revision: gcc/gcc-TEST ref trunk commit d68464df5be15278fbec9ef40c5f1bd160b8af1a r17-2186-gd68464df5be152
Merge base: d68464df5be15278fbec9ef40c5f1bd160b8af1a
Full diff url: https://forge.sourceware.org/gcc/gcc-TEST/pulls/163.diff
Discussion: https://forge.sourceware.org/gcc/gcc-TEST/pulls/163
Requested Reviewers: rdfm
For the forge to be able to notify maintainers efficiently when a
merge request is submitted, I need to be able to automate assigning
reviewers as well as just labels. The information needed for this is
largely in the MAINTAINERS file, but not in a format that is readily
machine readable: it can be scraped, but it's a bit of an ad-hoc
process and not something I'd want to maintain in the long term.
To mitigate that, and to make it possible to augment this information
with additional details, I've been experimenting with converting the
raw data into YAML and then having a script build the official
MAINTAINERS file form that. The results can be seen in the following
patch. The results so far are /almost/ identical with only a limited
set of differences, some of which can probably be resolved later on.
- the free-form entries saying All XXX maintainers have been expanded
into explicit lists; I really don't think it helps much to have yet
another level of indirection to deal with here and in particular it
complicates regenerating the MAINTAINERS file as the template rules
would need to be handled specifically.
- I've found some small sort-order differences; these could be easily
rectified, but I think the sort order I'm using here
(case-independent sort) is preferable to a case-dependent one: Lac
should be sorted before LaD. It would be better, I think to tweak
check-MAINTAINERS.py to prefer this new order, but that file becomes
redundant if this code goes in.
Finally, the name for Naveen Gowda has changed in the DCO list. The
email address used appears elsewhere in the MAINTAINERS file with a
slightly different name. This could be fixed with a small extension
to the YAML data (the DCO entry could take an optional name), if it
really matters.
One additional field that I've added is a marker for what I consider
to be inactive accounts. The forge is likely to be more aggressive in
emailing developers and I don't want it to be forever mailing people
who have long ceased to contribute to the project. For now I've
scraped the GCC commit logs and posts to gcc-patches@gcc.gnu.org and
gcc@gcc.gnu.org; anybody who has not contributed to one of those
sources in the last two years has been marked as inactive. The
generator script has an option (-a) to build a version of the
MAINTAINERS file with inactive users removed: we have a lot of retired
devs!
Changes since V1:
Added a schema and additional checks to validate the yaml data
Added a simple script to create a Write-After entry
Split the edits to the base conversion of the original
MAINTAINERS data into separate commits. This is just to
make things easier in the case I need to re-run the conversion
and will be collapsed before the final commit
Changes since V2:
Improve python formatting, and general cleanups
Incorporate recent changes from the existing MAINTAINERS data
Changes since V3:
Fix the testsuite check on the MAINTAINERS file. The test
now regenerates a copy of the file from the MAINTAINERS.yml
data and compares it against the committed version. This
checks both the contents of the YAML data and the generated
result. Retire check-MAINTAINERS.py.
Unless there are some new objections, I think this is now ready to be merged.
---
Thanks for taking the time to contribute to GCC!
Please be advised that https://forge.sourceware.org/ is currently a trial
that is being used by the GCC community to experiment with a new workflow
based on pull requests.
Pull requests sent here may be forgotten or ignored. Patches that you want to
propose for inclusion in GCC should use the existing email-based workflow,
see https://gcc.gnu.org/contribute.html
Changed files:
- A: MAINTAINERS.yml
- A: contrib/add-write-after.py
- A: contrib/gen-MAINTAINERS.py
- A: contrib/maintainer_utils.py
- D: contrib/check-MAINTAINERS.py
- M: .editorconfig
- M: MAINTAINERS
- M: gcc/testsuite/gcc.src/maintainers.exp
Richard Earnshaw (3):
editorconfig: Add rules for yaml/yml files.
MAINTAINERS: scripts to generate the file from yaml data
MAINTAINERS: Add a script to create a new entry in the mainainers data
.editorconfig | 6 +
MAINTAINERS | 27 +-
MAINTAINERS.yml | 6156 +++++++++++++++++++++++++
contrib/add-write-after.py | 150 +
contrib/check-MAINTAINERS.py | 229 -
contrib/gen-MAINTAINERS.py | 319 ++
contrib/maintainer_utils.py | 288 ++
gcc/testsuite/gcc.src/maintainers.exp | 29 +-
8 files changed, 6956 insertions(+), 248 deletions(-)
create mode 100644 MAINTAINERS.yml
create mode 100755 contrib/add-write-after.py
delete mode 100755 contrib/check-MAINTAINERS.py
create mode 100755 contrib/gen-MAINTAINERS.py
create mode 100755 contrib/maintainer_utils.py
Range-diff against v4:
1: 868e8e65a6eb = 1: 8b00dc7bd29b editorconfig: Add rules for yaml/yml files.
2: 99fc690e953f ! 2: 89d27e500e15 MAINTAINERS: scripts to generate the file from yaml data
@@ Commit message
MAINTAINERS: scripts to generate the file from yaml data
Convert the existing MAINTAINERS data to YAML and add a script to
- rebuild the MAINTAINERS file from it. We'll add the regenerated file
- shortly.
+ rebuild the MAINTAINERS file from it. Rebuild the MAINTAINERS file from
+ that data.
+
+ Update the testsuite to check that the MAINTAINERS file is correctly
+ generated from the YAML.
+
+ Remove contrib/check-MAINTAINERS.py: it's nolonger needed now that
+ we generate the file automatically.
ChangeLog:
* MAINTAINERS.yml: New file.
+ * MAINTAINERS: Regenerate from MAINTAINERS.yml.
contrib/ChangeLog:
* gen-MAINTAINERS.py: New file.
* maintainer_utils.py: New file.
+ * check-MAINTAINERS.py: Delete.
+
+ gcc/testsuite/ChangeLog:
+
+ * gcc.src/maintainers.exp:
+
+ ## MAINTAINERS ##
+@@
+ Note
+ ====
+
++This file is autogenerated. DO NOT EDIT or your changes will be lost.
++Instead, add your details to contrib/MAINTAINERS.yml and run
++
++ contrib/gen-MAINTAINERS.py -o MAINTAINERS MAINTAINERS.yml
++
+ This file contains information about people who are permitted to make
+ changes to various parts of the compiler and associated libraries.
+
+@@ MAINTAINERS: Note: when adding someone who has commit access to a more specific section,
+ please also ensure that there is a corresponding entry in the Write After
+ Approval list, since that list contains the gcc.gnu.org account name.
+
+-Note: please verify that sorting is correct with:
+-./contrib/check-MAINTAINERS.py MAINTAINERS
+-
+ Maintainers
+ ===========
+
+@@ MAINTAINERS: jump.cc David S. Miller <davem@redhat.com>
+ libbacktrace Ian Lance Taylor <ian@airs.com>
+ libcpp Per Bothner <per@bothner.com>
+ libcpp David Malcolm <dmalcolm@redhat.com>
+-libcpp All C and C++ front end maintainers
++libcpp Jason Merrill <jason@redhat.com>
++libcpp Joseph Myers <josmyers@redhat.com>
++libcpp Nathan Sidwell <nathan@acm.org>
+ libga68 Jose E. Marchesi <jemarch@gnu.org>
+ libgcc Ian Lance Taylor <ian@airs.com>
+ libgo Ian Lance Taylor <ian@airs.com>
+ libgomp Tobias Burnus <tburnus@baylibre.com>
+ libgomp Jakub Jelinek <jakub@redhat.com>
+ libgomp (OpenACC) Thomas Schwinge <tschwinge@baylibre.com>
+-libgrust All Rust front end maintainers
++libgrust Arthur Cohen <arthur.cohen@embecosm.com>
++libgrust Philip Herron <herron.philip@googlemail.com>
+ libiberty Ian Lance Taylor <ian@airs.com>
+ libitm Torvald Riegel <triegel@redhat.com>
+ libobjc Nicola Pero <nicola.pero@meta-innovation.com>
+@@ MAINTAINERS: from other maintainers or reviewers.
+
+ Name BZ account Email
+
+-Soumya AR soumyaa <soumyaa@nvidia.com>
+ Spencer Abson sabson <spencer.abson@student.manchester.ac.uk>
+ Mark G. Adams mgadams <mark.g.adams@sympatico.ca>
+ Ajit Kumar Agarwal aagarwa <aagarwa1@linux.ibm.com>
+ Pedro Alves palves <palves@redhat.com>
+ John David Anglin danglin <dave.anglin@bell.net>
+ Harald Anlauf anlauf <anlauf@gmx.de>
++Soumya AR soumyaa <soumyaa@nvidia.com>
+ Paul-Antoine Arras parras <parras@baylibre.com>
+ Arsen Arsenović arsen <aarsenovic@baylibre.com>
+ Raksit Ashok raksit <raksit@google.com>
+@@ MAINTAINERS: Prathamesh Kulkarni prathamesh3492 <prathameshk@nvidia.com>
+ Venkataramanan Kumar vekumar <venkataramanan.kumar@amd.com>
+ Maxim Kuvyrkov mkuvyrkov <maxim.kuvyrkov@linaro.org>
+ Doug Kwan dougkwan <dougkwan@google.com>
+-Aaron W. LaFramboise aaronwl <aaronavay62@aaronwl.com>
+ Scott Robert Ladd srladd <scott.ladd@coyotegulch.com>
+ Razya Ladelsky razya <razya@gcc.gnu.org>
+ Thierry Lafage tlafage <thierry.lafage@inria.fr>
++Aaron W. LaFramboise aaronwl <aaronavay62@aaronwl.com>
+ Rask Ingemann Lambertsen rask <ccc94453@vip.cybercity.dk>
+ Jerome Lambourg lambourg <lambourg@adacore.com>
+ Tim Lange tlange <mail@tim-lange.me>
+@@ MAINTAINERS: Renlin Li renlin <renlin.li@arm.com>
+ Xinliang David Li davidxl <davidxl@google.com>
+ Kewen Lin linkw <linkw@gcc.gnu.org>
+ Chen Liqin liqin <liqin.gcc@gmail.com>
+-Martin Liska marxin <mliska@suse.cz>
++Martin Liška marxin <mliska@suse.cz>
+ Hao Liu hliu <hliu@os.amperecomputing.com>
+ Hongtao Liu liuhongt <hongtao.liu@intel.com>
+ Jiangning Liu liujiangning <jiangning.liu@arm.com>
+@@ MAINTAINERS: Christophe Lyon clyon <christophe.lyon@arm.com>
+ Jin Ma majin <jinma@linux.alibaba.com>
+ Jun Ma junma <junma@linux.alibaba.com>
+ Yuao Ma yuao <yuao@gcc.gnu.org>
+-Andrew MacLeod amacleod <amacleod@redhat.com>
+ Luis Machado luisgpm <luis.machado.foss@gmail.com>
++Andrew MacLeod amacleod <amacleod@redhat.com>
+ Ziga Mahkovec ziga <ziga.mahkovec@klika.si>
+ Vladimir Makarov vmakarov <vmakarov@redhat.com>
+ David Malcolm dmalcolm <dmalcolm@redhat.com>
+@@ MAINTAINERS: Thomas Neumann tneumann <tneumann@users.sourceforge.net>
+ Dan Nicolaescu dann <dann@ics.uci.edu>
+ Kelvin Nilsen kelvin <kelvin.nilsen@gmail.com>
+ Hans-Peter Nilsson hp <hp@axis.com>
+-James Norris
++James Norris - <jnorris@codesourcery.com>
+ Diego Novillo dnovillo <dnovillo@google.com>
+ Dorit Nuzman dorit <dorit@il.ibm.com>
+ David O'Brien obrien <obrien@FreeBSD.org>
+@@ MAINTAINERS: Robin Dapp <rdapp.gcc@gmail.com>
+ Robin Dapp <rdapp@qti.qualcomm.com>
+ Robin Dapp <rdapp@ventanamicro.com>
+ Prachi Godbole <pgodbole@nvidia.com>
+-Naveen Gowda <naveen.siddegowda@oss.qualcomm.com>
++Naveen H.S <naveen.siddegowda@oss.qualcomm.com>
+ Aldy Hernandez <aldy@quesejoda.com>
+ Michal Jires <mjires@suse.cz>
+ Matthias Kretz <m.kretz@gsi.de>
## MAINTAINERS.yml (new) ##
@@
@@ MAINTAINERS.yml (new)
+ - cohenarthur@gcc.gnu.org
+ roles:
+ - Maintainer: Rust
++ - Maintainer: libgrust
+ - WriteAfter
+ account: cohenarthur
+- sn: Cohen
@@ MAINTAINERS.yml (new)
+ - redbrain@gcc.gnu.org
+ roles:
+ - Maintainer: Rust
++ - Maintainer: libgrust
+ - WriteAfter
+ account: redbrain
+- sn: Hillenbrand
@@ MAINTAINERS.yml (new)
+ - WriteAfter
+ account: liqin
+ inactive: true
-+- sn: Liska
-+ cn: Martin Liska
++- sn: Liška
++ cn: Martin Liška
+ email:
+ - mliska@suse.cz
+ - marxin@gcc.gnu.org
@@ MAINTAINERS.yml (new)
+ roles:
+ - Global
+ - Maintainer: c++
++ - Maintainer: libcpp
+ - Maintainer: '*gimpl*'
+ - Maintainer: dwarf debugging code
+ - WriteAfter
@@ MAINTAINERS.yml (new)
+ roles:
+ - Global
+ - Maintainer: C front end/ISO C99
++ - Maintainer: libcpp
+ - Maintainer: docs co-maintainer
+ - Maintainer: docstring relicensing
+ - Maintainer: i18n
@@ MAINTAINERS.yml (new)
+- sn: Norris
+ cn: James Norris
+ email:
-+ - ''
++ - jnorris@codesourcery.com
+ roles:
+ - WriteAfter
+ inactive: true
@@ MAINTAINERS.yml (new)
+ roles:
+ - WriteAfter
+ account: joeramsay
++- sn: Ranns
++ cn: Nina Ranns
++ email:
++ - dinka.ranns@gmail.com
++ - ninaranns@gcc.gnu.org
++ roles:
++ - WriteAfter
++ account: ninaranns
+- sn: Rasmussen
+ cn: Rolf Rasmussen
+ email:
@@ MAINTAINERS.yml (new)
+ - nathan@gcc.gnu.org
+ roles:
+ - Maintainer: c++
++ - Maintainer: libcpp
+ - Maintainer: gcov
+ - WriteAfter
+ - DCO: nathan@acm.org
@@ MAINTAINERS.yml (new)
+- name: Rust
+ class: Lang
+ labels: []
++- name: libgrust
++ class: Subsystem
++ labels: []
+- name: VMS
+ class: OS
+ labels: []
@@ MAINTAINERS.yml (new)
+ class: CPU
+ labels: []
+ ## contrib/check-MAINTAINERS.py (deleted) ##
+@@
+-#!/usr/bin/env python3
+-
+-# Copyright (C) 2022-2026 Free Software Foundation, Inc.
+-#
+-# This file is part of GCC.
+-#
+-# GCC 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 3, or (at your option)
+-# any later version.
+-#
+-# GCC 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 GCC; see the file COPYING. If not, write to
+-# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+-# Boston, MA 02110-1301, USA.
+-
+-# Check that names in the file are sorted alphabetically by surname, name
+-# bugzilla handle and email (in this order).
+-
+-import locale
+-import sys
+-import re
+-from itertools import groupby
+-from operator import itemgetter
+-from difflib import ndiff
+-import unidecode
+-
+-locale.setlocale(locale.LC_ALL, 'en_US.utf8')
+-
+-exit_code = 0
+-
+-if len(sys.argv) != 2:
+- print('Usage: ./check-MAINTAINERS.py path-to/MAINTAINERS')
+- sys.exit(1)
+-
+-
+-def get_name_for_sort(name):
+- parts = name.split()
+- surname = parts[-1] + ", " + " ".join(parts[:-1])
+-
+- # Special-case some names
+- if (name == 'Stefan Schulze Frielinghaus'
+- or name == 'Kris Van Hees'):
+- surname = " ".join(parts[1:]) + ", " + parts[0]
+- if surname.startswith("d'"):
+- surname = surname[2:]
+-
+- # Remove accents
+- return unidecode.unidecode(surname)
+-
+-
+-def check_group(name, lines, columns, matcher, sort_by):
+- global exit_code
+- named_lines = []
+- rex = re.compile (matcher)
+- for line in lines:
+- if line.startswith(' '):
+- print(f'Line should not start with space: "{line}"')
+- exit_code = 2
+- continue
+-
+- if line.endswith(' '):
+- print(f'Line should not end with space: "{line}"')
+- exit_code = 3
+- continue
+-
+- # Special-case some names
+- if line == 'James Norris':
+- named_lines.append((get_name_for_sort(line), "", "", line))
+- continue
+-
+- fields = rex.match(line)
+- if not fields:
+- print(f'Could not parse line: "{line}"')
+- exit_code = 3
+- continue
+-
+- matched_keys = [
+- name for name, idx in sorted (rex.groupindex.items(),
+- key=lambda x: x[1])
+- if fields.group(idx) is not None]
+-
+- pos = 0
+- for i, k in enumerate (matched_keys):
+- if i >= len (columns):
+- break
+- if pos < columns[i]:
+- pos = columns[i]
+- start = fields.start(k)
+- if k == 'email':
+- start -= 1 # Account for the leading '<'
+- if start == pos:
+- True
+- elif (start > pos
+- and pos > 2
+- and k == 'email'
+- and line[start-1] == " "
+- and line[start-2] != " "):
+- True
+- elif (start > pos
+- and k != 'email'
+- and pos > 3
+- and line[start-2:start] == " "
+- and line[start-3] != " "):
+- True
+- else:
+- exit_code = 3
+- print (line)
+- print (f"{k} starts in the wrong column: expected: {pos}, actual {start}")
+- pos += 1 + len (fields[k].rstrip())
+-
+- fields = fields.groupdict()
+- if 'Team' in fields and fields['Team']:
+- fields['User'] = fields['Team']
+- fields['email'] = ""
+- pieces = []
+- for i, f in enumerate (sort_by):
+- if f not in fields:
+- print('Internal error: re mismatch')
+- sys.exit(10)
+- if f == 'User':
+- pieces.append(get_name_for_sort(fields[f].rstrip()))
+- elif f == 'component':
+- pieces.append(fields[f].rstrip().lower())
+- else:
+- pieces.append(fields[f].rstrip())
+- pieces.append (line)
+- named_lines.append(pieces)
+-
+- order = []
+- for i, _ in enumerate (sort_by):
+- order.append(i)
+- order = tuple(order)
+- lines = [line + "\n" for line in lines]
+- sorted_lines = [line[-1] + "\n"
+- for line in sorted(named_lines,
+- key = itemgetter(*order))]
+- if lines != sorted_lines:
+- exit_code = 1
+- diff = [line for line in ndiff(lines, sorted_lines)
+- if not line.startswith('? ')]
+- print(f'Wrong order for {name}:\n')
+- print(''.join(diff))
+- else:
+- print(f'{name} are fine!')
+-
+-
+-text = open(sys.argv[1]).read()
+-if '\t' in text:
+- print('The file should not contain tabs')
+- exit_code = 9
+-
+-sections = [
+- # heading, paragraph index, column numbers, regex, sort order
+- ('Global Reviewers',
+- 1,
+- [0, 48],
+- r'^(?P<User>.{47}) <(?P<email>.*)>$',
+- ['User', 'email']),
+- ('CPU Port Maintainers (CPU alphabetical order)',
+- 1,
+- [0, 24, 48],
+- r'^(?P<component>.{23}) (?P<User>.*) <(?P<email>[^<>]*)>$',
+- ['component', 'User', 'email']),
+- ('OS Port Maintainers (OS alphabetical order)',
+- 1,
+- [0, 24, 48],
+- r'^(?P<component>.{23}) (?P<User>.*) <(?P<email>[^<>]*)>$',
+- ['component', 'User', 'email']),
+- ('Language Front Ends Maintainer',
+- 1,
+- [0, 24, 48],
+- r'^(?P<component>.{23}) (?P<User>.*) <(?P<email>[^<>]*)>$',
+- ['component', 'User', 'email']),
+- ('Various Maintainers',
+- 1,
+- [0, 24, 48],
+- r'''(?x)
+- ^(?P<component>(?:(?!\s\s).)*)\s\s+
+- (?:(?P<Team>All.*maintainers)
+- |(?P<User>[^\s].*)\s+<(?P<email>[^<>]*)>)$''',
+- ['component', 'User', 'email']),
+- ('Reviewers',
+- 1,
+- [0, 24, 48],
+- r'^(?P<component>(?:(?! ).)*) +(?P<User>[^\s].*) <(?P<email>[^<>]*)>$',
+- ['component', 'User', 'email']),
+- ('Write After Approval',
+- 2,
+- [0, 32, 48],
+- r'^(?P<User>.{31}) (?P<account>.{15}) <(?P<email>[^<>]*)>$',
+- ['User', 'email', 'account']),
+- ('Bug database only accounts',
+- 1,
+- [0, 48],
+- r'^(?P<User>.{47}) <(?P<email>[^<>]*)>$',
+- ['User', 'email']),
+- ('Contributing under the DCO',
+- 2,
+- [0, 48],
+- r'^(?P<User>.{47}) <(?P<email>[^<>]*)>$',
+- ['User', 'email'])
+-]
+-
+-i = 0
+-count = 0
+-for is_empty, lines in groupby(text.splitlines(), lambda x: not x):
+- if is_empty:
+- continue
+- lines = list(lines)
+- if count > 0:
+- count -= 1
+- if count == 0:
+- check_group(sections[i][0], lines, sections[i][2], sections[i][3],
+- sections[i][4])
+- i += 1
+- elif len(lines) == 1 and i < len(sections) and sections[i][0] in lines[0]:
+- count = sections[i][1]
+-
+-if i < len(sections):
+- print(f'Missing "{sections[i][0]}" section')
+- exit_code = 10
+-
+-sys.exit(exit_code)
+
## contrib/gen-MAINTAINERS.py (new) ##
@@
+#!/usr/bin/env python3
@@ contrib/maintainer_utils.py (new)
+
+if __name__ == "__main__":
+ sys.exit(main())
+
+ ## gcc/testsuite/gcc.src/maintainers.exp ##
+@@
+ load_lib "target-supports.exp"
+
+ proc gcc_src_run_maintainers_verify_sh {} {
+- set script check-MAINTAINERS.py
++ set script gen-MAINTAINERS.py
+
+ global srcdir
+ set rootdir $srcdir/../..
+ set contrib $rootdir/contrib
+ set maintainers $rootdir/MAINTAINERS
++ set maintainers_yml $rootdir/MAINTAINERS.yml
+
+ if { ![check_effective_target_recent_python3] } {
+ unsupported "$script recent python3 is missing"
+ return
+ }
+
+- if { ![check_effective_target_python3_module "unidecode"] } {
+- unsupported "$script 'unidecode' python3 module is missing"
+- return
++ foreach pylib {"unidecode" "jsonschema" "yaml"} {
++ if { ![check_effective_target_python3_module $pylib] } {
++ unsupported "$script '$pylib' python3 module is missing"
++ return
++ }
+ }
+
+-
+- set result [remote_exec host $contrib/$script $maintainers]
++ # This will generate a new copy of the MAINTAINERS data from the
++ # YAML data after performing some sanity checks on the input. There
++ # are two failure modes to consider - the YAML is invalid and the
++ # generated result does not match the expected MAINTAINERS file.
++ set result [remote_exec host $contrib/$script "-o MAINTAINERS.tst $maintainers_yml"]
+ set status [lindex $result 0]
+ if { $status == 0 } then {
+- pass "$script"
++ set result [remote_exec host "diff" "-u $maintainers MAINTAINERS.tst"]
++ set status [lindex $result 0]
++ if { $status == 0 } then {
++ pass "$script"
++ } else {
++ send_log "$result\n"
++ fail "$script: $maintainers not updated correctly"
++ }
+ } else {
+ send_log "$result\n"
+- fail "$script"
++ fail "$script: generate failed"
+ }
+ }
+
3: 7e0ca591ca98 < -: ------------ MAINTAINERS.yml: Correct Martin Liška's name
4: bc91b839b8ef < -: ------------ MAINTAINERS.yml: Restore James Norris' email address
5: 4dcc0af6a162 < -: ------------ MAINTAINERS.yml: Handle libgrust explicitly
6: 9a23170c90ee < -: ------------ MAINTAINERS.yml: Add libcpp to all C and C++ maintainer's roles
7: c44c1ed7746a < -: ------------ MAINTAINERS: generate from MAINTAINERS.yml
8: 442ae21dadc7 = 3: c963db226256 MAINTAINERS: Add a script to create a new entry in the mainainers data
Comments
Final version as committed. -- https://forge.sourceware.org/gcc/gcc-TEST/pulls/163#issuecomment-6551