Message ID | 338956f1-b353-1dc6-4652-5e6192175615@suse.cz |
---|---|
State | New |
Headers | show |
Series | Check sorting of MAINTAINERS | expand |
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 <cchavva@redhat.com>
Dehao Chen <dehao@google.com>
- Fabien Chêne <fabien@gcc.gnu.org>
Clément Chigot <clement.chigot@atos.net>
Harshit Chopra <harshit@google.com>
Tamar Christina <tamar.christina@arm.com>
Eric Christopher <echristo@gmail.com>
+ Fabien Chêne <fabien@gcc.gnu.org>
Paul Clarke <pc@us.ibm.com>
William Cohen <wcohen@redhat.com>
Michael Collison <michael.collison@arm.com>
Josh Conner <joshconner@google.com>
R. Kelley Cook <kcook@gcc.gnu.org>
Alex Coplan <alex.coplan@arm.com>
Andrea Corallo <andrea.corallo@arm.com>
Christian Cornelssen <ccorn@cs.tu-berlin.de>
Ludovic Courtès <ludo@gnu.org>
Lawrence Crowl <crowl@google.com>
Ian Dall <ian@beware.dropbear.id.au>
David Daney <david.daney@caviumnetworks.com>
Robin Dapp <rdapp@linux.ibm.com>
Simon Dardis <simon.dardis@gmail.com>
Sudakshina Das <sudi.das@arm.com>
Bud Davis <jmdavis@link.com>
Chris Demetriou <cgd@google.com>
Sameera Deshpande <sameera.deshpande@linaro.org>
Wilco Dijkstra <wdijkstr@arm.com>
Benoit Dupont de Dinechin <benoit.dupont-de-dinechin@st.com>
Jason Eckhardt <jle@rice.edu>
Bernd Edlinger <bernd.edlinger@hotmail.de>
Phil Edwards <pme@gcc.gnu.org>
Mark Eggleston <mark.eggleston@codethink.co.uk>
Steve Ellcey <sellcey@caviumnetworks.com>
Mohan Embar <gnustuff@thisiscool.com>
Revital Eres <eres@il.ibm.com>
Marc Espie <espie@cvs.openbsd.org>
Ansgar Esztermann <ansgar@thphy.uni-duesseldorf.de>
Doug Evans <dje@google.com>
Chris Fairles <cfairles@gcc.gnu.org>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
Changpeng Fang <changpeng.fang@amd.com>
David Faust <david.faust@oracle.com>
Li Feng <nemokingdom@gmail.com>
Thomas Fitzsimmons <fitzsim@redhat.com>
Alexander Fomin <afomin.mailbox@gmail.com>
Brian Ford <ford@vss.fsi.com>
John Freeman <jfreeman08@gmail.com>
Nathan Froyd <froydnj@gcc.gnu.org>
Chao-ying Fu <fu@mips.com>
Gary Funck <gary@intrepid.com>
Pompapathi V Gadad <Pompapathi.V.Gadad@nsc.com>
Eric Gallager <egall@gwmail.gwu.edu>
Gopalasubramanian Ganesh <Ganesh.Gopalasubramanian@amd.com>
Kaveh Ghazi <ghazi@gcc.gnu.org>
Doug Gilmore <Doug.Gilmore@imgtec.com>
Matthew Gingell <gingell@gnat.com>
Jan-Benedict Glaw <jbglaw@lug-owl.de>
Marc Glisse <marc.glisse@inria.fr>
Prachi Godbole <prachi.godbole@imgtec.com>
Torbjorn Granlund <tege@swox.com>
James Greenhalgh <james.greenhalgh@arm.com>
Doug Gregor <doug.gregor@gmail.com>
Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
Yury Gribov <tetra2005@gmail.com>
Jon Grimm <jgrimm2@us.ibm.com>
Laurent Guerby <laurent@guerby.net>
Haochen Gui <guihaoc@gcc.gnu.org>
Jiufu Guo <guojiufu@linux.ibm.com>
Xuepeng Guo <terry.xpguo@gmail.com>
Wei Guozhi <carrot@google.com>
+ Naveen H.S <naveenh@marvell.com>
Mostafa Hagog <hagog@gcc.gnu.org>
Andrew Haley <aph@redhat.com>
Frederik Harwath <frederik@codesourcery.com>
Stuart Hastings <stuart@apple.com>
Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Pat Haugen <pthaugen@us.ibm.com>
Michael Hayes <m.hayes@elec.canterbury.ac.nz>
Alan Hayward <alan.hayward@arm.com>
Li Jia He <helijia@gcc.gnu.org>
Mark Heffernan <meheff@google.com>
George Helffrich <george@gcc.gnu.org>
Daniel Hellstrom <daniel@gaisler.com>
Fergus Henderson <fjh@cs.mu.oz.au>
Stuart Henderson <shenders@gcc.gnu.org>
Marius Hillenbrand <mhillen@linux.ibm.com>
Matthew Hiller <hiller@redhat.com>
Kazu Hirata <kazu@codesourcery.com>
Manfred Hollstein <mh@suse.com>
Cong Hou <congh@google.com>
Falk Hueffner <falk@debian.org>
Andrew John Hughes <gnu_andrew@member.fsf.org>
Dominique d'Humieres <dominiq@lps.ens.fr>
Andy Hutchinson <hutchinsonandy@aim.com>
Joel Hutton <joel.hutton@arm.com>
Lewis Hyatt <lhyatt@gmail.com>
- Naveen H.S <naveenh@marvell.com>
Roland Illig <roland.illig@gmx.de>
Meador Inge <meadori@codesourcery.com>
Bernardo Innocenti <bernie@develer.com>
Mihail Ionescu <mihail.ionescu@arm.com>
Vladislav Ivanishin <vlad@ispras.ru>
Alexander Ivchenko <aivchenk@gmail.com>
Balaji V. Iyer <bviyer@gmail.com>
- Pekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
Daniel Jacobowitz <drow@false.org>
Andreas Jaeger <aj@suse.de>
Harsha Jagasia <harsha.jagasia@amd.com>
Fariborz Jahanian <fjahanian@apple.com>
Qian Jianhua <qianjh@cn.fujitsu.com>
Janis Johnson <janis.marie.johnson@gmail.com>
Teresa Johnson <tejohnson@google.com>
Kean Johnston <jkj@sco.com>
Phillip Jordan <phillip.m.jordan@gmail.com>
Tim Josling <tej@melbpc.org.au>
+ Pekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
Victor Kaplansky <victork@il.ibm.com>
Geoffrey Keating <geoffk@geoffk.org>
Brendan Kehoe <brendan@zen.org>
Andi Kleen <andi@firstfloor.org>
Matthias Klose <doko@debian.org>
Jeff Knaggs <jknaggs@redhat.com>
Michael Koch <konqueror@gmx.de>
Nicolas Koenig <koenigni@student.ethz.ch>
Boris Kolpackov <boris@codesynthesis.com>
Dave Korn <dave.korn.cygwin@gmail.com>
Julia Koval <julia.koval@intel.com>
Matt Kraai <kraai@ftbfs.org>
Jan Kratochvil <jan.kratochvil@redhat.com>
Matthias Kretz <m.kretz@gsi.de>
Louis Krupp <louis.krupp@zoho.com>
Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Venkataramanan Kumar <venkataramanan.kumar@amd.com>
Doug Kwan <dougkwan@google.com>
Scott Robert Ladd <scott.ladd@coyotegulch.com>
Razya Ladelsky <razya@gcc.gnu.org>
Thierry Lafage <thierry.lafage@inria.fr>
+ Aaron W. LaFramboise <aaronavay62@aaronwl.com>
Rask Ingemann Lambertsen <ccc94453@vip.cybercity.dk>
Jerome Lambourg <lambourg@adacore.com>
- Aaron W. LaFramboise <aaronavay62@aaronwl.com>
Asher Langton <langton2@llnl.gov>
Chris Lattner <sabre@nondot.org>
Terry Laurenzo <tlaurenzo@gmail.com>
Alan Lawrence <alan.lawrence@arm.com>
Jozef Lawrynowicz <jozef.l@mittosystems.com>
Georg-Johann Lay <avr@gjlay.de>
Vlad Lazar <vlad.lazar@arm.com>
Marc Lehmann <pcg@goof.com>
James Lemke <jim@lemke.org>
Ilya Leoshkevich <iii@linux.ibm.com>
Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Renlin Li <renlin.li@arm.com>
Xinliang David Li <davidxl@google.com>
Kewen Lin <linkw@gcc.gnu.org>
Chen Liqin <liqin.gcc@gmail.com>
Jiangning Liu <jiangning.liu@arm.com>
Sa Liu <saliu@de.ibm.com>
Ralph Loader <rcl@ihug.co.nz>
Sheldon Lobo <sheldon.lobo@oracle.com
Gabor Loki <loki@inf.u-szeged.hu>
- Manuel López-Ibáñez <manu@gcc.gnu.org>
Carl Love <cel@us.ibm.com>
- Martin v. Löwis <loewis@informatik.hu-berlin.de>
H.J. Lu <hjl.tools@gmail.com>
Xiong Hu Luo <luoxhu@linux.vnet.ibm.com>
Bin Bin Lv <shlb@linux.ibm.com>
Christophe Lyon <christophe.lyon@st.com>
+ Manuel López-Ibáñez <manu@gcc.gnu.org>
+ Martin v. Löwis <loewis@informatik.hu-berlin.de>
Jun Ma <junma@linux.alibaba.com>
Luis Machado <luisgpm@br.ibm.com>
...
Are you fine with that?
Thanks,
Martin
On Tue, Jan 11, 2022 at 10:27:19AM +0100, Martin Liška wrote: > 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: I'm still surprised by what the sort is doing, ( echo Chene; echo Chêne; echo Chfne ) | LC_ALL=en_US.UTF-8 sort Chene Chêne Chfne That is on glibc 2.32. On glibc 2.34.9000 I get a different order though, Chêne last. That partly ruins the idea of the checking script when the sorting isn't the same for many people, either the script will be failing for many people or various people will be changing the order there and back all the time. Jakub
On 10.01.22 17:14, Martin Liška wrote: > Are you fine with the suggested changes? I don't feel strong and having some automatic sorting is nice. But ut as a human, I note: > + Kris Van Hees <kris.van.hees@oracle.com> > - Dominique d'Humieres <dominiq@lps.ens.fr> Sorting 'Van Hees' under 'H' and 'd'Humieres' under 'd' feels inconsistent - I'd either expected both under 'H' or both under 'd'/'V'. Currently "d'H" is under "H" and "Van H" under "V", with your patch "d'H" is under "d" and "Van H" under "H". But I admit that that's not clear and whether something like de/von/van/Van is regarded as part of the family name for sorting or not . (Not to talk about names like "Christophe Cartier Dit Moulin", which I would sort under 'C(artier)'.) > Christophe Lyon <christophe.lyon@st.com> > + Manuel López-Ibáñez <manu@gcc.gnu.org> > + Martin v. Löwis <loewis@informatik.hu-berlin.de> Somehow it feels odd to have the accented version after 'z' – it feels more natural just to ignore the accent and order 'ó' and 'ö' after 'o' and not after 'z'. Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
On 1/11/22 10:45, Tobias Burnus wrote: > On 10.01.22 17:14, Martin Liška wrote: >> Are you fine with the suggested changes? > > I don't feel strong and having some automatic sorting is nice. But ut as > a human, I note: > >> + Kris Van Hees <kris.van.hees@oracle.com> >> - Dominique d'Humieres <dominiq@lps.ens.fr> > > Sorting 'Van Hees' under 'H' and 'd'Humieres' under 'd' feels > inconsistent - I'd either expected both under 'H' or both under 'd'/'V'. Well, I just respect how the authors feel to be sorted: Van Hees - under 'V' d'Humieres - under H > > Currently "d'H" is under "H" and "Van H" under "V", with your patch > "d'H" is under "d" and "Van H" under "H". I fixed that in the updated version, please take a look. > > But I admit that that's not clear and whether something like > de/von/van/Van is regarded as part of the family name for sorting or not > . (Not to talk about names like "Christophe Cartier Dit Moulin", which I > would sort under 'C(artier)'.) That's why I added a few exceptions in order to respect their wish. > >> Christophe Lyon <christophe.lyon@st.com> >> + Manuel López-Ibáñez <manu@gcc.gnu.org> >> + Martin v. Löwis <loewis@informatik.hu-berlin.de> > > Somehow it feels odd to have the accented version after 'z' – it feels > more natural just to ignore the accent and order 'ó' and 'ö' after 'o' > and not after 'z'. That's what Jakub is speaking about, I was also surprised about the sorting. Martin > > Tobias > > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
On 1/11/22 10:38, Jakub Jelinek wrote: > That is on glibc 2.32. On glibc 2.34.9000 I get a different order though, > Chêne last. Heh, that's definitely surprising. Can you raise an issue against Glibc so that we can discuss it? Thanks, Martin
On 1/11/22 10:38, Jakub Jelinek wrote: > On Tue, Jan 11, 2022 at 10:27:19AM +0100, Martin Liška wrote: >> 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: > > I'm still surprised by what the sort is doing, > ( echo Chene; echo Chêne; echo Chfne ) | LC_ALL=en_US.UTF-8 sort > Chene > Chêne > Chfne > That is on glibc 2.32. On glibc 2.34.9000 I get a different order though, > Chêne last. > That partly ruins the idea of the checking script when the sorting isn't > the same for many people, either the script will be failing for many people > or various people will be changing the order there and back all the time. > > Jakub > Or we can utilize https://pypi.org/project/Unidecode python package that provides: In [7]: unidecode.unidecode('Jääskeläinen') Out[7]: 'Jaaskelainen' and sort it by that. Martin
On 1/11/22 11:05, Martin Liška wrote: > On 1/11/22 10:38, Jakub Jelinek wrote: >> On Tue, Jan 11, 2022 at 10:27:19AM +0100, Martin Liška wrote: >>> 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: >> >> I'm still surprised by what the sort is doing, >> ( echo Chene; echo Chêne; echo Chfne ) | LC_ALL=en_US.UTF-8 sort >> Chene >> Chêne >> Chfne >> That is on glibc 2.32. On glibc 2.34.9000 I get a different order though, >> Chêne last. >> That partly ruins the idea of the checking script when the sorting isn't >> the same for many people, either the script will be failing for many people >> or various people will be changing the order there and back all the time. >> >> Jakub >> > > Or we can utilize https://pypi.org/project/Unidecode python package that provides: > > In [7]: unidecode.unidecode('Jääskeläinen') > Out[7]: 'Jaaskelainen' > > and sort it by that. > > Martin I'm going to push the change and re-order 2 names and we should be done. Martin
Hi! On 2022-01-10T17:14:00+0100, Martin Liška <mliska@suse.cz> wrote: > The script is capable of checking if MAINTAINER names are sorted > alphabetically. Irrespective of the pre-existing issue that a concept of a first and a last name doesn't exist in all cultures, and thus sorting by the latter is questionable, there also seems to be some Python syntax issue here: Running [...]/source-gcc/gcc/testsuite/gcc.src/maintainers.exp ... Executing on host: python3 --version (timeout = 300) spawn python3 --version Python 3.4.3 Executing on host: [...]/source-gcc/gcc/testsuite/../../contrib/check-MAINTAINERS.py [...]/source-gcc/gcc/testsuite/../../MAINTAINERS (timeout = 300) spawn [...]/source-gcc/gcc/testsuite/../../contrib/check-MAINTAINERS.py [...]/source-gcc/gcc/testsuite/../../MAINTAINERS File "[...]/source-gcc/gcc/testsuite/../../contrib/check-MAINTAINERS.py", line 71 print(f'Line should not start with space: "{line}"') ^ SyntaxError: invalid syntax 1 { File "[...]/source-gcc/gcc/testsuite/../../contrib/check-MAINTAINERS.py", line 71 print(f'Line should not start with space: "{line}"') ^ SyntaxError: invalid syntax } FAIL: check-MAINTAINERS.py Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
On 1/18/22 08:59, Thomas Schwinge wrote: > Hi! > > On 2022-01-10T17:14:00+0100, Martin Liška <mliska@suse.cz> wrote: >> The script is capable of checking if MAINTAINER names are sorted >> alphabetically. > > Irrespective of the pre-existing issue that a concept of a first and a > last name doesn't exist in all cultures, and thus sorting by the latter Sure, but most of them do have. And for the rest, we can add exceptions. > is questionable, there also seems to be some Python syntax issue here: > > Running [...]/source-gcc/gcc/testsuite/gcc.src/maintainers.exp ... > Executing on host: python3 --version (timeout = 300) > spawn python3 --version > Python 3.4.3 > Executing on host: [...]/source-gcc/gcc/testsuite/../../contrib/check-MAINTAINERS.py [...]/source-gcc/gcc/testsuite/../../MAINTAINERS (timeout = 300) > spawn [...]/source-gcc/gcc/testsuite/../../contrib/check-MAINTAINERS.py [...]/source-gcc/gcc/testsuite/../../MAINTAINERS > File "[...]/source-gcc/gcc/testsuite/../../contrib/check-MAINTAINERS.py", line 71 > print(f'Line should not start with space: "{line}"') > ^ > SyntaxError: invalid syntax > 1 { File "[...]/source-gcc/gcc/testsuite/../../contrib/check-MAINTAINERS.py", line 71 > print(f'Line should not start with space: "{line}"') > ^ > SyntaxError: invalid syntax > } > FAIL: check-MAINTAINERS.py Ohh, an old Python 3 version. I'm going to fix it with the following patch. Martin > > > Grüße > Thomas > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
diff --git a/contrib/check-MAINTAINERS.py b/contrib/check-MAINTAINERS.py new file mode 100755 index 00000000000..70aa375846b --- /dev/null +++ b/contrib/check-MAINTAINERS.py @@ -0,0 +1,100 @@ +#!/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): + parts = line.split('\t') + surname = parts[0].split()[-1] + 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)