]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2003-05-03 20:42:15 by doogie]
authordoogie <>
Sun, 4 May 2003 03:42:16 +0000 (19:42 -0800)
committerdoogie <>
Sun, 4 May 2003 03:42:16 +0000 (19:42 -0800)
* 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.

cgi/bugreport.cgi
cgi/common.pl
cgi/pkgindex.cgi
cgi/pkgreport.cgi

index c668d94604864a0bb5a83fe7f11b07497397c54d..8f55221c136e7c92f016e86c47212e8881cd2db5 100755 (executable)
@@ -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<br>";
 }
 
-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<p>Bug is <strong>archived</strong>. No further changes may be made.</p>";
 }
@@ -178,7 +178,7 @@ while(my $line = <L>) {
                    || 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<br>states: $normstate $newstate<br>\n";
@@ -288,7 +288,7 @@ while(my $line = <L>) {
                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 = "<h2>Message received at ".htmlsanit("$1\@$2")
                        . ":</h2>\n";
                $this = '';
@@ -329,10 +329,10 @@ while(my $line = <L>) {
                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 ) {
index 2a7afbdcb58c105f84f7a35c380dd21c542606fd..8a40da82713022722239cfdaedf666e58a0fd42c 100644 (file)
@@ -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 "<HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY>\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(<I>) {
             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(<MM>) {
        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(<MM>) {
        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(<MM>) {
        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(<PSEUDO>) {
        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(<S>) {
-        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;
index 88f875f11168e8c2042e8aee7088ed54b4acc9c1..69cc552240312646181c640102df314d031e5af7 100755 (executable)
@@ -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'} || "";
index fdf5709d8807300170b9e46982e9b8dc438df91f..15345c919f30d9f8ccb50da7dfa7f326ab5873bb 100755 (executable)
@@ -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" : "";