From: doogie <> Date: Sun, 4 May 2003 03:42:16 +0000 (-0800) Subject: [project @ 2003-05-03 20:42:15 by doogie] X-Git-Tag: release/2.6.0~922 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=fcfb7feb2c631e9caa0c2e989a32c03597a85853;p=debbugs.git [project @ 2003-05-03 20:42:15 by doogie] * s/quit/quitcgi/, so that we don't get a clash between errorlib's quit. * Use the helper functions from errorlib to find the bug's location and path. --- diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index c668d94..8f55221 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -21,8 +21,8 @@ my %param = readparse(); my $tail_html; -my $ref = $param{'bug'} || quit("No bug number"); -$ref =~ /(\d+)/ or quit("Invalid bug number"); +my $ref = $param{'bug'} || quitcgi("No bug number"); +$ref =~ /(\d+)/ or quitcgi("Invalid bug number"); $ref = $1; my $short = "#$ref"; my $msg = $param{'msg'} || ""; @@ -139,7 +139,7 @@ foreach my $pkg (@tpacks) { $descriptivehead .= ".\n
"; } -open L, "<$buglog" or &quit("open log for $ref: $!"); +open L, "<$buglog" or &quitcgi("open log for $ref: $!"); if ($buglog !~ m#^\Q$gSpoolDir/db-h/#) { $descriptivehead .= "\n

Bug is archived. No further changes may be made.

