On 1/10/22 17:14, Martin Liška wrote:
Are you fine with the suggested changes?

Hello.

Jakub had comments so I'm sending v2 where I added few parsing
exceptions. Now it reports:

...
  Chandra Chavva                                        <ccha...@redhat.com>
  Dehao Chen                                    <de...@google.com>
- Fabien Chêne                                  <fab...@gcc.gnu.org>
  Clément Chigot                                        
<clement.chi...@atos.net>
  Harshit Chopra                                        <hars...@google.com>
  Tamar Christina                                       
<tamar.christ...@arm.com>
  Eric Christopher                              <echri...@gmail.com>
+ Fabien Chêne                                  <fab...@gcc.gnu.org>
  Paul Clarke                                   <p...@us.ibm.com>
  William Cohen                                 <wco...@redhat.com>
  Michael Collison                              <michael.colli...@arm.com>
  Josh Conner                                   <joshcon...@google.com>
  R. Kelley Cook                                        <kc...@gcc.gnu.org>
  Alex Coplan                                   <alex.cop...@arm.com>
  Andrea Corallo                                        <andrea.cora...@arm.com>
  Christian Cornelssen                          <cc...@cs.tu-berlin.de>
  Ludovic Courtès                                       <l...@gnu.org>
  Lawrence Crowl                                        <cr...@google.com>
  Ian Dall                                      <i...@beware.dropbear.id.au>
  David Daney                                   <david.da...@caviumnetworks.com>
  Robin Dapp                                    <rd...@linux.ibm.com>
  Simon Dardis                                  <simon.dar...@gmail.com>
  Sudakshina Das                                        <sudi....@arm.com>
  Bud Davis                                     <jmda...@link.com>
  Chris Demetriou                                       <c...@google.com>
  Sameera Deshpande                             <sameera.deshpa...@linaro.org>
  Wilco Dijkstra                                        <wdijk...@arm.com>
  Benoit Dupont de Dinechin                     
<benoit.dupont-de-dinec...@st.com>
  Jason Eckhardt                                        <j...@rice.edu>
  Bernd Edlinger                                        
<bernd.edlin...@hotmail.de>
  Phil Edwards                                  <p...@gcc.gnu.org>
  Mark Eggleston                                        
<mark.eggles...@codethink.co.uk>
  Steve Ellcey                                  <sell...@caviumnetworks.com>
  Mohan Embar                                   <gnust...@thisiscool.com>
  Revital Eres                                  <e...@il.ibm.com>
  Marc Espie                                    <es...@cvs.openbsd.org>
  Ansgar Esztermann                             
<ans...@thphy.uni-duesseldorf.de>
  Doug Evans                                    <d...@google.com>
  Chris Fairles                                 <cfair...@gcc.gnu.org>
  Alessandro Fanfarillo                         <fanfarillo....@gmail.com>
  Changpeng Fang                                        <changpeng.f...@amd.com>
  David Faust                                   <david.fa...@oracle.com>
  Li Feng                                               <nemoking...@gmail.com>
  Thomas Fitzsimmons                            <fitz...@redhat.com>
  Alexander Fomin                                       
<afomin.mail...@gmail.com>
  Brian Ford                                    <f...@vss.fsi.com>
  John Freeman                                  <jfreema...@gmail.com>
  Nathan Froyd                                  <froy...@gcc.gnu.org>
  Chao-ying Fu                                  <f...@mips.com>
  Gary Funck                                    <g...@intrepid.com>
  Pompapathi V Gadad                            <pompapathi.v.ga...@nsc.com>
  Eric Gallager                                 <eg...@gwmail.gwu.edu>
  Gopalasubramanian Ganesh                      
<ganesh.gopalasubraman...@amd.com>
  Kaveh Ghazi                                   <gh...@gcc.gnu.org>
  Doug Gilmore                                  <doug.gilm...@imgtec.com>
  Matthew Gingell                                       <ging...@gnat.com>
  Jan-Benedict Glaw                             <jbg...@lug-owl.de>
  Marc Glisse                                   <marc.gli...@inria.fr>
  Prachi Godbole                                        
<prachi.godb...@imgtec.com>
  Torbjorn Granlund                             <t...@swox.com>
  James Greenhalgh                              <james.greenha...@arm.com>
  Doug Gregor                                   <doug.gre...@gmail.com>
  Matthew Gretton-Dann                          <matthew.gretton-d...@arm.com>
  Yury Gribov                                   <tetra2...@gmail.com>
  Jon Grimm                                     <jgri...@us.ibm.com>
  Laurent Guerby                                        <laur...@guerby.net>
  Haochen Gui                                   <guih...@gcc.gnu.org>
  Jiufu Guo                                     <guoji...@linux.ibm.com>
  Xuepeng Guo                                   <terry.xp...@gmail.com>
  Wei Guozhi                                    <car...@google.com>
