]> git.donarmstrong.com Git - debbugs.git/blobdiff - cgi/common.pl
[project @ 2003-05-21 20:55:13 by cjwatson]
[debbugs.git] / cgi / common.pl
index 8a40da82713022722239cfdaedf666e58a0fd42c..c7662c4371f1f7ef451c579dd22d2b084f0b75d5 100644 (file)
@@ -2,6 +2,9 @@
 
 use DB_File;
 use Fcntl qw/O_RDONLY/;
+$config_path = '/etc/debbugs';
+$lib_path = '/usr/lib/debbugs';
+require "$lib_path/errorlib";
 
 my $common_archive = 0;
 my $common_repeatmerged = 1;
@@ -203,8 +206,8 @@ sub htmlindexentrystatus {
             $efont = "</$font>" if ($font);
             $font = "<$font>" if ($font);
 
-            my $yearsold = int($daysold / 364);
-            $daysold = $daysold - $yearsold * 364;
+            my $yearsold = int($daysold / 365);
+            $daysold -= $yearsold * 365;
 
             $result .= ";\n $font";
             my @age;
@@ -345,11 +348,10 @@ sub htmlizebugs {
     } else {
        @bugs = sort {$a<=>$b} @bugs;
     }
+    my %seenmerged;
     foreach my $bug (@bugs) {
        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_include) {
            my $okay = 0;
            foreach my $t (split /\s+/, $status{tags}) {
@@ -381,6 +383,10 @@ sub htmlizebugs {
        next if grep { $_ eq $status{pending} } @common_pending_exclude;
        next if grep { $_ eq $status{severity} } @common_severity_exclude;
 
+       my @merged = sort {$a<=>$b} ($bug, split(/ /, $status{mergedwith}));
+       next unless ($common_repeatmerged || !$seenmerged{$merged[0]});
+       $seenmerged{$merged[0]} = 1;
+
        my $html = sprintf "<li><a href=\"%s\">#%d: %s</a>\n<br>",
            bugurl($bug), $bug, htmlsanit($status{subject});
        $html .= htmlindexentrystatus(\%status) . "\n";
@@ -433,9 +439,10 @@ sub countbugs {
     while(<I>) 
     {
         if (m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.*)$/) {
-            my $x = $bugfunc->(pkg => $1, bug => $2, status => $4, 
+            my @x = $bugfunc->(pkg => $1, bug => $2, status => $4, 
                                submitter => $5, severity => $6, tags => $7);
-           $count{$x}++;
+            local $_;
+            $count{$_}++ foreach @x;
        }
     }
     close I;