2 # $Id: summary.in,v 1.11 2004/04/17 17:31:04 cjwatson Exp $
4 $config_path = '/etc/debbugs';
5 $lib_path = '/usr/lib/debbugs';
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") || die "open $gMaintainerFile: $!";
19 m/^(\S+)\s+(\S.*\S)\s*$/ || warn "$_ ?";
25 open(M,"$gMaintainerFileOverride") || die "open $gMaintainerFileOverride: $!";
27 m/^(\S+)\s+(\S.*\S)\s*$/ || warn "$_ ?";
35 defined($startdate= time) || die "failed to get time: $!";
37 opendir(DIR,"db-h") || die "opendir db-h: $!\n";
38 @dirs = grep(s,^,db-h/,, grep(m/^\d+$/,readdir(DIR)));
40 foreach my $dir (@dirs) {
42 push @list, grep(s/\.status$//,grep(m/^\d+\.status$/,readdir(DIR)));
45 @list = sort { $a <=> $b } @list;
47 $head= $mode eq 'bymaint'
48 ? ' Package Ref Subject'
49 : ' Ref Package Keywords/Subject Package maintainer';
52 while (length($f=shift(@list))) {
53 if (!($data = lockreadbug($f))) { next; }
54 $_= $data->{package}; y/A-Z/a-z/; $_= $` if m/[^-+._a-z0-9]/;
56 defined($maintainer{$_}) ? $maintainer{$_} :
57 length($_) ? "(unknown -- \`$_')" :
59 if ($mode eq 'undone' || $mode eq 'veryold') {
61 next if length($data->{done}) || length($data->{forwarded});
62 $cmonths= int(($startdate - $data->{date})/2592000); # 3600*24*30 (30 days)
63 next if $mode eq 'veryold' && $cmonths < 2;
64 if ($cmonths != $amonths) {
65 $msg= $cmonths == 0 ? "Submitted in the last month" :
66 $cmonths == 1 ? "Over one month old" :
67 $cmonths == 2 ? "Over two months old - attention is required" :
68 "OVER $cmonths MONTHS OLD - ATTENTION IS REQUIRED";
69 print "\n$msg:\n$head\n";
72 printf("%6d %-10.10s %-30.30s %-.31s\n", $f, $data->{package},
73 (length($data->{keywords}) ? $data->{keywords}.'/' : '').$data->{subject},
74 $data->{maintainer}) || die "output undone: $!";
75 } elsif ($mode eq 'bymaint') {
77 next if length($data->{done}) || length($data->{forwarded});
79 sprintf(" %-10.10s %6d %-.59s\n", $data->{package}, $f, $data->{subject});
80 $data->{maintainer}= "(unknown)" if $data->{maintainer} =~ m/^\(unknown \-\-/;
81 $maintainercnt{$data->{maintainer}}++;
82 $maintainerlist{$data->{maintainer}}.= " $f";
88 if ($mode eq 'bymaint') {
89 print("$head\n") || die "output head: $!";
90 for $m (sort { $maintainercnt{$a} <=> $maintainercnt{$b} } keys %maintainercnt) {
91 printf("\n%s (%d $gBugs):\n",$m,$maintainercnt{$m})
92 || die "output mainthead: $!";
93 for $i (sort { $string{$a} cmp $string{$b} } split(/ /,$maintainerlist{$m})) {
94 printf($string{$i}) || die "output 1bymaint: $!";
99 close(STDOUT) || die "close stdout: $!";