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";
15 my $NMUfile = "/debian/home/doogie/public_html/incoming/bugs_closed";
16 $NMUfile = "/debian/home/doogie/chgscan/db/bugs_closed"; # Changed as of request by dark -Joey, 99/11/22
17 $NMUfile = "http://auric.debian.org/~doogie/incoming/bugs_closed"; # Changed as of request by dark -Joey, 99/11/22
27 $0 [-V] [-h] [-H] [-l] [-s] [-d distrib] [-S file] [-C file]
30 -h show some (hopefully) helpful information
31 -H produce HTML output
32 -l list all release-critical bugs
33 -s list bug statistics
34 -t show bugs relevant for testing only
35 -d only list these distributions (comma-separated)
36 -S use different statusfile
41 sub PrintPackageHeader() {
42 my $p = shift; # Package to print
43 my ($name, $email); # Name & email of maintainer
46 print "<div class=\"package\"><pre>";
47 print "<a name=\"$p\"><strong>Package:</strong></a> " . scanlib::wwwname($p);
48 print " ($scanlib::section{$p}).\n";
49 print "<strong>Maintainer:</strong> ";
50 if (defined($scanlib::maintainer{$p})) {
51 if ($scanlib::maintainer{$p} =~ /(.*) <([^>]*)>/) {
52 ($name,$email) = ($1,$2);
53 } elsif ($scanlib::maintainer{$p} =~ /<(.*) \((.*)\)>/) {
54 ($name,$email) = ($1,$2);
55 } elsif ($scanlib::maintainer{$p} =~ /<(.*)>/) {
58 print "$name <<a href=\"http://bugs.debian.org/$email\">$email</A>>\n";
63 print "\nPackage: $p ($scanlib::section{$p})\n";
64 print "Maintainer: " . (defined($scanlib::maintainer{$p}) ? $scanlib::maintainer{$p} : "unknown") . "\n";
68 sub PrintPackageFooter() {
69 my $p = shift; # Package to print
72 print "</pre></div>\n";
77 my $p; # Index variable
78 my $nr; # Current bugnumber
79 my $sect; # BTS-subsection for bugnumber
80 my $header; # Flag if packagename has already been printed
82 for my $p (sort {$a cmp $b} keys %scanlib::packagelist) {
83 next if (defined $bugcfg::exclude{$p});
85 for $nr (sort @{$scanlib::packagelist{$p}}) {
86 next if (defined $bugcfg::exclude{$nr});
89 &PrintPackageHeader($p);
93 my $worry = scanlib::check_worry($scanlib::bugs{$nr});
95 if ($scanlib::bugs{$nr} =~ m/ \[[^]]*X/) {
96 print '<span style="color: #808080">';
97 } elsif ($scanlib::bugs{$nr} =~ m/^\[[^]]*P/) {
98 print '<span style="color: #f040d0">';
99 } elsif ($scanlib::bugs{$nr} =~ m/^\[[^]]*\+/) {
100 print '<span style="color: #00aa00">';
101 } elsif ($scanlib::bugs{$nr} =~ m/^\[[^]]*H/) {
102 print '<span style="color: #ffaa30">';
104 print "<strike>" if ($scanlib::bugs{$nr} =~ m/^\[.......I\]/);
105 print "<em class=\"worry\">" if $worry;
106 ($sect=$nr) =~ s/([0-9]{2}).*/$1/;
107 print "<A NAME=\"$nr\"></A> " . scanlib::wwwnumber($nr) . ' ' .
108 scanlib::htmlsanit($scanlib::bugs{$nr}) . "\n";
109 print "</em>" if $worry;
110 print "</strike>" if ($scanlib::bugs{$nr} =~ m/^\[.......I\]/);
112 printf(" %-6d %s\n", $nr, $scanlib::bugs{$nr});
114 print "[FIX] Fixed by package " . $scanlib::NMU{$nr, "source"} . ", version " . $scanlib::NMU{$nr, "version"} . " in Incoming\n" if (defined $scanlib::NMU{$nr});
115 print "</span>" if ($html && ($scanlib::bugs{$nr} =~ m/^\[[^]]*[H+P]/ ||
116 $scanlib::bugs{$nr} =~ m/ \[[^]]*X/));
119 &PrintPackageFooter($p);
125 sub MakeStatistics() {
126 my $bugcount=0; # Total number of bugs so far
127 my $patchtotal=0; # Total number of bugs marked patch
128 my $pendingtotal=0; # Total number of bugs marked pending
129 my $ignoretotal=0; # Total number of bugs marked ignore
130 my $nottestingtotal=0; # Total number of bugs on packages not in testing
131 my $worrytotal=0; # Total number of bugs we're actually worried about
132 my %list; # List of bugnumber associated with package
134 for my $p (sort keys %scanlib::packagelist) {
135 my $count = 0; # Number of bugs for this package
137 next if (defined $scanlib::exclude{$p});
138 for my $nr (@{$scanlib::packagelist{$p}}) {
139 $pendingtotal++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*P/);
140 $patchtotal++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*\+/);
141 $ignoretotal++ if ($scanlib::bugs{$nr} =~ m/^\[[^]]*I/);
142 $nottestingtotal++ if ($scanlib::bugs{$nr} =~ m/ \[[^]]*X/);
143 $worrytotal++ if (scanlib::check_worry($scanlib::bugs{$nr}));
145 if (not defined($scanlib::exclude{$nr})) {
153 print "<strong>Total number of release-critical bugs:</strong> $bugcount<BR>\n";
154 printf("<strong>Number that have a patch:</strong> %d<BR>\n", $patchtotal);
155 printf("<strong>Number that have a fix prepared and waiting to upload:</strong> %d<BR>\n", $pendingtotal);
156 printf("<strong>Number that are being ignored:</strong> %d<BR>\n", $ignoretotal);
157 printf("<strong>Number on packages not in testing:</strong> %d<BR>\n", $nottestingtotal);
158 printf("<strong>Number concerning the next release (excluding ignored and not-in-testing):</strong> %d<P>\n", $worrytotal);
160 print "Total number of release-critical bugs: $bugcount\n";
161 printf("Number that have a patch: %d\n", $patchtotal);
162 printf("Number that have a fix prepared and waiting to upload: %d\n", $pendingtotal);
163 printf("Number that are being ignored: %d\n", $ignoretotal);
164 printf("Number on packages not in testing: %d\n", $nottestingtotal);
165 printf("Number concerning the next release (excluding ignored and not-in-testing): %d\n", $worrytotal);
170 sub FilterPackages($) {
171 my $filter = shift; # Distribution we want to keep
173 for my $p (sort keys %scanlib::packagelist) {
174 delete $scanlib::packagelist{$p} unless ($scanlib::section{$p} =~ m/^$filter/);
179 for my $p (sort keys %scanlib::packagelist) {
180 $scanlib::packagelist{$p} = [ grep { scanlib::check_worry($scanlib::bugs{$_}) } @{$scanlib::packagelist{$p}} ];
181 delete $scanlib::packagelist{$p} if (scalar @{$scanlib::packagelist{$p}} == 0);
185 our ($opt_h,$opt_V,$opt_S,$opt_H,$opt_d,$opt_t,$opt_s,$opt_l);
187 getopts('VhHlstd:S:');
188 ShowUsage if ($opt_h);
189 ShowVersion if ($opt_V);
190 $statusfile=$opt_S if ($opt_S);
193 scanlib::readstatus($statusfile);
194 # scanlib::readNMUstatus($NMUfile);
196 FilterPackages($opt_d) if ($opt_d);
197 FilterBugs() if ($opt_t);
199 MakeStatistics if ($opt_s);