+ Naveen H.S                                    <nave...@marvell.com>
  Mostafa Hagog                                 <ha...@gcc.gnu.org>
  Andrew Haley                                  <a...@redhat.com>
  Frederik Harwath                              <frede...@codesourcery.com>
  Stuart Hastings                                       <stu...@apple.com>
  Michael Haubenwallner                         
<michael.haubenwall...@ssi-schaefer.com>
  Pat Haugen                                    <pthau...@us.ibm.com>
  Michael Hayes                                 <m.ha...@elec.canterbury.ac.nz>
  Alan Hayward                                  <alan.hayw...@arm.com>
  Li Jia He                                     <heli...@gcc.gnu.org>
  Mark Heffernan                                        <meh...@google.com>
  George Helffrich                              <geo...@gcc.gnu.org>
  Daniel Hellstrom                              <dan...@gaisler.com>
  Fergus Henderson                              <f...@cs.mu.oz.au>
  Stuart Henderson                              <shend...@gcc.gnu.org>
  Marius Hillenbrand                            <mhil...@linux.ibm.com>
  Matthew Hiller                                        <hil...@redhat.com>
  Kazu Hirata                                   <k...@codesourcery.com>
  Manfred Hollstein                             <m...@suse.com>
  Cong Hou                                      <co...@google.com>
  Falk Hueffner                                 <f...@debian.org>
  Andrew John Hughes                            <gnu_and...@member.fsf.org>
  Dominique d'Humieres                          <domi...@lps.ens.fr>
  Andy Hutchinson                                       <hutchinsona...@aim.com>
  Joel Hutton                                   <joel.hut...@arm.com>
  Lewis Hyatt                                   <lhy...@gmail.com>
- Naveen H.S                                    <nave...@marvell.com>
  Roland Illig                                  <roland.il...@gmx.de>
  Meador Inge                                   <mead...@codesourcery.com>
  Bernardo Innocenti                            <ber...@develer.com>
  Mihail Ionescu                                        <mihail.ione...@arm.com>
  Vladislav Ivanishin                           <v...@ispras.ru>
  Alexander Ivchenko                            <aivch...@gmail.com>
  Balaji V. Iyer                                        <bvi...@gmail.com>
- Pekka Jääskeläinen                            
<pekka.jaaskelai...@parmance.com>
  Daniel Jacobowitz                             <d...@false.org>
  Andreas Jaeger                                        <a...@suse.de>
  Harsha Jagasia                                        <harsha.jaga...@amd.com>
  Fariborz Jahanian                             <fjahan...@apple.com>
  Qian Jianhua                                  <qia...@cn.fujitsu.com>
  Janis Johnson                                 <janis.marie.john...@gmail.com>
  Teresa Johnson                                        <tejohn...@google.com>
  Kean Johnston                                 <j...@sco.com>
  Phillip Jordan                                        
<phillip.m.jor...@gmail.com>
  Tim Josling                                   <t...@melbpc.org.au>
+ Pekka Jääskeläinen                            
<pekka.jaaskelai...@parmance.com>
  Victor Kaplansky                              <vict...@il.ibm.com>
  Geoffrey Keating                              <geo...@geoffk.org>
  Brendan Kehoe                                 <bren...@zen.org>
  Andi Kleen                                    <a...@firstfloor.org>
  Matthias Klose                                        <d...@debian.org>
  Jeff Knaggs                                   <jkna...@redhat.com>
  Michael Koch                                  <konque...@gmx.de>
  Nicolas Koenig                                        
<koeni...@student.ethz.ch>
  Boris Kolpackov                                       
<bo...@codesynthesis.com>
  Dave Korn                                     <dave.korn.cyg...@gmail.com>
  Julia Koval                                   <julia.ko...@intel.com>
  Matt Kraai                                    <kr...@ftbfs.org>
  Jan Kratochvil                                        
<jan.kratoch...@redhat.com>
  Matthias Kretz                                        <m.kr...@gsi.de>
  Louis Krupp                                   <louis.kr...@zoho.com>
  Prathamesh Kulkarni                           <prathamesh.kulka...@linaro.org>
  Venkataramanan Kumar                          <venkataramanan.ku...@amd.com>
  Doug Kwan                                     <dougk...@google.com>
  Scott Robert Ladd                             <scott.l...@coyotegulch.com>
  Razya Ladelsky                                        <ra...@gcc.gnu.org>
  Thierry Lafage                                        
<thierry.laf...@inria.fr>
+ Aaron W. LaFramboise                          <aaronava...@aaronwl.com>
  Rask Ingemann Lambertsen                      <ccc94...@vip.cybercity.dk>
  Jerome Lambourg                                       <lambo...@adacore.com>
