3 my $common_archive = 0;
4 my $common_repeatmerged = 1;
8 if ($opt eq "archive") { $common_archive = $val; }
9 if ($opt eq "repeatmerged") { $common_repeatmerged = $val; }
14 print "Content-Type: text/html\n\n";
15 print "<HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY>\n";
16 print "An error occurred. Dammit.\n";
17 print "Error was: $msg.\n";
18 print "</BODY></HTML>\n";
24 # my $Archive = $common_archive ? "archive" : "";
25 # print header . start_html("Sorry");
26 # print "Sorry bug #$msg doesn't seem to be in the $Archive database.\n";
33 my %status = getbugstatus($ref);
34 return htmlindexentrystatus(%status) if (%status);
38 sub htmlindexentrystatus {
44 if ($status{severity} eq 'normal') {
46 } elsif (grep($status{severity} eq $_, @debbugs::gStrongSeverities)) {
47 $showseverity = "<strong>Severity: $status{severity}</strong>;\n";
49 $showseverity = "Severity: <em>$status{severity}</em>;\n";
52 $result .= "Package: <a href=\"" . pkgurl($status{"package"}) . "\">"
53 . "<strong>" . htmlsanit($status{"package"}) . "</strong></a>;\n"
54 if (length($status{"package"}));
55 $result .= $showseverity;
56 $result .= "Reported by: " . htmlsanit($status{originator});
57 $result .= ";\nKeywords: " . htmlsanit($status{keywords})
58 if (length($status{keywords}));
60 my @merged= split(/ /,$status{mergedwith});
61 my $mseparator= ";\nmerged with ";
63 $result .= $mseparator."<A href=\"" . bugurl($m) . "\">#$m</A>";
67 if (length($status{done})) {
68 $result .= ";\n<strong>Done:</strong> " . htmlsanit($status{done});
69 } elsif (length($status{forwarded})) {
70 $result .= ";\n<strong>Forwarded</strong> to "
71 . htmlsanit($status{forwarded});
73 my $daysold = int((time - $status{date}) / 86400); # seconds to days
77 $font = "em" if ($daysold > 30);
78 $font = "strong" if ($daysold > 60);
79 $efont = "</$font>" if ($font);
80 $font = "<$font>" if ($font);
82 my $yearsold = int($daysold / 364);
83 $daysold = $daysold - $yearsold * 364;
85 $result .= ";\n $font";
86 $result .= "1 year and " if ($yearsold == 1);
87 $result .= "$yearsold years and " if ($yearsold > 1);
88 $result .= "1 day old" if ($daysold == 1);
89 $result .= "$daysold days old" if ($daysold != 1);
101 my $params = "maintenc=" . maintencoded($ref);
102 $params .= "&archive=yes" if ($common_archive);
103 $params .= "&repeatmerged=yes" if ($common_repeatmerged);
104 return $debbugs::gCGIDomain . "pkgreport.cgi" . "?" . $params;
109 my $params = "pkg=$ref";
110 $params .= "&archive=yes" if ($common_archive);
111 $params .= "&repeatmerged=yes" if ($common_repeatmerged);
113 return $debbugs::gCGIDomain . "pkgreport.cgi" . "?" . "$params";
117 my %saniarray = ('<','lt', '>','gt', '&','amp', '"','quot');
120 while ($in =~ m/[<>&"]/) {
121 $out .= $`. '&'. $saniarray{$&}. ';';
130 my $params = "bug=$ref";
131 foreach my $val (@_) {
132 $params .= "\&msg=$1" if ($val =~ /^msg=([0-9]+)/);
133 $params .= "\&archive=yes" if (!$common_archive && $val =~ /^archive.*$/);
135 $params .= "&archive=yes" if ($common_archive);
136 $params .= "&repeatmerged=yes" if ($common_repeatmerged);
138 return $debbugs::gCGIDomain . "bugreport.cgi" . "?" . "$params";
143 return $debbugs::gCGIDomain . "package.cgi" . "?" . "package=$ref";
149 opendir(D, "$debbugs::gSpoolDir/db") or &quit("opendir db: $!");
150 @bugs = sort {$a<=>$b} grep s/\.status$//,
151 (grep m/^[0-9]+\.status$/,
163 my %displayshowpending = ("pending", "outstanding",
165 "forwarded", "forwarded to upstream software authors");
168 return "<HR><H2>No reports found!</H2></HR>\n";
171 foreach my $bug (sort {$a<=>$b} @bugs) {
172 my %status = getbugstatus($bug);
174 my @merged = sort {$a<=>$b} ($bug, split(/ /, $status{mergedwith}));
175 if ($common_repeatmerged || $bug == $merged[0]) {
176 $section{$status{pending} . "_" . $status{severity}} .=
177 sprintf "<li><a href=\"%s\">#%d: %s</a>\n<br>",
178 bugurl($bug), $bug, htmlsanit($status{subject});
179 $section{$status{pending} . "_" . $status{severity}} .=
180 htmlindexentrystatus(\%status) . "\n";
186 foreach my $pending (qw(pending forwarded done)) {
187 foreach my $severity(@debbugs::gSeverityList) {
188 $severity = $debbugs::gDefaultSeverity if ($severity eq '');
189 next unless defined $section{${pending} . "_" . ${severity}};
190 $result .= "<HR><H2>$debbugs::gSeverityDisplay{$severity} - $displayshowpending{$pending}</H2>\n";
191 $result .= "(A list of <a href=\"http://www.debian.org/Bugs/db/si/$pending$severity\">all such bugs</a> is available).\n";
193 $result .= $section{$pending . "_" . $severity};
194 $result .= "</UL>\n";
195 $anydone = 1 if ($pending eq "done");
199 $result .= $debbugs::gHTMLExpireNote if ($anydone);
204 my $submitter = shift;
207 ($subemail = $d{"submitter"}) =~ s/\s*\(.*\)\s*//;
208 if ($subemail =~ m/<(.*)>/) { $subemail = $1 }
209 return $subemail eq $submitter;
211 return getbugs($chk);
216 my $severity = shift;
219 return ($d{"severity"} eq $severity) && ($d{"status"} eq $status);
221 return getbugs($chk);
226 my %maintainers = getmaintainers();
229 ($maintemail = $maintainers{$d{"pkg"}} || "") =~ s/\s*\(.*\)\s*//;
230 if ($maintemail =~ m/<(.*)>/) { $maintemail = $1 }
231 return $maintemail eq $maint;
233 return getbugs($chk);
238 my %maintainers = getmaintainers();
239 return getbugs(sub {my %d=@_; return maintencoded($maintainers{$d{"pkg"}} || "") eq $maint});
244 return getbugs( sub { my %d = @_; return $inpkg eq $d{"pkg"} });
250 if ( $common_archive ) {
251 open I, "<$debbugs::gSpoolDir/index.archive" or &quit("bugindex: $!");
253 open I, "<$debbugs::gSpoolDir/index.db" or &quit("bugindex: $!");
259 if (m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.+)$/) {
260 if ($bugfunc->(pkg => $1, bug => $2, status => $4, submitter => $5,
261 severity => $6, title => $7))
268 return sort {$a <=> $b} @result;
273 if ( $common_archive ) {
274 open I, "<$debbugs::gSpoolDir/index.archive" or &quit("bugindex: $!");
276 open I, "<$debbugs::gSpoolDir/index.db" or &quit("bugindex: $!");
279 $descstr{ $1 } = 1 if (m/^(\S+)/);
288 while ($input =~ m/\W/) {
289 $encoded.=$`.sprintf("-%02x_",unpack("C",$&));
294 $encoded =~ s/-2e_/\./g;
295 $encoded =~ s/^([^,]+)-20_-3c_(.*)-40_(.*)-3e_/$1,$2,$3,/;
296 $encoded =~ s/^(.*)-40_(.*)-20_-28_([^,]+)-29_$/,$1,$2,$3/;
297 $encoded =~ s/-20_/_/g;
298 $encoded =~ s/-([^_]+)_-/-$1/g;
305 open(MM,"$gMaintainerFile") or &quit("open $gMaintainerFile: $!");
307 next unless m/^(\S+)\s+(\S.*\S)\s*$/;
322 unless (open(S,"$gSpoolDir/db/$bugnum.status")) {
323 my $archdir = sprintf "%02d", $bugnum % 100;
324 open(S,"$gSpoolDir/archive/$archdir/$bugnum.status" ) or return ();
326 my @lines = qw(originator date subject msgid package keywords done
327 forwarded mergedwith severity);
330 $status{shift @lines} = $_;
333 $status{shift @lines} = '' while(@lines);
335 $status{"package"} =~ s/\s*$//;
336 $status{"package"} = 'unknown' if ($status{"package"} eq '');
337 $status{"severity"} = 'normal' if ($status{"severity"} eq '');
339 $status{"pending"} = 'pending';
340 $status{"pending"} = 'forwarded' if (length($status{"forwarded"}));
341 $status{"pending"} = 'done' if (length($status{"done"}));
350 $res = "$gSpoolDir/db/$bugnum.log";
351 return $res if ( -e $res );
353 my $archdir = sprintf "%02d", $bugnum % 100;
354 $res = "$gSpoolDir/archive/$archdir/$bugnum.log";
355 return $res if ( -e $res );