On 08/02/15 19:40, Bernhard Voelker wrote: > * Makefile.am (sort-THANKS.in): Add target to sort the name/email pair > list in 'THANKS.in'. > * THANKS.in: Sort via the above new target. > * cfg.mk (sc_THANKS_in_sorted): Add rule to ensure that 'THANKS.in' > remains sorted. > --- > Makefile.am | 15 +++++++++++++++ > THANKS.in | 56 ++++++++++++++++++++++++++++---------------------------- > cfg.mk | 11 +++++++++++ > 3 files changed, 54 insertions(+), 28 deletions(-) > > diff --git a/Makefile.am b/Makefile.am > index cf0c8a0..e3a4354 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -172,6 +172,21 @@ THANKS: THANKS.in Makefile.am .mailmap thanks-gen > .version > printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:; \ > } > $@-t && chmod a-w $@-t && mv $@-t $@ > > +# Sort the contributor name/email pair list in 'THANKS.in'. > +# See sc_THANKS_in_sorted ... which uses the same sort options. > +.PHONY: sort-THANKS.in > +sort-THANKS.in: Makefile.am > + $(AM_V_GEN)rm -f $@-t; \ > + { \ > + sed '/^$$/q' THANKS.in \ > + && { sed '/^$$/,/^$$/!d;/^$$/d' THANKS.in \ > + | LC_ALL='en_US.UTF-8' sort -f -k1,1; } \ > + && echo \ > + && sed '0,/^$$/d;0,/^$$/d' THANKS.in; \ > + } > $@-t \ > + && test "$$(wc < THANKS.in)" = "$$(wc < $@-t)" \ > + && mv $@-t THANKS.in
This separate target is probably overkill, as THANKS.in should remain sorted due to the sc_ rule. > diff --git a/cfg.mk b/cfg.mk > index f5be6de..26df247 100644 > --- a/cfg.mk > +++ b/cfg.mk > @@ -611,6 +611,17 @@ sc_THANKS_in_duplicates: > && { echo '$(ME): remove the above names from THANKS.in' \ > 1>&2; exit 1; } || : > > +# Ensure the contributor list stays sorted. The sort order can be fixed > +# with 'make sort-THANKS.in' ... which uses the same sort options. > +sc_THANKS_in_sorted: > + @sed '/^$$/,/^$$/!d;/^$$/d' THANKS.in > $@.1; \ > + LC_ALL='en_US.UTF-8' sort -f -k1,1 $@.1 > $@.2 > + @diff -u $@.1 $@.2; diff=$$?; \ > + rm -f $@.1 $@.2; \ > + test "$$diff" = 0 \ > + || { echo '$(ME): THANKS.in is unsorted; please run' \ > + 'make sort-THANKS.in' 1>&2; exit 1; } > + I don't like the sorting in this locale at all. Actually the locale is OK, just the sorting in the patch seems to have been done in LC_ALL=C ? $ printf '%s\n' Duncan Dániel Gaël Gary Ørn Oskar | LC_ALL=en_US.utf8 sort Dániel Duncan Gaël Gary Ørn Oskar That locale doesn't work correctly with the only cyrillic entry though: $ printf '%s\n' Марк Michal | LC_ALL=en_US.utf8 sort Michal Марк I'm thinking we should convert that to latin1 (Mark Korenberg) like all other entries. cheers, Pádraig.