- Aaron W. LaFramboise                          <aaronava...@aaronwl.com>
  Asher Langton                                 <langt...@llnl.gov>
  Chris Lattner                                 <sa...@nondot.org>
  Terry Laurenzo                                        <tlaure...@gmail.com>
  Alan Lawrence                                 <alan.lawre...@arm.com>
  Jozef Lawrynowicz                             <joze...@mittosystems.com>
  Georg-Johann Lay                              <a...@gjlay.de>
  Vlad Lazar                                    <vlad.la...@arm.com>
  Marc Lehmann                                  <p...@goof.com>
  James Lemke                                   <j...@lemke.org>
  Ilya Leoshkevich                              <i...@linux.ibm.com>
  Kriang Lerdsuwanakij                          <lerds...@users.sourceforge.net>
  Renlin Li                                     <renlin...@arm.com>
  Xinliang David Li                             <davi...@google.com>
  Kewen Lin                                     <li...@gcc.gnu.org>
  Chen Liqin                                    <liqin....@gmail.com>
  Jiangning Liu                                 <jiangning....@arm.com>
  Sa Liu                                                <sa...@de.ibm.com>
  Ralph Loader                                  <r...@ihug.co.nz>
  Sheldon Lobo                                  <sheldon.l...@oracle.com
  Gabor Loki                                    <l...@inf.u-szeged.hu>
- Manuel López-Ibáñez                           <m...@gcc.gnu.org>
  Carl Love                                     <c...@us.ibm.com>
- Martin v. Löwis                                       
<loe...@informatik.hu-berlin.de>
  H.J. Lu                                               <hjl.to...@gmail.com>
  Xiong Hu Luo                                  <luo...@linux.vnet.ibm.com>
  Bin Bin Lv                                    <s...@linux.ibm.com>
  Christophe Lyon                                       <christophe.l...@st.com>
+ Manuel López-Ibáñez                           <m...@gcc.gnu.org>
+ Martin v. Löwis                                       
<loe...@informatik.hu-berlin.de>
  Jun Ma                                                
<ju...@linux.alibaba.com>
  Luis Machado                                  <luis...@br.ibm.com>
...

Are you fine with that?

Thanks,
Martin
From c1a2be909f550b0a820bfd0ae857cf667faba2d1 Mon Sep 17 00:00:00 2001
From: Martin Liska <mli...@suse.cz>
Date: Mon, 10 Jan 2022 16:49:31 +0100
Subject: [PATCH] Check sorting of MAINTAINERS.

contrib/ChangeLog:

	* check-MAINTAINERS.py: New file.
---
 contrib/check-MAINTAINERS.py | 110 +++++++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+)
 create mode 100755 contrib/check-MAINTAINERS.py

diff --git a/contrib/check-MAINTAINERS.py b/contrib/check-MAINTAINERS.py
new file mode 100755
index 00000000000..860b8ca95e8
--- /dev/null
+++ b/contrib/check-MAINTAINERS.py
@@ -0,0 +1,110 @@
+#!/usr/bin/env python3
+
+# Copyright (C) 2022 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.
+
+import locale
+import sys
+from difflib import ndiff
+from itertools import dropwhile, takewhile
+
+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 sort_by_surname(line):
+    name = line.split('\t')[0]
+    parts = name.split()
+    surname = parts[-1]
+
+    # Special-case some names
+    if name == 'Stefan Schulze Frielinghaus':
+        surname = parts[1]
+    elif name == 'Kris Van Hees':
+        surname = parts[1]
+    elif surname == "d'Humieres":
+        surname = 'Humieres'
+
+    return (surname, line)
+
+
+def has_tab(line):
+    return '\t' in line
+
+
+def is_empty(line):
+    return line
+
+
+def check_group(name, lines):
+    global exit_code
+
+    for line in lines:
+        if line.startswith(' '):
+            print(f'Line should not start with space: "{line}"')
+            exit_code = 2
+
+    lines = [line + '\n' for line in lines]
+    sorted_lines = sorted(lines, key=sort_by_surname)
+    if lines != sorted_lines:
+        exit_code = 1
+        diff = ndiff(lines, sorted_lines)
+        print(f'Wrong order for {name}:\n')
+        print(''.join(diff))
+    else:
+        print(f'{name} are fine!')
+
+
+lines = open('MAINTAINERS').read().splitlines()
+
+needle = 'Global Reviewers'
+lines = list(dropwhile(lambda x: x.strip() != needle, lines))
+lines = lines[2:]
+
+chunk = list(takewhile(is_empty, lines))
+check_group(needle, chunk)
+
+needle = 'Write After Approval'
+lines = list(dropwhile(lambda x: needle not in x, lines))
+lines = lines[2:]
+
+chunk = list(takewhile(is_empty, lines))
+check_group(needle, chunk)
+
+needle = 'Bug database only accounts'
+lines = list(dropwhile(lambda x: needle not in x, lines))
+lines = lines[2:]
+
+chunk = list(takewhile(is_empty, lines))
+check_group(needle, chunk)
+
+needle = 'Contributing under the DCO'
+lines = list(dropwhile(lambda x: needle not in x, lines))[1:]
+lines = list(dropwhile(lambda x: not has_tab(x), lines))
+check_group(needle, lines)
+
+sys.exit(exit_code)
-- 
2.34.1

Reply via email to