Debian Codegraph @

helper/sort-maint

raw
1 #! /usr/bin/perl
2 use warnings;
3 use strict;
4 use integer;
5 use FindBin;
6 use lib $FindBin::RealBin;
7 use Def;
8 use Alpha;
9
10 # This helper script sorts and checks the maint.txt file. It acts as a
11 # filter, accepting the old maint.txt on stdin, printing the new
12 # maint.txt on stdout.
13
14 my $pat_mnstd = qr/^.{1,${Def::n_init}} .{1,${Def::n_last}}$/;
15
16 $/ = '';
17 my %mnlong; # long-form maintainer names
18 my %mnstd ; # debram-standard short-form maintainer names
19 while ( <> ) {
20 my @c = grep { /\S/ } split '\n';
21 my $mnstd = shift @c;
22 $mnstd =~ $pat_mnstd or die "$0: bad std maint name $mnstd\n";
23 $mnstd{$mnstd} and die "$0: std maint name $mnstd given twice\n";
24 for ( @c ) {
25 defined $mnlong{$_}
26 and die "$0: long maint name $_ given twice\n";
27 $mnlong{$_} = $mnstd;
28 }
29 $mnstd{$mnstd} = [ sort @c ];
30 } <>;
31 for my $mnstd ( sort { Alpha::cmp_std_mn $a, $b } keys %mnstd ) {
32 print "$mnstd\n";
33 print "$_\n" for @{ $mnstd{$mnstd} };
34 print "\n";
35 }
36