]> git.donarmstrong.com Git - debbugs.git/blob - cgi/pkgindex.cgi
[project @ 2000-11-16 05:58:44 by ajt]
[debbugs.git] / cgi / pkgindex.cgi
1 #!/usr/bin/perl -wT
2
3 package debbugs;
4
5 use strict;
6 use POSIX qw(strftime tzset nice);
7
8 #require '/usr/lib/debbugs/errorlib';
9 require '/usr/lib/debbugs/common.pl';
10 #require '/debian/home/ajt/newajbug/common.pl';
11
12 require '/etc/debbugs/config';
13 require '/etc/debbugs/text';
14
15 nice(5);
16
17 my %param = readparse();
18
19 my $indexon = $param{'indexon'} || 'pkg';
20 if ($indexon !~ m/^(pkg|maint|submitter)/) {
21     quit("You have to choose something to index on");
22 }
23
24 my $repeatmerged = ($param{'repeatmerged'} || "yes") eq "yes";
25 my $archive = ($param{'archive'} || "no") eq "yes";
26 #my $include = $param{'include'} || "";
27 #my $exclude = $param{'exclude'} || "";
28
29 my $Archived = $archive ? "Archived" : "";
30
31 my %maintainer = &getmaintainers();
32 my %strings = ();
33
34 $ENV{"TZ"} = 'UTC';
35 tzset();
36
37 my $dtime = strftime "%a, %e %b %Y %T UTC", localtime;
38 my $tail_html = $debbugs::gHTMLTail;
39 $tail_html = $debbugs::gHTMLTail;
40 $tail_html =~ s/SUBSTITUTE_DTIME/$dtime/;
41
42 set_option("repeatmerged", $repeatmerged);
43 set_option("archive", $archive);
44 set_option("include", { map {($_,1)} (split /[\s,]+/, $include) })
45         if ($include);
46 set_option("exclude", { map {($_,1)} (split /[\s,]+/, $exclude) })
47         if ($exclude);
48
49 my %count;
50 my $tag;
51 my $note;
52 if ($indexon eq "pkg") {
53   $tag = "package";
54   %count = countbugs(sub {my %d=@_; return $d{"pkg"}});
55   $note = "<p>Note that with multi-binary packages there may be other\n";
56   $note .= "reports filed under the different binary package names.</p>\n";
57 } elsif ($indexon eq "maint") {
58   $tag = "maintainer";
59   %@count = countbugs(sub {my %d=@_; my $me; 
60                            $me = $maintainers{$d{"pkg"}} || "";
61                            $me =~ s/\s*\(.*\)\s*//;
62                            $me = $1 if ($me =~ m/<(.*)>/);
63                            return $me;
64                          });
65   $note = "<p>Note that maintainers may use different Maintainer fields for\n";
66   $note .= "different packages, so there may be other reports filed under\n";
67   $note .= "different addresses.</p>\n";
68 } elsif ($indexon eq "submitter") {
69   $tag = "submitter";
70   %count = countbugs(sub {my %d=@_; my $se; 
71                           ($se = $d{"submitter"} || "") =~ s/\s*\(.*\)\s*//;
72                           if ($se =~ m/<(.*)>/) { $me = $1 }
73                           return $se;
74                         });
75   $note = "<p>Note that people may use different email accounts for\n";
76   $note .= "different bugs, so there may be other reports filed under\n";
77   $note .= "different addresses.</p>\n";
78 }
79
80 my $result = "<ul>\n";
81 foreach my $x (sort keys %count) {
82   $result .= sprintf('<li><a href="pkgreport.cgi?%s=%s">%s</a> %d bugs</li>\n',
83                      $indexon, $x, $x, $count{$x});
84 }
85 $result .= "</ul>\n";
86
87 print "Content-Type: text/html\n\n";
88
89 print "<HTML><HEAD><TITLE>\n" . 
90     "$debbugs::gProject $Archived $debbugs::gBug reports by $tag\n" .
91     "</TITLE></HEAD>\n" .
92     '<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#800080">' .
93     "\n";
94 print "<H1>" . "$debbugs::gProject $Archived $debbugs::gBug report logs: $tag" .
95       "</H1>\n";
96
97 print $note;
98 print $result;
99
100 print "<hr>\n";
101 print "$tail_html";
102
103 print "</body></html>\n";