| 1 |
#! /usr/bin/perl -w |
| 2 |
|
| 3 |
use warnings; |
| 4 |
use strict; |
| 5 |
|
| 6 |
use Debbugs::Config qw(:globals); |
| 7 |
use Debbugs::Status qw(get_bug_status splitpackages); |
| 8 |
use Debbugs::Bugs qw(count_bugs); |
| 9 |
|
| 10 |
my %strong = map { $_ => 1 } @gStrongSeverities; |
| 11 |
|
| 12 |
my %impbugs = count_bugs(function => sub { |
| 13 |
my %d = @_; |
| 14 |
|
| 15 |
# Fast checks. |
| 16 |
return () if $d{status} eq 'done' or not $strong{$d{severity}}; |
| 17 |
my %tags = map { $_ => 1 } split ' ', $d{tags}; |
| 18 |
return () if $tags{fixed} or $tags{'etch-ignore'}; |
| 19 |
return () if ($tags{potato} or $tags{woody} or $tags{sarge} or $tags{etch} or $tags{experimental}) and not $tags{sid}; |
| 20 |
|
| 21 |
# Unfortunately mergedwith isn't indexed. |
| 22 |
my $status = get_bug_status(bug => $d{bug}); |
| 23 |
my @merged = sort split ' ', $status->{mergedwith}; |
| 24 |
return () if @merged and $merged[0] < $d{bug}; |
| 25 |
|
| 26 |
return splitpackages($d{pkg}); |
| 27 |
}); |
| 28 |
|
| 29 |
open IMPBUGS, '> /org/bugs.debian.org/www/stats/impbugs.txt.new' |
| 30 |
or die "can't open impbugs.txt.new: $!"; |
| 31 |
for my $pkg (reverse sort keys %impbugs) { |
| 32 |
print IMPBUGS "$pkg $impbugs{$pkg}\n" or die "can't write to impbugs.txt.new: $!"; |
| 33 |
} |
| 34 |
close IMPBUGS or die "can't close impbugs.txt.new: $!"; |
| 35 |
rename '/org/bugs.debian.org/www/stats/impbugs.txt.new', '/org/bugs.debian.org/www/stats/impbugs.txt' |
| 36 |
or die "can't rename impbugs.txt.new to impbugs.txt: $!"; |