]> git.donarmstrong.com Git - bugscan.git/blob - bugcounts
Version tracking is quite pervasive now, so update the description.
[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 my $commentsfile        = "comments";
15
16 sub ShowVersion() {
17         print "$Version\n";
18         exit 0;
19 }
20
21 sub ShowUsage() {
22         print <<EOF;
23 Usage:
24   $0 [-V] [-h] [-S file] [-C file]
25 Options:
26   -V    show version
27   -h    show some (hopefully) helpfull information
28   -S    use different statusfile
29   -C    use different commentsfile
30 EOF
31         exit 0;
32 }
33
34 our ($opt_h,$opt_V,$opt_S,$opt_C);
35
36 getopts('VhS:C:');
37 ShowUsage if ($opt_h);
38 ShowVersion if ($opt_V);
39 $statusfile=$opt_S if ($opt_S);
40 $commentsfile=$opt_C if ($opt_C);
41
42 scanlib::readstatus($statusfile);
43 scanlib::readcomments($commentsfile);
44
45 my $total=0;            # total number of bugs
46 my $patchcount=0;       # Number of bugs that have a fix proposed
47 my $pendingcount=0;     # Number of bugs that will have a fix uploaded RSN
48 my $ignorecount=0;      # Number of bugs being ignored
49 my $nottestingcount=0;  # Number of bugs on packages not in testing
50 my $worrycount=0;       # Number of bugs we're actually worried about
51 my %sectcount=();       # Bugs per type
52
53 for my $p (keys %scanlib::packagelist) {
54         next if (defined $bugcfg::exclude{$p});
55         for my $nr (sort @{$scanlib::packagelist{$p}}) {
56                 next if (defined $bugcfg::exclude{$nr});
57                 $total++;
58                 $pendingcount++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*P/);
59                 $patchcount++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*\+/);
60                 $ignorecount++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*I/);
61                 $nottestingcount++ if ($scanlib::bugs{$nr} =~ m/ \[[^]]*X/);
62                 if (defined $scanlib::comments{$nr}) {
63                         my $sect = ($scanlib::comments{$nr} =~ m/\[([^]]*)\]/);
64                         $sectcount{$sect}++;
65                 }
66                 $worrycount++ if (scanlib::check_worry($scanlib::bugs{$nr}));
67         }
68 }
69
70 printf("%d %d %d 0 %d %d %d\n", $total, $pendingcount, $patchcount, $ignorecount, $nottestingcount, $worrycount);