]> git.donarmstrong.com Git - bugscan.git/blob - bugcounts
4c2200533232dddbf03e1dba35790b7745796bd4
[bugscan.git] / bugcounts
1 #! /usr/bin/perl
2 # vim: ts=4 sw=4 nowrap
3
4 # Generate some counts for the bugreports
5
6 use Getopt::Std;
7 require scanlib;
8 require bugcfg;
9 use strict;
10 use warnings;
11
12 my $Version             = "BugCount 1.1\nCopyright (C) Wichert Akkerman <wakkerma\@debian.org>\n";
13 my $statusfile          = "status";
14
15 sub ShowVersion() {
16         print "$Version\n";
17         exit 0;
18 }
19
20 sub ShowUsage() {
21         print <<EOF;
22 Usage:
23   $0 [-V] [-h] [-S file] [-C file]
24 Options:
25   -V    show version
26   -h    show some (hopefully) helpfull information
27   -S    use different statusfile
28 EOF
29         exit 0;
30 }
31
32 our ($opt_h,$opt_V,$opt_S);
33
34 getopts('VhS:');
35 ShowUsage if ($opt_h);
36 ShowVersion if ($opt_V);
37 $statusfile=$opt_S if ($opt_S);
38
39 scanlib::readstatus($statusfile);
40
41 my $total=0;            # total number of bugs
42 my $patchcount=0;       # Number of bugs that have a fix proposed
43 my $pendingcount=0;     # Number of bugs that will have a fix uploaded RSN
44 my $ignorecount=0;      # Number of bugs being ignored
45 my $nottestingcount=0;  # Number of bugs on packages not in testing
46 my $worrycount=0;       # Number of bugs we're actually worried about
47
48 for my $p (keys %scanlib::packagelist) {
49         next if (defined $bugcfg::exclude{$p});
50         for my $nr (sort @{$scanlib::packagelist{$p}}) {
51                 next if (defined $bugcfg::exclude{$nr});
52                 $total++;
53                 $pendingcount++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*P/);
54                 $patchcount++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*\+/);
55                 $ignorecount++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*I/);
56                 $nottestingcount++ if ($scanlib::bugs{$nr} =~ m/ \[[^]]*X/);
57                 $worrycount++ if (scanlib::check_worry($scanlib::bugs{$nr}));
58         }
59 }
60
61 printf("%d %d %d 0 %d %d %d\n", $total, $pendingcount, $patchcount, $ignorecount, $nottestingcount, $worrycount);