2 # $Id: summary.in,v 1.5 2001/08/19 02:09:18 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-h") || &quit("opendir db: $!\n");
38 @dirs = sort { $a <=> $b } grep(s,^,db-h/,, grep(m/^\d+$/,readdir(DIR)));
40 foreach my $dir (@dirs) {
42 push @list, sort { $a <=> $b } grep(s/\.status$//,grep(m/^\d+\.status$/,readdir(DIR)));
46 $head= $mode eq 'bymaint'
47 ? ' Package Ref Subject'
48 : ' Ref Package Keywords/Subject Package maintainer';
51 while (length($f=shift(@list))) {
52 if (!lockreadbug($f)) { next; }
53 chop($s_originator= <S>);
55 chop($s_subject= <S>);
57 chop($s_package= <S>);
58 chop($s_keywords= <S>);
60 chop($s_forwarded= <S>);
61 $_= $s_package; y/A-Z/a-z/; $_= $` if m/[^-+._a-z0-9]/;
63 defined($maintainer{$_}) ? $maintainer{$_} :
64 length($_) ? "(unknown -- \`$_')" :
66 if ($mode eq 'undone' || $mode eq 'veryold') {
68 next if length($s_done) || length($s_forwarded);
69 $cmonths= int(($startdate - $s_date)/2592000); # 3600*24*30 (30 days)
70 next if $mode eq 'veryold' && $cmonths < 2;
71 if ($cmonths != $amonths) {
72 $msg= $cmonths == 0 ? "Submitted in the last month" :
73 $cmonths == 1 ? "Over one month old" :
74 $cmonths == 2 ? "Over two months old - attention is required" :
75 "OVER $cmonths MONTHS OLD - ATTENTION IS REQUIRED";
76 print "\n$msg:\n$head\n";
79 printf("%6d %-10.10s %-30.30s %-.31s\n", $f, $s_package,
80 (length($s_keywords) ? $s_keywords.'/' : '').$s_subject,
81 $s_maintainer) || &quit("output undone: $!");
82 } elsif ($mode eq 'bymaint') {
84 next if length($s_done) || length($s_forwarded);
86 sprintf(" %-10.10s %6d %-.59s\n", $s_package, $f, $s_subject);
87 $s_maintainer= "(unknown)" if $s_maintainer =~ m/^\(unknown \-\-/;
88 $maintainercnt{$s_maintainer}++;
89 $maintainerlist{$s_maintainer}.= " $f";
91 &quit("badmode $mode");
95 if ($mode eq 'bymaint') {
96 print("$head\n") || &quit("output head: $!");
97 for $m (sort { $maintainercnt{$a} <=> $maintainercnt{$b} } keys %maintainercnt) {
98 printf("\n%s (%d $gBugs):\n",$m,$maintainercnt{$m})
99 || &quit("output mainthead: $!");
100 for $i (sort { $string{$a} cmp $string{$b} } split(/ /,$maintainerlist{$m})) {
101 printf($string{$i}) || &quit("output 1bymaint: $!");
106 close(STDOUT) || &quit("close stdout: $!");