"; } @@ -178,7 +178,7 @@ while(my $line = ) { || m/^(kill-init|kill-end) (incoming-recv|autocheck|recips|html)$/ || m/^kill-body go$/) { - &quit("$ref: Transition from $normstate to $newstate at $linenum disallowed"); + &quitcgi("$ref: Transition from $normstate to $newstate at $linenum disallowed"); } #$this .= "\n
states: $normstate $newstate
\n"; @@ -288,7 +288,7 @@ while(my $line = ) { my $pl= $_; $pl =~ s/\n+$//; m/^Received: \(at (\S+)\) by (\S+)\;/ - || &quit("bad line \`$pl' in state incoming-recv"); + || &quitcgi("bad line \`$pl' in state incoming-recv"); $thisheader = "

Message received at ".htmlsanit("$1\@$2") . ":

\n"; $this = ''; @@ -329,10 +329,10 @@ while(my $line = ) { next if !m/^$/; $normstate= 'go-nox'; } else { - &quit("$ref state $normstate line \`$_'"); + &quitcgi("$ref state $normstate line \`$_'"); } } -&quit("$ref state $normstate at end") unless $normstate eq 'kill-end'; +&quitcgi("$ref state $normstate at end") unless $normstate eq 'kill-end'; close(L); if ( $mbox ) { diff --git a/cgi/common.pl b/cgi/common.pl index 2a7afbd..8a40da8 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -103,7 +103,7 @@ $debug = 1 if (defined $ret{"debug"} && $ret{"debug"} eq "aj"); return %ret; } -sub quit { +sub quitcgi { my $msg = shift; print "Content-Type: text/html\n\n"; print "Error\n"; @@ -314,7 +314,7 @@ sub mboxurl { sub allbugs { my @bugs = (); - opendir(D, "$debbugs::gSpoolDir/db") or &quit("opendir db: $!"); + opendir(D, "$debbugs::gSpoolDir/db") or &quitcgi("opendir db: $!"); @bugs = sort {$a<=>$b} grep s/\.status$//, (grep m/^[0-9]+\.status$/, (readdir(D))); @@ -424,9 +424,9 @@ sub htmlizebugs { sub countbugs { my $bugfunc = shift; if ($common_archive) { - open I, "<$debbugs::gSpoolDir/index.archive" or &quit("bugindex: $!"); + open I, "<$debbugs::gSpoolDir/index.archive" or &quitcgi("bugindex: $!"); } else { - open I, "<$debbugs::gSpoolDir/index.db" or &quit("bugindex: $!"); + open I, "<$debbugs::gSpoolDir/index.db" or &quitcgi("bugindex: $!"); } my %count = (); @@ -466,10 +466,10 @@ print STDERR "done optimized\n" if ($debug); } else { if ( $common_archive ) { open I, "<$debbugs::gSpoolDir/index.archive" - or &quit("bugindex: $!"); + or &quitcgi("bugindex: $!"); } else { open I, "<$debbugs::gSpoolDir/index.db" - or &quit("bugindex: $!"); + or &quitcgi("bugindex: $!"); } while() { if (m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.*)$/) { @@ -516,7 +516,7 @@ sub getmaintainers { return $_maintainer if $_maintainer; my %maintainer; - open(MM,"$gMaintainerFile") or &quit("open $gMaintainerFile: $!"); + open(MM,"$gMaintainerFile") or &quitcgi("open $gMaintainerFile: $!"); while() { next unless m/^(\S+)\s+(\S.*\S)\s*$/; ($a,$b)=($1,$2); @@ -524,7 +524,7 @@ sub getmaintainers { $maintainer{$a}= $b; } close(MM); - open(MM,"$gMaintainerFileOverride") or &quit("open $gMaintainerFileOverride: $!"); + open(MM,"$gMaintainerFileOverride") or &quitcgi("open $gMaintainerFileOverride: $!"); while() { next unless m/^(\S+)\s+(\S.*\S)\s*$/; ($a,$b)=($1,$2); @@ -543,7 +543,7 @@ sub getpkgsrc { my %pkgsrc; my %pkgcomponent; - open(MM,"$gPackageSource") or &quit("open $gPackageSource: $!"); + open(MM,"$gPackageSource") or &quitcgi("open $gPackageSource: $!"); while() { next unless m/^(\S+)\s+(\S+)\s+(\S.*\S)\s*$/; ($a,$b,$c)=($1,$2,$3); @@ -568,7 +568,7 @@ sub getpseudodesc { return $_pseudodesc if $_pseudodesc; my %pseudodesc; - open(PSEUDO, "< $gPseudoDescFile") or &quit("open $gPseudoDescFile: $!"); + open(PSEUDO, "< $gPseudoDescFile") or &quitcgi("open $gPseudoDescFile: $!"); while() { next unless m/^(\S+)\s+(\S.*\S)\s*$/; $pseudodesc{lc $1} = $2; @@ -578,31 +578,16 @@ sub getpseudodesc { return $_pseudodesc; } -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; - 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() { - chomp; - $status{shift @lines} = $_; - } - close(S); - $status{shift @lines} = '' while(@lines); + my $location = getbuglocation( $bugnum, "status" ); + return {} if ( !$location ); + %status = %{ readbug( $bugnum, $location ) }; + + $status{tags} = $status{keywords}; $status{"package"} =~ s/\s*$//; $status{"package"} = 'unknown' if ($status{"package"} eq ''); @@ -631,9 +616,10 @@ sub getsrcpkgs { sub buglog { my $bugnum = shift; - my $dir = getbugdir( $bugnum, "log" ); + my $dir = getlocationpath( getbuglocation( $bugnum, "log" ) ); + my $hash = get_hashname( $bugnum ); return "" if ( !$dir ); - return "$dir/$bugnum.log"; + return "$dir/$hash/$bugnum.log"; } 1; diff --git a/cgi/pkgindex.cgi b/cgi/pkgindex.cgi index 88f875f..69cc552 100755 --- a/cgi/pkgindex.cgi +++ b/cgi/pkgindex.cgi @@ -17,14 +17,14 @@ my %param = readparse(); my $indexon = $param{'indexon'} || 'pkg'; if ($indexon !~ m/^(pkg|maint|submitter)$/) { - quit("You have to choose something to index on"); + quitcgi("You have to choose something to index on"); } my $repeatmerged = ($param{'repeatmerged'} || "yes") eq "yes"; my $archive = ($param{'archive'} || "no") eq "yes"; my $sortby = $param{'sortby'} || 'alpha'; if ($sortby !~ m/^(alpha|count)$/) { - quit("Don't know how to sort like that"); + quitcgi("Don't know how to sort like that"); } #my $include = $param{'include'} || ""; diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index fdf5709..15345c9 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -75,7 +75,7 @@ if (!$found) { } } } -quit("You have to choose something to select by") if (!$found); +quitcgi("You have to choose something to select by") if (!$found); my $Archived = $archive ? " Archived" : "";