2 # $Id: summary.in,v 1.4 2001/08/16 17:37:01 doogie Exp $
4 $config_path = '/org/bugs.debian.org/etc';
5 $lib_path = '/org/bugs.debian.org/scripts';
7 require("$config_path/config");
8 require("$lib_path/errorlib");
9 $ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
11 chdir("$gSpoolDir") || die "chdir spool: $!\n";
17 open(M,"$gMaintainerFile") || &quit("open $gMaintainerFile: $!");
19 m/^(\S+)\s+(\S.*\S)\s*$/ || warn "$_ ?";
25 open(M,"$gMaintainerFileOverride") || &quit("open $gMaintainerFileOverride: $!");
27 m/^(\S+)\s+(\S.*\S)\s*$/ || warn "$_ ?";
35 defined($startdate= time) || &quit("failed to get time: $!");
37 opendir(DIR,"db") || &quit("opendir db: $!\n");
38 @list= grep(m/^\d+\.status$/,readdir(DIR));
39 grep(s/\.status$//,@list);
40 @list= sort { $a <=> $b } @list;
42 $head= $mode eq 'bymaint'
43 ? ' Package Ref Subject'
44 : ' Ref Package Keywords/Subject Package maintainer';
47 while (length($f=shift(@list))) {
49 if (!open(S,"db/$f.status")) { &unlinklock; next; }
50 chop($s_originator= <S>);
52 chop($s_subject= <S>);
54 chop($s_package= <S>);
55 chop($s_keywords= <S>);
57 chop($s_forwarded= <S>);
58 $_= $s_package; y/A-Z/a-z/; $_= $` if m/[^-+._a-z0-9]/;
60 defined($maintainer{$_}) ? $maintainer{$_} :
61 length($_) ? "(unknown -- \`$_')" :
63 if ($mode eq 'undone' || $mode eq 'veryold') {
65 next if length($s_done) || length($s_forwarded);
66 $cmonths= int(($startdate - $s_date)/2592000); # 3600*24*30 (30 days)
67 next if $mode eq 'veryold' && $cmonths < 2;
68 if ($cmonths != $amonths) {
69 $msg= $cmonths == 0 ? "Submitted in the last month" :
70 $cmonths == 1 ? "Over one month old" :
71 $cmonths == 2 ? "Over two months old - attention is required" :
72 "OVER $cmonths MONTHS OLD - ATTENTION IS REQUIRED";
73 print "\n$msg:\n$head\n";
76 printf("%6d %-10.10s %-30.30s %-.31s\n", $f, $s_package,
77 (length($s_keywords) ? $s_keywords.'/' : '').$s_subject,
78 $s_maintainer) || &quit("output undone: $!");
79 } elsif ($mode eq 'bymaint') {
81 next if length($s_done) || length($s_forwarded);
83 sprintf(" %-10.10s %6d %-.59s\n", $s_package, $f, $s_subject);
84 $s_maintainer= "(unknown)" if $s_maintainer =~ m/^\(unknown \-\-/;
85 $maintainercnt{$s_maintainer}++;
86 $maintainerlist{$s_maintainer}.= " $f";
88 &quit("badmode $mode");
92 if ($mode eq 'bymaint') {
93 print("$head\n") || &quit("output head: $!");
94 for $m (sort { $maintainercnt{$a} <=> $maintainercnt{$b} } keys %maintainercnt) {
95 printf("\n%s (%d $gBugs):\n",$m,$maintainercnt{$m})
96 || &quit("output mainthead: $!");
97 for $i (sort { $string{$a} cmp $string{$b} } split(/ /,$maintainerlist{$m})) {
98 printf($string{$i}) || &quit("output 1bymaint: $!");
103 close(STDOUT) || &quit("close stdout: $!");