File: sort-maint

package info (click to toggle)
debram 1.0.3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,796 kB
  • ctags: 437
  • sloc: perl: 2,953; ansic: 1,901; makefile: 169; sh: 14
file content (36 lines) | stat: -rwxr-xr-x 996 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /usr/bin/perl
use warnings;
use strict;
use integer;
use FindBin;
use lib $FindBin::RealBin;
use Def;
use Alpha;

# This helper script sorts and checks the maint.txt file.  It acts as a
# filter, accepting the old maint.txt on stdin, printing the new
# maint.txt on stdout.

my $pat_mnstd = qr/^.{1,${Def::n_init}} .{1,${Def::n_last}}$/;

$/ = '';
my %mnlong; # long-form maintainer names
my %mnstd ; # debram-standard short-form maintainer names
while ( <> ) {
    my @c = grep { /\S/ } split '\n';
    my $mnstd = shift @c;
    $mnstd =~ $pat_mnstd or die "$0: bad std maint name $mnstd\n";
    $mnstd{$mnstd} and die "$0: std maint name $mnstd given twice\n";
    for ( @c ) {
        defined $mnlong{$_}
            and die "$0: long maint name $_ given twice\n";
        $mnlong{$_} = $mnstd;
    }
    $mnstd{$mnstd} = [ sort @c ];
} <>;
for my $mnstd ( sort { Alpha::cmp_std_mn $a, $b } keys %mnstd ) {
    print "$mnstd\n";
    print "$_\n" for @{ $mnstd{$mnstd} };
    print "\n";
}