]> git.donarmstrong.com Git - bugscan.git/blob - make-britney-counts
Output testing/unstable counts britney can use.
[bugscan.git] / make-britney-counts
1 #!/usr/bin/perl
2 # vim: ts=8 sw=8 nowrap
3
4 # Generate a report britney can use
5
6 use Getopt::Std;
7 require scanlib;
8 require bugcfg;
9 use strict;
10 # use warnings;
11
12 my $Version             = "make-britney-count 1.0\nCopyright (C) Steinar H. Gunderson <sesse\@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]
24 Options:
25   -V    show version
26   -h    show this screen
27   -S    use a different status file
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 %testingbugs = ();
42 my %unstablebugs = ();
43
44 for my $bug (values %scanlib::bugs) {
45         for my $package (split /[,\s]+/, $bug->{'package'}) {
46                 $package =~ y/A-Z/a-z/;
47                 $package = $` if ($package =~ /[^-+._a-z0-9]/);
48
49                 if (scanlib::check_worry_unstable($bug)) {
50                         ++$unstablebugs{$package};
51                 }
52                 if (scanlib::check_worry($bug)) {
53                         ++$testingbugs{$package};
54                 }
55         }
56 }
57
58 open TESTING, ">", "britney/testing"
59         or die "britney/testing: $!";
60 for my $pkg (sort keys %testingbugs) {
61         print TESTING "$pkg $testingbugs{$pkg}\n";
62 }
63 close TESTING;
64
65 open UNSTABLE, ">", "britney/unstable"
66         or die "britney/unstable: $!";
67 for my $pkg (sort keys %unstablebugs) {
68         print UNSTABLE "$pkg $unstablebugs{$pkg}\n";
69 }
70 close UNSTABLE;
71
72 exit 0;
73