| 1 |
#!/usr/bin/perl
|
| 2 |
# Copyright (C) 2002 Igor Genibel
|
| 3 |
#
|
| 4 |
# This program is free software; you can redistribute it and/or
|
| 5 |
# modify it under the terms of the GNU General Public License
|
| 6 |
# as published by the Free Software Foundation; either version 2
|
| 7 |
# of the License, or (at your option) any later version.
|
| 8 |
#
|
| 9 |
# This program is distributed in the hope that it will be useful,
|
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
# GNU General Public License for more details.
|
| 13 |
#
|
| 14 |
# This code is currently maintained and debugged by Igor Genibel, any
|
| 15 |
# questions or comments regarding this code should be directed to:
|
| 16 |
# - igor@genibel.org
|
| 17 |
|
| 18 |
# This code is greatly inspired from Raphael Hertzog's script for PTS
|
| 19 |
# - Igor Genibel - http://genibel.org/
|
| 20 |
# $Id$
|
| 21 |
|
| 22 |
|
| 23 |
use strict;
|
| 24 |
my %stats;
|
| 25 |
my %stats_real;
|
| 26 |
my %sources;
|
| 27 |
my %merge_list;
|
| 28 |
my %seen;
|
| 29 |
|
| 30 |
open SOURCE,"<$ARGV[1]"
|
| 31 |
or die "Unable to open sources file";
|
| 32 |
|
| 33 |
while(defined($_=<SOURCE>)) {
|
| 34 |
$_=~s/\+/_/g;
|
| 35 |
my ($b, $s) = m/^(\S+)\s+\S+\s+(\S+)$/;
|
| 36 |
$sources{$b} = $s;
|
| 37 |
}
|
| 38 |
|
| 39 |
open BUGS,"<$ARGV[0]"
|
| 40 |
or die "Unable to open bugs file";
|
| 41 |
|
| 42 |
while (defined($_=<BUGS>)) {
|
| 43 |
$_=~s/\+/_/g;
|
| 44 |
chomp;
|
| 45 |
my ($p, $b, $st, $severity, $tags) = m/^(\S+) (\d+) \d+ (\S+) \[.*\] (\S+) (.*)$/;
|
| 46 |
my $nb_merge;
|
| 47 |
if (defined($p))
|
| 48 |
{
|
| 49 |
next if ($st =~ /done/);
|
| 50 |
$sources{$p} = $p if(!defined($sources{$p}));
|
| 51 |
$b =~ m/\d+(\d{2})$/;
|
| 52 |
open STATUS,"</org/bugs.debian.org/spool/db-h/$1/$b.status";
|
| 53 |
my $save = $/;
|
| 54 |
$/ = undef;
|
| 55 |
$nb_merge = 0;
|
| 56 |
my @lines = split /\n/, <STATUS>;
|
| 57 |
|
| 58 |
my @merge_list = split / /, $lines[8];
|
| 59 |
# Flag the bug as a merged one
|
| 60 |
foreach my $e (@merge_list)
|
| 61 |
{
|
| 62 |
$seen{$e} = 1;
|
| 63 |
}
|
| 64 |
# If bug number is flaged, don't count it
|
| 65 |
if ($seen{$b} == 1 ){
|
| 66 |
$nb_merge = 1;
|
| 67 |
}
|
| 68 |
#print "Package: $p, Bug Number: $b, nb_merge: $nb_merge\n";
|
| 69 |
close STATUS;
|
| 70 |
$/ = $save;
|
| 71 |
if ($tags =~ /\bpending\b/ or $tags =~ /\bfixed\b/ or $severity =~ /\bfixed\b/) {
|
| 72 |
$stats{$sources{$p}}{"fixed"}++;
|
| 73 |
$stats_real{$sources{$p}}{"fixed"}++;
|
| 74 |
$stats{$sources{$p}}{"fixed"}-=$nb_merge;
|
| 75 |
} else {
|
| 76 |
$stats{$sources{$p}}{$severity}++;
|
| 77 |
$stats_real{$sources{$p}}{$severity}++;
|
| 78 |
$stats{$sources{$p}}{$severity}-=$nb_merge;
|
| 79 |
}
|
| 80 |
} else {
|
| 81 |
print "Line badly formatted: $_\n";
|
| 82 |
}
|
| 83 |
}
|
| 84 |
|
| 85 |
foreach (keys %stats) {
|
| 86 |
my $grave = 0 + $stats{$_}{'critical'} + $stats{$_}{'grave'} + $stats{$_}{'serious'};
|
| 87 |
my $grave_real = 0 + $stats_real{$_}{'critical'} + $stats_real{$_}{'grave'} + $stats_real{$_}{'serious'};
|
| 88 |
my $normal = 0 + $stats{$_}{'normal'} + $stats{$_}{'important'};
|
| 89 |
my $normal_real = 0 + $stats_real{$_}{'normal'} + $stats_real{$_}{'important'};
|
| 90 |
my $wishlist = 0 + $stats{$_}{'wishlist'} + $stats{$_}{'minor'};
|
| 91 |
my $wishlist_real = 0 + $stats_real{$_}{'wishlist'} + $stats_real{$_}{'minor'};
|
| 92 |
my $fixed = 0 + $stats{$_}{'fixed'};
|
| 93 |
my $fixed_real = 0 + $stats_real{$_}{'fixed'};
|
| 94 |
print "$_ $grave($grave_real) $normal($normal_real) $wishlist($wishlist_real) $fixed($fixed_real)\n";
|
| 95 |
}
|
| 96 |
|