#!/usr/bin/perl -w
+use DB_File;
+use Fcntl qw/O_RDONLY/;
+
my $common_archive = 0;
my $common_repeatmerged = 1;
my %common_include = ();
$val=~s/%(..)/pack("c",hex($1))/ge;
$ret{$key}=$val;
}
-$debug = 1 if ($ret{"debug"} eq "aj");
+$debug = 1 if (defined $ret{"debug"} && $ret{"debug"} eq "aj");
return %ret;
}
sub htmlindexentry {
my $ref = shift;
- my %status = getbugstatus($ref);
+ my %status = %{getbugstatus($ref)};
return htmlindexentrystatus(%status) if (%status);
return "";
}
return urlsanit($debbugs::gCGIDomain . "pkgreport.cgi" . "?" . "$params");
}
+sub srcurl {
+ my $ref = shift;
+ my $params = "src=$ref";
+ $params .= "&archive=yes" if ($common_archive);
+ $params .= "&repeatmerged=yes" if ($common_repeatmerged);
+ return urlsanit($debbugs::gCGIDomain . "pkgreport.cgi" . "?" . "$params");
+}
+
sub urlsanit {
my $url = shift;
$url =~ s/%/%25/g;
$url =~ s/\+/%2b/g;
- return $url;
+ return htmlsanit($url);
}
sub htmlsanit {
$params .= "&archive=yes" if ($common_archive);
$params .= "&repeatmerged=yes" if ($common_repeatmerged);
- return $debbugs::gCGIDomain . "bugreport.cgi" . "?" . "$params";
+ return urlsanit($debbugs::gCGIDomain . "bugreport.cgi" . "?" . "$params");
}
sub packageurl {
my $ref = shift;
- return $debbugs::gCGIDomain . "package.cgi" . "?" . "package=$ref";
+ return urlsanit($debbugs::gCGIDomain . "package.cgi" . "?" . "package=$ref");
}
sub allbugs {
}
sub htmlizebugs {
- my @bugs = @_;
+ $b = $_[0];
+ my @bugs = @$b;
my %section = ();
my %displayshowpending = ("pending", "outstanding",
+ "pending-fixed", "pending upload",
+ "fixed", "fixed in NMU",
"done", "resolved",
"forwarded", "forwarded to upstream software authors");
}
foreach my $bug (sort {$a<=>$b} @bugs) {
- my %status = getbugstatus($bug);
+ my %status = %{getbugstatus($bug)};
next unless %status;
my @merged = sort {$a<=>$b} ($bug, split(/ /, $status{mergedwith}));
next unless ($common_repeatmerged || $bug == $merged[0]);
if (%common_exclude) {
my $okay = 1;
foreach my $t (split /\s+/, $status{tags}) {
- $okay = 0, last if (defined $comon_exclude{$t});
+ $okay = 0, last if (defined $common_exclude{$t});
}
if (defined $common_exclude{subj}) {
if (index($status{subject}, $common_exclude{subj}) > -1) {
my $result = "";
my $anydone = 0;
- foreach my $pending (qw(pending forwarded done)) {
+ foreach my $pending (qw(pending forwarded pending-fixed fixed 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}</H2>\n";
- $result .= "(A list of <a href=\"http://${debbugs::gWebDomain}/db/si/$pending$severity\">all such bugs</a> is available).\n";
+ #$result .= "(A list of <a href=\"http://${debbugs::gWebDomain}/db/si/$pending$severity\">all such bugs</a> is available).\n";
+ $result .= "(A list of all such bugs used to be available).\n";
$result .= "<UL>\n";
$result .= $section{$pending . "_" . $severity};
$result .= "</UL>\n";
if (!$common_archive && defined $opt &&
-e "$debbugs::gSpoolDir/by-$opt.idx")
{
- tie my %lookup, DB_File => "$debbugs::gSpoolDir/by-$opt.idx", O_RDONLY
+ my %lookup;
+print STDERR "optimized\n" if ($debug);
+ tie %lookup, DB_File => "$debbugs::gSpoolDir/by-$opt.idx", O_RDONLY
or die "$0: can't open $debbugs::gSpoolDir/by-$opt.idx ($!)\n";
while ($key = shift) {
my $bugs = $lookup{$key};
push @result, (unpack 'N*', $bugs);
}
}
+ untie %lookup;
+print STDERR "done optimized\n" if ($debug);
} else {
if ( $common_archive ) {
open I, "<$debbugs::gSpoolDir/index.archive"
}
while(<I>) {
if (m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.*)$/) {
- if ($bugfunc->(pkg => $1, bug => $2, status => $4,
- submitter => $5, severity => $6, tags => $7))
- {
+ if ($bugfunc->(pkg => $1, bug => $2, status => $4,
+ submitter => $5, severity => $6, tags => $7))
+ {
push (@result, $2);
}
}
}
close I;
}
- return sort {$a <=> $b} @result;
+ @result = sort {$a <=> $b} @result;
+ return \@result;
}
sub emailfromrfc822 {
$maintainer{$a}= $b;
}
close(MM);
+ open(MM,"$gMaintainerFileOverride") or &quit("open $gMaintainerFileOverride: $!");
+ while(<MM>) {
+ next unless m/^(\S+)\s+(\S.*\S)\s*$/;
+ ($a,$b)=($1,$2);
+ $a =~ y/A-Z/a-z/;
+ $maintainer{$a}= $b;
+ }
+ close(MM);
- return %maintainer;
+ return \%maintainer;
}
+sub getpkgsrc {
+ my %pkgsrc;
+
+ open(MM,"$gPackageSource") or &quit("open $gPackageSource: $!");
+ while(<MM>) {
+ next unless m/^(\S+)\s+(\S.*\S)\s*$/;
+ ($a,$b)=($1,$2);
+ $a =~ y/A-Z/a-z/;
+ $pkgsrc{$a}= $b;
+ }
+ close(MM);
+
+ return \%pkgsrc
+}
+
+sub getbugdir {
+ my ( $bugnum, $ext ) = @_;
+ my $archdir = sprintf "%02d", $bugnum % 100;
+ foreach ( ( "$gSpoolDir/db-h/$archdir", "$gSpoolDir/db", "$gSpoolDir/archive/$archdir" ) ) {
+ return $_ if ( -r "$_/$bugnum.$ext" );
+ }
+ return undef;
+}
+
sub getbugstatus {
my $bugnum = shift;
my %status;
- unless (open(S,"$gSpoolDir/db/$bugnum.status")) {
- my $archdir = sprintf "%02d", $bugnum % 100;
- open(S,"$gSpoolDir/archive/$archdir/$bugnum.status" ) or return ();
- }
+ my $dir = getbugdir( $bugnum, "status" );
+ return {} if ( !$dir );
+ open S, "< $dir/$bugnum.status";
my @lines = qw(originator date subject msgid package tags done
forwarded mergedwith severity);
while(<S>) {
$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"} = 'forwarded' if (length($status{"forwarded"}));
+ $status{"pending"} = 'fixed' if ($status{"tags"} =~ /\bfixed\b/);
+ $status{"pending"} = 'pending-fixed' if ($status{"tags"} =~ /\bpending\b/);
+ $status{"pending"} = 'done' if (length($status{"done"}));
- return %status;
+ return \%status;
}
sub buglog {
my $bugnum = shift;
- my $res;
- $res = "$gSpoolDir/db/$bugnum.log";
- return $res if ( -e $res );
-
- my $archdir = sprintf "%02d", $bugnum % 100;
- $res = "$gSpoolDir/archive/$archdir/$bugnum.log";
- return $res if ( -e $res );
-
- return "";
+ my $dir = getbugdir( $bugnum, "log" );
+ return "" if ( !$dir );
+ return "$dir/$bugnum.log";
}
-1
+1;