]> git.donarmstrong.com Git - bugscan.git/blob - bugcounts
8792983eaa70c24f356d636a9586c40568332eb7
[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
10 $Version                = "BugCount 1.1\nCopyright (C) Wichert Akkerman <wakkerma\@debian.org>\n";
11 $statusfile             = "status";
12 $commentsfile   = "comments";
13
14 sub ShowVersion() {
15         print "$Version\n";
16         exit 0;
17 }
18
19 sub ShowUsage() {
20         print <<EOF;
21 Usage:
22   $0 [-V] [-h] [-S file] [-C file]
23 Options:
24   -V    show version
25   -h    show some (hopefully) helpfull information
26   -S    use different statusfile
27   -C    use different commentsfile
28 EOF
29         exit 0;
30 }
31
32 getopts('VhS:C:');
33 ShowUsage if ($opt_h);
34 ShowVersion if ($opt_V);
35 $statusfile=$opt_S if ($opt_S);
36 $commentsfile=$opt_C if ($opt_C);
37
38 &readstatus($statusfile);
39 &readcomments($commentsfile);
40
41 $total=0;                       # total number of bugs
42 $removecount=0;         # Number of bugs that will disappear if packages are removed
43 $patchcount=0;          # Number of bugs that have a fix proposed
44 $pendingcount=0;        # Number of bugs that will have a fix uploaded RSN
45 $ignorecount=0;         # Number of bugs being ignored
46 $nottestingcount=0;     # Number of bugs on packages not in testing
47 $worrycount=0;          # Number of bugs we're actually worried about
48 %sectcount=();          # Bugs per type
49
50 for $p (keys %packagelist) {
51         next if (defined $exclude{$p});
52         for $nr (sort split(/ /, $packagelist{$p})) {
53                 next if (defined $exclude{$nr});
54                 $total++;
55                 $pendingcount++ if ($bugs{$nr} =~ m/^\[[^]]*P/);
56                 $patchcount++ if ($bugs{$nr} =~ m/^\[[^]]*\+/);
57                 $ignorecount++ if ($bugs{$nr} =~ m/^\[[^]]*I/);
58                 $nottestingcount++ if ($bugs{$nr} =~ m/ \[[^]]*X/);
59                 if (defined $comments{$nr}) {
60                         ($sect) = ($comments{$nr} =~ m/\[([^]]*)\]/);
61                         $sectcount{$sect}++;
62                 }
63                 $worrycount++ unless (
64                         $bugs{$nr} =~ m/^\[[^]]*I/ or
65                         $bugs{$nr} =~ m/ \[[^]]*X/ or
66                         ($bugs{$nr} =~ m/ \[[^]]*[OSUE]/ and $bugs{$nr} !~ m/ \[[^]]*T/));
67         }
68
69         if (defined($comments{$p}) && $comments{$p} =~ m/^\[REMOVE\]/) {
70                 $removecount+=scalar(split(/ /,$packagelist{$p}));
71         }
72 }
73
74 printf("%d %d %d %d %d %d %d\n", $total, $pendingcount, $patchcount, $removecount, $ignorecount, $nottestingcount, $worrycount);