require '/etc/debbugs/config';
require '/etc/debbugs/text';
+use vars(qw($gHTMLTail $gWebDomain));
my $dtime;
my $tail_html;
my $ref= param('bug') || die("No bug number");
my $archive = (param('archive') || 'no') eq 'yes';
-my %status = getbugstatus($ref, $archive);
-
my $msg = param('msg') || "";
my $boring = (param('boring') || 'no') eq 'yes';
my $reverse = (param('reverse') || 'no') eq 'yes';
+set_option("archive", $archive);
+
+my %status = getbugstatus($ref);
+
my $indexentry;
my $descriptivehead;
my $submitted;
}
$indexentry .= $showseverity;
-$indexentry .= "Reported by: ".&sani($status{originator});
+$indexentry .= "Package: <A HREF=\"" . pkgurl($status{package}) . "\">"
+ .htmlsanit($status{package})."</A>;\n";
+
+$indexentry .= "Reported by: ".&sani($status{originator})."; ";
$indexentry .= ";\nKeywords: ".&sani($status{keywords})
if length($status{keywords});
}
}
-$submitted = `TZ=GMT LANG=C \\
+my $dummy = `TZ=GMT LANG=C \\
date -d '1 Jan 1970 00:00:00 + $status{date} seconds' \\
- '+ %a, %d %b %Y %T %Z'`;
+ '+ %a, %e %b %Y %T %Z'`;
+chomp($dummy);
+$submitted = "dated ".$dummy;
if (length($status{done})) {
$indexentry .= ";\n<strong>Done:</strong> ".&sani($status{done});
if $normstate eq 'go' || $normstate eq 'go-nox';
if ($normstate eq 'html') {
- $this .= " <em><A href=\"" . bugurl($ref, "msg=$xmessage", "archive=$archive") . "\">Full text</A> available.</em>";
+ $this .= " <em><A href=\"" . bugurl($ref, $archive, "msg=$xmessage") . "\">Full text</A> available.</em>";
}
my $show = 1;
close(L);
print header;
-print start_html("$debbugs::gProject $debbugs::gBug report logs - $short");
+print start_html(
+ -TEXT => "#000000",
+ -BGCOLOR=>"#FFFFFF",
+ -LINK => "#0000FF",
+ -VLINK => "#800080",
+ -title => "$debbugs::gProject $debbugs::gBug report logs - $short");
print h1("$debbugs::gProject $debbugs::gBug report logs - $short<br>\n"
. sani($status{subject}));
#!/usr/bin/perl -w
+my $common_archive = 0;
+my $common_repeatmerged = 1;
+
+sub set_option {
+ my ($opt, $val) = @_;
+ if ($opt eq "archive") { $common_archive = $val; }
+ if ($opt eq "repeatmerged") { $common_repeatmerged = $val; }
+}
+
sub quit {
- my $msg = shift;
- print header . start_html("Error");
- print "An error occurred. Dammit.\n";
- print "Error was: $msg.\n";
- print end_html;
- exit 0;
+ my $msg = shift;
+ print header . start_html("Error");
+ print "An error occurred. Dammit.\n";
+ print "Error was: $msg.\n";
+ print end_html;
+ exit 0;
}
sub abort {
- my $msg = shift;
- my $archive = shift;
- print header . start_html("Sorry");
- print "Sorry bug #$msg doesn't seem to be in the $archive database.\n";
- print end_html;
- exit 0;
+ my $msg = shift;
+ my $Archive = $common_archive ? "archive" : "";
+ print header . start_html("Sorry");
+ print "Sorry bug #$msg doesn't seem to be in the $Archive database.\n";
+ print end_html;
+ exit 0;
}
sub htmlindexentry {
my $ref = shift;
- my $archive = shift;
+ my %status = getbugstatus($ref);
+ return htmlindexentrystatus(%status) if (%status);
+ return "";
+}
+
+sub htmlindexentrystatus {
+ my $s = shift;
+ my %status = %{$s};
- my %status = getbugstatus($ref, $archive );
my $result = "";
if ($status{severity} eq 'normal') {
$showseverity = "Severity: <em>$status{severity}</em>;\n";
}
- $result .= "Package: <a href=\"" . pkgurl($status{"package"}) . "\"><strong>"
- . htmlsanit($status{"package"}) . "</strong></a>;\n"
- if (length($status{"package"}));
+ $result .= "Package: <a href=\"" . pkgurl($status{"package"}) . "\">"
+ . "<strong>" . htmlsanit($status{"package"}) . "</strong></a>;\n"
+ if (length($status{"package"}));
$result .= $showseverity;
$result .= "Reported by: " . htmlsanit($status{originator});
$result .= ";\nKeywords: " . htmlsanit($status{keywords})
if (length($status{keywords}));
my @merged= split(/ /,$status{mergedwith});
- if (@merged) {
- my $mseparator= ";\nmerged with ";
- for my $m (@merged) {
- $result .= $mseparator."<A href=\"" . bugurl($m) . "\">#$m</A>";
- $mseparator= ", ";
- }
+ my $mseparator= ";\nmerged with ";
+ for my $m (@merged) {
+ $result .= $mseparator."<A href=\"" . bugurl($m) . "\">#$m</A>";
+ $mseparator= ", ";
}
if (length($status{done})) {
return $result;
}
+sub mainturl {
+ my $ref = shift;
+ return sprintf "http://%s/db/ma/l%s.html",
+ $debbugs::gWebDomain, maintencoded($ref);
+}
+
sub pkgurl {
my $ref = shift;
my $params = "pkg=$ref";
- foreach my $val (@_) { 1 }
+ $params .= "&archive=yes" if ($common_archive);
+ $params .= "&repeatmerged=yes" if ($common_repeatmerged);
return $debbugs::gCGIDomain . "pkgreport.cgi" . "?" . "$params";
}
-%saniarray= ('<','lt', '>','gt', '&','amp', '"','quot');
-
sub htmlsanit {
+ my %saniarray = ('<','lt', '>','gt', '&','amp', '"','quot');
my $in = shift;
my $out;
while ($in =~ m/[<>&"]/) {
- $out.= $`. '&'. $saniarray{$&}. ';';
- $in=$';
+ $out .= $`. '&'. $saniarray{$&}. ';';
+ $in = $';
}
$out .= $in;
return $out;
my $params = "bug=$ref";
foreach my $val (@_) {
$params .= "\&msg=$1" if ($val =~ /^msg=([0-9]+)/);
- $params .= "\&archive=yes" if ($val =~ /^archive=1/);
+ $params .= "\&archive=yes" if (!$common_archive && $val =~ /^archive.*$/);
}
-
+ $params .= "&archive=yes" if ($common_archive);
+ $params .= "&repeatmerged=yes" if ($common_repeatmerged);
+
return $debbugs::gCGIDomain . "bugreport.cgi" . "?" . "$params";
}
my @bugs = ();
opendir(D, "$debbugs::gSpoolDir/db") || &quit("opendir db: $!");
- @bugs = sort { $a <=> $b }
- grep s/\.status$//,
+ @bugs = sort {$a<=>$b} grep s/\.status$//,
(grep m/^[0-9]+\.status$/,
(readdir(D)));
closedir(D);
return @bugs;
}
+sub htmlizebugs {
+ my @bugs = @_;
+
+ my %section = ();
+
+ my %displayshowpending = ("pending", "outstanding",
+ "done", "resolved",
+ "forwarded", "forwarded to upstream software authors");
+
+ if (@bugs == 0) {
+ return hr . h2("No reports found!");
+ }
+
+ foreach my $bug (sort {$a<=>$b} @bugs) {
+ my %status = getbugstatus($bug);
+ next unless %status;
+ my @merged = sort {$a<=>$b} ($bug, split(/ /, $status{mergedwith}));
+ if ($common_repeatmerged || $bug == $merged[0]) {
+ $section{$status{pending} . "_" . $status{severity}} .=
+ sprintf "<li><a href=\"%s\">#%d: %s</a>\n<br>",
+ bugurl($bug), $bug, htmlsanit($status{subject});
+ $section{$status{pending} . "_" . $status{severity}} .=
+ htmlindexentrystatus(\%status) . "\n";
+ }
+ }
+
+ my $result = "";
+ my $anydone = 0;
+ foreach my $pending (qw(pending forwarded done)) {
+ foreach my $severity(@debbugs::gSeverityList) {
+ $severity = $debbugs::gDefaultSeverity if ($severity eq '');
+ next unless defined $section{${pending} . "_" . ${severity}};
+ $result .= hr . h2("$debbugs::gSeverityDisplay{$severity} - $displayshowpending{$pending}");
+ $result .= "(A list of <a href=\"http://www.debian.org/Bugs/db/si/$pending$severity\">all such bugs</a> is available).\n";
+ $result .= ul($section{$pending . "_" . $severity});
+ $anydone = 1 if ($pending eq "done");
+ }
+ }
+
+ $result .= $debbugs::gHTMLExpireNote if ($anydone);
+ return $result;
+}
+
+sub maintbugs {
+ my $maint = shift;
+ my $chk = sub {
+ my %d = @_;
+ ($maintemail = $d{"maint"}) =~ s/\s*\(.*\)\s*//;
+ if ($maintemail =~ m/<(.*)>/) { $maintemail = $1 }
+ return $maintemail eq $maint;
+ };
+ return getbugs($chk);
+}
+
+sub maintencbugs {
+ my $maint = shift;
+ return getbugs(sub {my %d=@_; return maintencoded($d{"maint"}) eq $maint});
+}
+
sub pkgbugs {
- my $pkg = shift;
- my $archive = shift;
- if ( $archive ) { open I, "<$debbugs::gSpoolDir/index.archive" || &quit("bugindex: $!"); }
- else { open I, "<$debbugs::gSpoolDir/index.db" || &quit("bugindex: $!"); }
+ my $inpkg = shift;
+ return getbugs( sub { my %d = @_; return $inpkg eq $d{"pkg"} });
+}
+
+sub getbugs {
+ my $bugfunc = shift;
+
+ if ( $common_archive ) {
+ open I, "<$debbugs::gSpoolDir/index.archive" || &quit("bugindex: $!");
+ } else {
+ open I, "<$debbugs::gSpoolDir/index.db" || &quit("bugindex: $!");
+ }
+ my @result = ();
while(<I>)
- { if (m/^(\S+)\s+(\d+)\s+(.+)/ && $1 eq $pkg)
- {
- my $tmpstr = sprintf( "%d: %s", $2, $3 );
- $descstr{ $2 } = $tmpstr;
- }
+ {
+ if (m/^(\S+)\s+(\d+)\s+(\S+)\s+(\d+)\s+\[\s*([^]]*[^]\s])\s*\]\s+(\w+)\s+(.+)$/) {
+ if ($bugfunc->(pkg => $1, bug => $2, maint => $5,
+ severity => $6, title => $7))
+ {
+ push (@result, $2);
+ }
+ }
}
- return %descstr;
+ close I;
+ return @result;
}
sub pkgbugsindex {
- my $archive = shift;
- my @bugs = ();
- if ( $archive ) { open I, "<$debbugs::gSpoolDir/index.archive" || &quit("bugindex: $!"); }
- else { open I, "<$debbugs::gSpoolDir/index.db" || &quit("bugindex: $!"); }
- while(<I>) { $descstr{ $1 } = 1 if (m/^(\S+)/); }
+ my %descstr = ();
+ if ( $common_archive ) {
+ open I, "<$debbugs::gSpoolDir/index.archive" || &quit("bugindex: $!");
+ } else {
+ open I, "<$debbugs::gSpoolDir/index.db" || &quit("bugindex: $!");
+ }
+ while(<I>) {
+ $descstr{ $1 } = 1 if (m/^(\S+)/);
+ }
return %descstr;
}
sub maintencoded {
- my $input = $_;
- my $encoded = '';
+ my $input = shift;
+ my $encoded = '';
- while ($input =~ m/\W/)
- { $encoded.=$`.sprintf("-%02x_",unpack("C",$&));
+ while ($input =~ m/\W/) {
+ $encoded.=$`.sprintf("-%02x_",unpack("C",$&));
$input= $';
}
+
$encoded.= $input;
$encoded =~ s/-2e_/\./g;
$encoded =~ s/^([^,]+)-20_-3c_(.*)-40_(.*)-3e_/$1,$2,$3,/;
$encoded =~ s/^(.*)-40_(.*)-20_-28_([^,]+)-29_$/,$1,$2,$3/;
$encoded =~ s/-20_/_/g;
$encoded =~ s/-([^_]+)_-/-$1/g;
- return $input;
+ return $encoded;
}
+
sub getmaintainers {
my %maintainer;
}
sub getbugstatus {
- my $bugnum = shift;
- my $archive = shift;
+ my $bugnum = shift;
- my %status;
+ my %status;
- if ( $archive )
- { my $archdir = $bugnum % 100;
- open(S,"$gSpoolDir/archive/$archdir/$bugnum.status" ) || &abort("$bugnum", "archive" );
- } else
- { open(S,"$gSpoolDir/db/$bugnum.status") || &abort("$bugnum"); }
- my @lines = qw(originator date subject msgid package keywords done
+ if ( $common_archive ) {
+ my $archdir = sprintf "%02d", $bugnum % 100;
+ open(S,"$gSpoolDir/archive/$archdir/$bugnum.status" ) || return undef;
+ } else {
+ open(S,"$gSpoolDir/db/$bugnum.status") || return undef;
+ }
+ my @lines = qw(originator date subject msgid package keywords done
forwarded mergedwith severity);
- while(<S>) {
- chomp;
- $status{shift @lines} = $_;
- }
- close(S);
- $status{shift @lines} = '' while(@lines);
+ while(<S>) {
+ chomp;
+ $status{shift @lines} = $_;
+ }
+ close(S);
+ $status{shift @lines} = '' while(@lines);
- $status{package} =~ s/\s*$//;
- $status{package} = 'unknown' if ($status{package} eq '');
- $status{severity} = 'normal' if ($status{severity} eq '');
+ $status{"package"} =~ s/\s*$//;
+ $status{"package"} = 'unknown' if ($status{"package"} eq '');
+ $status{"severity"} = 'normal' if ($status{"severity"} eq '');
- $status{pending} = 'pending';
- $status{pending} = 'forwarded' if (length($status{forwarded}));
- $status{pending} = 'done' if (length($status{done}));
+ $status{"pending"} = 'pending';
+ $status{"pending"} = 'forwarded' if (length($status{"forwarded"}));
+ $status{"pending"} = 'done' if (length($status{"done"}));
- return %status;
+ return %status;
}
sub buglog {
- my $bugnum = shift;
- my $archive = shift;
- if ( $archive )
- { my $archdir = $bugnum % 100;
- return "$gSpoolDir/archive/$archdir/$bugnum.log";
- } else { return "$gSpoolDir/db/$bugnum.log"; }
+ my $bugnum = shift;
+ if ( $common_archive ) {
+ my $archdir = sprintf "%02d", $bugnum % 100;
+ return "$gSpoolDir/archive/$archdir/$bugnum.log";
+ } else {
+ return "$gSpoolDir/db/$bugnum.log";
+ }
}
1
use strict;
use CGI qw/:standard/;
+require '/debian/home/ajt/newajbug/common.pl';
+#require '/usr/lib/debbugs/common.pl';
require '/usr/lib/debbugs/errorlib';
-require '/usr/lib/debbugs/common.pl';
require '/etc/debbugs/config';
require '/etc/debbugs/text';
my $pkg = param('pkg');
-my $archive = (param('archive') || 'no') eq 'yes';
-my $arc = 'yes';
+my $maint = defined $pkg ? undef : param('maint');
+my $maintenc = (defined $pkg || defined $maint) ? undef : param('maintenc');
+my $repeatmerged = (param('repeatmerged') || "yes") eq "yes";
+my $archive = (param('archive') || "no") eq "yes";
-$pkg = 'ALL' unless defined( $pkg );
-$arc = 'no' unless $archive;
+$pkg = 'ALL' unless (defined($pkg) || defined($maint) || defined($maintenc));
+
+my $Archived = $archive ? "Archived" : "";
-my $repeatmerged = (param('repeatmerged') || 'yes') eq 'yes';
my $this = "";
my %indexentry;
-my %maintainer = ();
+my %maintainer = &getmaintainers();
my %strings = ();
-my %displayshowpending = ('pending','outstanding',
- 'done','resolved',
- 'forwarded','forwarded to upstream software authors');
-
my $dtime=`date -u '+%H:%M:%S GMT %a %d %h'`;
chomp($dtime);
my $tail_html = $debbugs::gHTMLTail;
$tail_html =~ s/SUBSTITUTE_DTIME/$dtime/;
+my $tag;
+if (defined $pkg) {
+ $tag = "package $pkg";
+} elsif (defined $maint) {
+ $tag = "maintainer $maint";
+} else {
+ $tag = "maintainer $maintenc";
+}
+
+set_option("repeatmerged", $repeatmerged);
+set_option("archive", $archive);
+
+my @bugs;
+if (defined $pkg) {
+ @bugs = pkgbugs($pkg);
+} elsif (defined $maint) {
+ @bugs = maintbugs($maint);
+} else {
+ @bugs = maintencbugs($maintenc);
+}
+
+my $result = htmlizebugs(@bugs);
print header;
-if( $archive )
-{ print start_html("$debbugs::gProject Archived $debbugs::gBug report logs: package $pkg");
- print h1("$debbugs::gProject Archived $debbugs::gBug report logs: package $pkg");
-} else
-{ print start_html("$debbugs::gProject $debbugs::gBug report logs: package $pkg");
- print h1("$debbugs::gProject $debbugs::gBug report logs: package $pkg");
+print start_html("$debbugs::gProject $Archived $debbugs::gBug report logs: $tag");
+print h1("$debbugs::gProject $Archived $debbugs::gBug report logs: $tag");
+
+if (defined $maintainer{$pkg}) {
+ print "<p>Maintainer for $pkg is <a href=\""
+ . mainturl($maintainer{$pkg}) . "\">"
+ . htmlsanit($maintainer{$pkg}) . "</a>.</p>\n";
}
-#if (defined $maintainer{$pkg}) {
-# print "<p>Maintainer for $pkg is <a href=\""
-# . mainturl($maintainer{$pkg}) . "\">"
-# . htmlsanit($maintainer{$pkg}) . "</a>.</p>\n";
-#}
-
-print "<p>Note that with multi-binary packages there may be other reports\n";
-print "filed under the different binary package names.</p>\n";
-
-if ( $pkg ne 'ALL' )
-{ %strings = pkgbugs($pkg, $archive);
- foreach my $bug ( keys %strings )
- { $this .= " <LI><A href=\"" . bugurl($bug, "archive=$archive") . "\">". $strings{ $bug } ."</A>\n"; }
-} else
-{ %strings = pkgbugsindex( $archive );
- my @bugs = ();
- foreach my $bug ( keys %strings ) { push @bugs, $bug; }
- @bugs = sort { $a cmp $b } @bugs;
- foreach my $bug ( @bugs )
- { $this .= " <LI><A HREF=\"http://cgi.debian.org/cgi-bin/pkgreport.cgi?pkg=". $bug ."&archive=$arc\">". $bug . "\n"; }
+if (defined $pkg) {
+ print "<p>Note that with multi-binary packages there may be other\n";
+ print "reports filed under the different binary package names.</p>\n";
+} else {
+ print "<p>Note that maintainers may use different Maintainer fields for\n";
+ print "different packages, so there may be other reports filed under\n"
+ print "different addresses.\n";
}
-if ( length( $this ) )
-{ print "<UL>\n";
- print $this;
- print "</UL>\n";
-} else
-{ print "No archived reports found\n"; }
+print $result;
print hr;
print "$tail_html";