6 use POSIX qw(strftime tzset nice);
8 #require '/usr/lib/debbugs/errorlib';
9 #require '/usr/lib/debbugs/common.pl';
10 require '/debian/home/ajt/newajbug/common.pl';
12 require '/etc/debbugs/config';
13 require '/etc/debbugs/text';
17 my %param = readparse();
19 my $indexon = $param{'indexon'} || 'pkg';
20 if ($indexon !~ m/^(pkg|maint|submitter)$/) {
21 quit("You have to choose something to index on");
24 my $repeatmerged = ($param{'repeatmerged'} || "yes") eq "yes";
25 my $archive = ($param{'archive'} || "no") eq "yes";
26 my $sortby = $param{'sortby'} || 'alpha';
27 if ($sortby !~ m/^(alpha|count)$/) {
28 quit("Don't know how to sort like that");
31 #my $include = $param{'include'} || "";
32 #my $exclude = $param{'exclude'} || "";
34 my $Archived = $archive ? "Archived" : "";
36 my %maintainers = &getmaintainers();
42 my $dtime = strftime "%a, %e %b %Y %T UTC", localtime;
43 my $tail_html = $debbugs::gHTMLTail;
44 $tail_html = $debbugs::gHTMLTail;
45 $tail_html =~ s/SUBSTITUTE_DTIME/$dtime/;
47 set_option("repeatmerged", $repeatmerged);
48 set_option("archive", $archive);
49 #set_option("include", { map {($_,1)} (split /[\s,]+/, $include) })
51 #set_option("exclude", { map {($_,1)} (split /[\s,]+/, $exclude) })
59 if ($indexon eq "pkg") {
61 %count = countbugs(sub {my %d=@_; return $d{"pkg"}});
62 $note = "<p>Note that with multi-binary packages there may be other\n";
63 $note .= "reports filed under the different binary package names.</p>\n";
64 foreach my $pkg (keys %count) {
65 $sortkey{$pkg} = lc $pkg;
66 $htmldescrip{$pkg} = sprintf('<a href="%s">%s</a> '
67 . '(maintainer: <a href="%s">%s</a>)',
70 mainturl($maintainers{$pkg}),
71 htmlsanit($maintainers{$pkg} || "(unknown)"));
73 } elsif ($indexon eq "maint") {
75 %count = countbugs(sub {my %d=@_;
76 return emailfromrfc822($maintainers{$d{"pkg"}} || "");
78 $note = "<p>Note that maintainers may use different Maintainer fields for\n";
79 $note .= "different packages, so there may be other reports filed under\n";
80 $note .= "different addresses.</p>\n";
82 for my $x (values %maintainers) {
83 my $y = emailfromrfc822($x);
84 $email2maint{$y} = $x unless (defined $email2maint{$y});
86 foreach my $maint (keys %count) {
87 $sortkey{$maint} = lc $email2maint{$maint} || "(unknown)";
88 $htmldescrip{$maint} = sprintf('<a href="%s">%s</a>',
90 htmlsanit($email2maint{$maint}) || "(unknown)")
92 } elsif ($indexon eq "submitter") {
95 %count = countbugs(sub {my %d=@_; my $f = $d{"submitter"} || "";
96 my $em = emailfromrfc822($f);
97 $fullname{$em} = $f if (!defined $fullname{$em});
100 foreach my $sub (keys %count) {
101 $sortkey{$sub} = lc $fullname{$sub};
102 $htmldescrip{$sub} = sprintf('<a href="%s">%s</a>',
104 htmlsanit($fullname{$sub}));
106 $note = "<p>Note that people may use different email accounts for\n";
107 $note .= "different bugs, so there may be other reports filed under\n";
108 $note .= "different addresses.</p>\n";
111 my $result = "<ul>\n";
113 if ($sortby eq "count") {
114 @orderedentries = sort { $count{$a} <=> $count{$b} } keys %count;
115 } else { # sortby alpha
116 @orderedentries = sort { $sortkey{$a} cmp $sortkey{$b} } keys %count;
118 foreach my $x (@orderedentries) {
119 $result .= "<li>" . $htmldescrip{$x} . " has $count{$x} " .
120 ($count{$x} == 1 ? "bug" : "bugs") . "</li>\n";
122 $result .= "</ul>\n";
124 print "Content-Type: text/html\n\n";
126 print "<HTML><HEAD><TITLE>\n" .
127 "$debbugs::gProject $Archived $debbugs::gBug reports by $tag\n" .
128 "</TITLE></HEAD>\n" .
129 '<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#800080">' .
131 print "<H1>" . "$debbugs::gProject $Archived $debbugs::gBug report logs by $tag" .
140 print "</body></html>\n";