2 # vim: ts=4 sw=4 nowrap
4 # Generate a report of the release-critical bugs for packages
12 my $Version = "BugReport 1.4\nCopyright (C) 1998-2002 Wichert Akkerman <wakkerma\@debian.org>\n";
14 my $statusfile = "status";
24 $0 [-V] [-h] [-H] [-l] [-s] [-d distrib] [-S file] [-C file]
27 -h show some (hopefully) helpful information
28 -H produce HTML output
29 -l list all release-critical bugs
30 -s list bug statistics
31 -t show bugs relevant for testing only
32 -d only list these distributions (comma-separated)
33 -S use different statusfile
38 sub PrintPackageHeader() {
39 my $p = shift; # Package to print
40 my ($name, $email); # Name & email of maintainer
43 print "<div class=\"package\"><pre>";
44 print "<a name=\"$p\"><strong>Package:</strong></a> " . scanlib::wwwname($p);
45 if (defined($scanlib::section{$p})) {
46 print " ($scanlib::section{$p}).\n";
48 print " (unknown).\n";
50 print "<strong>Maintainer:</strong> ";
51 if (exists($scanlib::maintainer{$p}) && $scanlib::maintainer{$p} ne '') {
52 if ($scanlib::maintainer{$p} =~ /(.*) <([^>]*)>/) {
53 ($name,$email) = ($1,$2);
54 } elsif ($scanlib::maintainer{$p} =~ /<(.*) \((.*)\)>/) {
55 ($name,$email) = ($1,$2);
56 } elsif ($scanlib::maintainer{$p} =~ /<(.*)>/) {
60 print "$name <<a href=\"http://bugs.debian.org/$email\">$email</A>>\n";
62 print "$scanlib::maintainer{$p}\n";
68 print "\nPackage: $p ($scanlib::section{$p})\n";
69 print "Maintainer: " . (defined($scanlib::maintainer{$p}) ? $scanlib::maintainer{$p} : "unknown") . "\n";
73 sub PrintPackageFooter() {
74 my $p = shift; # Package to print
77 print "</pre></div>\n";
82 my $p; # Index variable
83 my $nr; # Current bugnumber
84 my $sect; # BTS-subsection for bugnumber
85 my $header; # Flag if packagename has already been printed
87 for my $p (sort {$a cmp $b} keys %scanlib::packagelist) {
89 for $nr (sort @{$scanlib::packagelist{$p}}) {
92 &PrintPackageHeader($p);
96 my $worry = scanlib::check_worry($scanlib::bugs{$nr});
98 if ($scanlib::bugs{$nr}->{'pending'}) {
99 print '<span style="color: #f040d0">';
100 } elsif ($scanlib::bugs{$nr}->{'patch'}) {
101 print '<span style="color: #00aa00">';
102 } elsif ($scanlib::bugs{$nr}->{'help'}) {
103 print '<span style="color: #ffaa30">';
105 print "<strike>" if ($scanlib::bugs{$nr}->{'sarge-ignore'} || $scanlib::bugs{$nr}->{'etch-ignore'});
106 print "<em class=\"worry\">" if $worry;
107 ($sect=$nr) =~ s/([0-9]{2}).*/$1/;
108 printf "<A NAME=\"$nr\"></A> %s [%s] [%s] %s\n", scanlib::wwwnumber($nr),
109 scanlib::get_taginfo($scanlib::bugs{$nr}),
110 scanlib::get_relinfo($scanlib::bugs{$nr}),
111 scanlib::htmlsanit($scanlib::bugs{$nr}->{'subject'});
112 print "</em>" if $worry;
113 print "</strike>" if ($scanlib::bugs{$nr}->{'sarge-ignore'} || $scanlib::bugs{$nr}->{'etch-ignore'});
115 printf(" %-6d [%s] [%s] %s\n", $nr, scanlib::get_taginfo($scanlib::bugs{$nr}),
116 scanlib::get_relinfo($scanlib::bugs{$nr}), $scanlib::bugs{$nr}->{'subject'});
118 print "</span>" if ($html && ($scanlib::bugs{$nr}->{'pending'} ||
119 $scanlib::bugs{$nr}->{'patch'} ||
120 $scanlib::bugs{$nr}->{'help'}));
123 &PrintPackageFooter($p);
129 sub MakeStatistics() {
130 my $bugcount=0; # Total number of bugs so far
131 my $patchtotal=0; # Total number of bugs marked patch
132 my $pendingtotal=0; # Total number of bugs marked pending
133 my $ignoretotal=0; # Total number of bugs marked ignore
134 my $worrytotal=0; # Total number of bugs we're actually worried about
135 my $stabletotal=0; # Total number of bugs affecting stable
136 my %list; # List of bugnumber associated with package
138 for my $p (sort keys %scanlib::packagelist) {
139 my $count = 0; # Number of bugs for this package
141 for my $nr (@{$scanlib::packagelist{$p}}) {
142 $pendingtotal++ if ($scanlib::bugs{$nr}->{'pending'});
143 $patchtotal++ if ($scanlib::bugs{$nr}->{'patch'});
144 $ignoretotal++ if ($scanlib::bugs{$nr}->{'sarge-ignore'} || $scanlib::bugs{$nr}->{'etch-ignore'});
145 $worrytotal++ if (scanlib::check_worry($scanlib::bugs{$nr}));
146 $stabletotal++ if (scanlib::check_worry_stable($scanlib::bugs{$nr}));
154 print "<strong>Total number of release-critical bugs:</strong> $bugcount<BR>\n";
155 printf("<strong>Number that have a patch:</strong> %d<BR>\n", $patchtotal);
156 printf("<strong>Number that have a fix prepared and waiting to upload:</strong> %d<BR>\n", $pendingtotal);
157 printf("<strong>Number that are being ignored:</strong> %d<BR>\n", $ignoretotal);
158 printf("<strong>Number concerning the current stable release:</strong> %d<BR>\n", $stabletotal);
159 printf("<strong>Number concerning the next release (excluding ignored and not-in-testing):</strong> %d<P>\n", $worrytotal);
161 print "Total number of release-critical bugs: $bugcount\n";
162 printf("Number that have a patch: %d\n", $patchtotal);
163 printf("Number that have a fix prepared and waiting to upload: %d\n", $pendingtotal);
164 printf("Number that are being ignored: %d\n", $ignoretotal);
165 printf("Number concerning the current stable release: %d\n", $stabletotal);
166 printf("Number concerning the next release (excluding ignored and not-in-testing): %d\n", $worrytotal);
171 sub FilterPackages($) {
172 my $filter = shift; # Distribution we want to keep
174 for my $p (sort keys %scanlib::packagelist) {
175 delete $scanlib::packagelist{$p} unless ($scanlib::section{$p} =~ m/^$filter/);
180 for my $p (sort keys %scanlib::packagelist) {
181 $scanlib::packagelist{$p} = [ grep { scanlib::check_worry($scanlib::bugs{$_}) } @{$scanlib::packagelist{$p}} ];
182 delete $scanlib::packagelist{$p} if (scalar @{$scanlib::packagelist{$p}} == 0);
186 our ($opt_h,$opt_V,$opt_S,$opt_H,$opt_d,$opt_t,$opt_s,$opt_l);
188 getopts('VhHlstd:S:');
189 ShowUsage if ($opt_h);
190 ShowVersion if ($opt_V);
191 $statusfile=$opt_S if ($opt_S);
194 scanlib::readstatus($statusfile);
196 FilterPackages($opt_d) if ($opt_d);
197 FilterBugs() if ($opt_t);
199 MakeStatistics if ($opt_s);