X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=cgi%2Fcommon.pl;h=05b8941ac7f84f8a2d2e07b9556ba9c6cabf577c;hb=759994a97a3e747305961b38eecd825d910e0c59;hp=3de27b2ebd07fe199f5c8188fc67807bdebb9266;hpb=37c4ff86368a72b1b670c72c59e14e17f42e0e8f;p=debbugs.git diff --git a/cgi/common.pl b/cgi/common.pl index 3de27b2..05b8941 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -11,14 +11,15 @@ use URI::Escape; use Debbugs::Config qw(:globals :text); $config_path = '/etc/debbugs'; $lib_path = '/usr/lib/debbugs'; -require "$lib_path/errorlib"; +#require "$lib_path/errorlib"; use Debbugs::Packages qw(:versions :mapping); use Debbugs::Versions; use Debbugs::MIME qw(decode_rfc1522); use Debbugs::Common qw(:util); -use Debbugs::Status qw(:read :versions); +use Debbugs::Status qw(:status :read :versions); use Debbugs::CGI qw(:all); +use Debbugs::Bugs qw(count_bugs); $MLDBM::RemoveTaint = 1; @@ -236,22 +237,6 @@ $debug = 1 if (defined $ret{"debug"} && $ret{"debug"} eq "aj"); return %ret; } -#sub abort { -# 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; -#} - -# Split a package string from the status file into a list of package names. -sub splitpackages { - my $pkgs = shift; - return unless defined $pkgs; - return map lc, split /[ \t?,()]+/, $pkgs; -} - # Generate a comma-separated list of HTML links to each package given in # $pkgs. $pkgs may be empty, in which case an empty string is returned, or # it may be a comma-separated list of package names. @@ -386,8 +371,6 @@ sub urlargs { return $args; } -sub submitterurl { pkg_url(submitter => emailfromrfc822($_[0] || "")); } -sub mainturl { pkg_url(maint => emailfromrfc822($_[0] || "")); } sub pkgurl { pkg_url(pkg => $_[0] || ""); } sub srcurl { pkg_url(src => $_[0] || ""); } sub tagurl { pkg_url(tag => $_[0] || ""); } @@ -471,7 +454,7 @@ sub allbugs { return @{getbugs(sub { 1 })}; } -sub bugmatches(\%\%) { +sub bugmatches { my ($hash, $status) = @_; foreach my $key( keys( %$hash ) ) { my $value = $hash->{$key}; @@ -480,14 +463,14 @@ sub bugmatches(\%\%) { } return 0; } -sub bugfilter($%) { - my ($bug, %status) = @_; - our (%seenmerged); - if (%common_include) { - return 1 if (!bugmatches(%common_include, %status)); +sub bugfilter { + my ($bug, $status,$seen_merged,$common_include,$common_exclude,$repeat_merged,) = @_; + #our (%seenmerged); + if ($common_include) { + return 1 if (!bugmatches($common_include, $status)); } - if (%common_exclude) { - return 1 if (bugmatches(%common_exclude, %status)); + if ($common_exclude) { + return 1 if (bugmatches($common_exclude, $status)); } my @merged = sort {$a<=>$b} $bug, split(/ /, $status{mergedwith}); my $daysold = int((time - $status{date}) / 86400); # seconds to days @@ -604,27 +587,9 @@ sub htmlizebugs { } sub countbugs { - my $bugfunc = shift; - if ($common_archive) { - open I, "<$gSpoolDir/index.archive" - or &quitcgi("$gSpoolDir/index.archive: $!"); - } else { - open I, "<$gSpoolDir/index.db" - or &quitcgi("$gSpoolDir/index.db: $!"); - } - - my %count = (); - while() - { - if (m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.*)$/) { - my @x = $bugfunc->(pkg => $1, bug => $2, status => $4, - submitter => $5, severity => $6, tags => $7); - local $_; - $count{$_}++ foreach @x; - } - } - close I; - return %count; + return count_bugs(function=>shift, + archive => $commonarchive, + ); } sub getbugs {