From ba3775d6ec7f7bfb412af0017ed2180d1ca5eaf3 Mon Sep 17 00:00:00 2001 From: doogie <> Date: Sat, 24 Feb 2001 01:13:38 -0800 Subject: [PATCH] [project @ 2001-02-24 01:13:38 by doogie] Applied patch from bugs.debian.org/87176, which makes the code pass references around, instead of copies, of hashes and arrays. --- cgi/bugreport.cgi | 4 ++-- cgi/common.pl | 24 ++++++++++++++---------- cgi/pkgindex.cgi | 2 +- cgi/pkgreport.cgi | 26 +++++++++++++------------- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 58de856..0405fd5 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -17,14 +17,14 @@ my %param = readparse(); my $tail_html; -my %maintainer = getmaintainers(); +my %maintainer = %{getmaintainers()}; my $ref = $param{'bug'} || quit("No bug number"); my $msg = $param{'msg'} || ""; my $boring = ($param{'boring'} || 'no') eq 'yes'; my $reverse = ($param{'reverse'} || 'no') eq 'yes'; -my %status = getbugstatus($ref) or &quit("Couldn't get bug status: $!"); +my %status = %{getbugstatus($ref)} or &quit("Couldn't get bug status: $!"); my $indexentry; my $descriptivehead; diff --git a/cgi/common.pl b/cgi/common.pl index ccf15aa..f1edd10 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -61,7 +61,7 @@ sub quit { sub htmlindexentry { my $ref = shift; - my %status = getbugstatus($ref); + my %status = %{getbugstatus($ref)}; return htmlindexentrystatus(%status) if (%status); return ""; } @@ -204,11 +204,13 @@ sub allbugs { } sub htmlizebugs { - my @bugs = @_; + $b = $_[0]; + my @bugs = @$b; my %section = (); my %displayshowpending = ("pending", "outstanding", + "fixed", "fixed in NMU", "done", "resolved", "forwarded", "forwarded to upstream software authors"); @@ -217,7 +219,7 @@ sub htmlizebugs { } 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]); @@ -255,7 +257,7 @@ sub htmlizebugs { my $result = ""; my $anydone = 0; - foreach my $pending (qw(pending forwarded done)) { + foreach my $pending (qw(pending forwarded fixed done)) { foreach my $severity(@debbugs::gSeverityList) { $severity = $debbugs::gDefaultSeverity if ($severity eq ''); next unless defined $section{${pending} . "_" . ${severity}}; @@ -324,16 +326,17 @@ print STDERR "done optimized\n" if ($debug); } while() { 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)) - { + my %hash = (pkg => $1, bug => $2, status => $4, + submitter => $5, severity => $6, tags => $7); + if ($bugfunc->(\%hash)) { push (@result, $2); } } } close I; } - return sort {$a <=> $b} @result; + @result = sort {$a <=> $b} @result; + return \@result; } sub emailfromrfc822 { @@ -373,7 +376,7 @@ sub getmaintainers { } close(MM); - return %maintainer; + return \%maintainer; } sub getbugstatus { @@ -400,9 +403,10 @@ sub getbugstatus { $status{"pending"} = 'pending'; $status{"pending"} = 'forwarded' if (length($status{"forwarded"})); + $status{"pending"} = 'fixed' if ($status{"tags"} =~ /\bfixed\b/); $status{"pending"} = 'done' if (length($status{"done"})); - return %status; + return \%status; } sub buglog { diff --git a/cgi/pkgindex.cgi b/cgi/pkgindex.cgi index a1f3ad7..dd7d83f 100755 --- a/cgi/pkgindex.cgi +++ b/cgi/pkgindex.cgi @@ -32,7 +32,7 @@ if ($sortby !~ m/^(alpha|count)$/) { my $Archived = $archive ? "Archived" : ""; -my %maintainers = &getmaintainers(); +my %maintainers = %{&getmaintainers()}; my %strings = (); $ENV{"TZ"} = 'UTC'; diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index cb7529a..50d6e46 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -58,9 +58,9 @@ my $tag; my @bugs; if (defined $pkg) { $tag = "package $pkg"; - @bugs = getbugs(sub {my %d=@_; return $pkg eq $d{"pkg"}}, 'package', $pkg); + @bugs = @{getbugs(sub {my %d=@{$_[0]}; return $pkg eq $d{"pkg"}}, 'package', $pkg)}; } elsif (defined $maint) { - my %maintainers = getmaintainers(); + my %maintainers = %{getmaintainers()}; $tag = "maintainer $maint"; my @pkgs = (); foreach my $p (keys %maintainers) { @@ -69,34 +69,34 @@ if (defined $pkg) { $me = $1 if ($me =~ m/<(.*)>/); push @pkgs, $p if ($me eq $maint); } - @bugs = getbugs(sub {my %d=@_; my $me; + @bugs = @{getbugs(sub {my %d=@{$_[0]}; my $me; ($me = $maintainers{$d{"pkg"}}||"") =~ s/\s*\(.*\)\s*//; $me = $1 if ($me =~ m/<(.*)>/); return $me eq $maint; - }, 'package', @pkgs); + }, 'package', @pkgs)}; } elsif (defined $maintenc) { - my %maintainers = getmaintainers(); + my %maintainers = %{getmaintainers()}; $tag = "encoded maintainer $maintenc"; - @bugs = getbugs(sub {my %d=@_; + @bugs = @{getbugs(sub {my %d=@_; return maintencoded($maintainers{$d{"pkg"}} || "") eq $maintenc - }); + })}; } elsif (defined $submitter) { $tag = "submitter $submitter"; - @bugs = getbugs(sub {my %d=@_; my $se; + @bugs = @{getbugs(sub {my %d=@_; my $se; ($se = $d{"submitter"} || "") =~ s/\s*\(.*\)\s*//; $se = $1 if ($se =~ m/<(.*)>/); return $se eq $submitter; - }, 'submitter-email', $submitter); + }, 'submitter-email', $submitter)}; } elsif (defined $severity) { $tag = "$status $severity bugs"; - @bugs = getbugs(sub {my %d=@_; + @bugs = @{getbugs(sub {my %d=@_; return ($d{"severity"} eq $severity) && ($d{"status"} eq $status); - }); + })}; } -my $result = htmlizebugs(@bugs); +my $result = htmlizebugs(\@bugs); print "Content-Type: text/html\n\n"; @@ -110,7 +110,7 @@ print "

" . "$debbugs::gProject $Archived $debbugs::gBug report logs: $tag" . "

\n"; if (defined $pkg) { - my %maintainers = getmaintainers(); + my %maintainers = %{getmaintainers()}; if (defined $maintainers{$pkg}) { print "

Maintainer for $pkg is " -- 2.39.2