]> git.donarmstrong.com Git - bugscan.git/blob - bugreport
Added ignores for the data bugscan spits out.
[bugscan.git] / bugreport
1 #!/usr/bin/perl
2 # vim: ts=4 sw=4 nowrap
3
4 # Generate a report of the release-critical bugs for packages
5
6 use Getopt::Std;
7 require scanlib;
8 require bugcfg;
9
10 $Version                = "BugReport 1.4\nCopyright (C) 1998-2002 Wichert Akkerman <wakkerma\@debian.org>\n";
11 $html                   = 0;
12 $statusfile             = "status";
13 $commentsfile   = "comments";
14 $NMUfile                = "/debian/home/doogie/public_html/incoming/bugs_closed";
15 $NMUfile                = "/debian/home/doogie/chgscan/db/bugs_closed"; # Changed as of request by dark  -Joey, 99/11/22
16 $NMUfile                = "http://auric.debian.org/~doogie/incoming/bugs_closed"; # Changed as of request by dark  -Joey, 99/11/22
17
18 sub ShowVersion() {
19         print "$Version\n";
20         exit 0;
21 }
22
23 sub ShowUsage() {
24         print <<EOF;
25 Usage:
26   $0 [-V] [-h] [-H] [-l] [-s] [-d distrib] [-S file] [-C file]
27 Options:
28   -V    show version
29   -h    show some (hopefully) helpful information
30   -H    produce HTML output
31   -l    list all release-critical bugs
32   -s    list bug statistics
33   -t    show bugs relevant for testing only
34   -d    only list these distributions (comma-separated)
35   -S    use different statusfile
36   -C    use different commentsfile
37 EOF
38         exit 0;
39 }
40
41 sub PrintPackageHeader() {
42         local($p)       = shift;        # Package to print
43         local ($name, $email);  # Name & email of maintainer
44
45         if ($html) {
46             print "<div class=\"package\"><pre>";
47                 print "<a name=\"$p\"><strong>Package:</strong></a> " . &wwwname($p);
48                 print " ($section{$p}).\n";
49                 print "<strong>Maintainer:</strong> ";
50                 if (defined($maintainer{$p})) {
51                         $_ = $maintainer{$p};
52                         ($name,$email) = m/(.*) <([^>]*)>/;
53                         print "$name &lt;<a href=\"http://bugs.debian.org/$email\">$email</A>&gt;\n";
54                 } else {
55                         print "unknown\n";
56                 }
57         } else {
58                 print "\nPackage: $p ($section{$p})\n";
59                 print "Maintainer: " . (defined($maintainer{$p}) ? $maintainer{$p} : "unknown") . "\n";
60         }
61 }
62
63 sub PrintPackageFooter() {
64         local($p)       = shift;        # Package to print
65
66         if ($html) {
67                 print "</pre></div>\n";
68         }
69 }
70
71 sub MakeBuglist() {
72         local ($p);                             # Index variable
73         local ($nr);                    # Current bugnumber
74         local ($sect);                  # BTS-subsection for bugnumber
75         local ($header);                # Flag if packagename has already been printed
76         local ($fontset);               # Did we change the font?
77
78         for $p (sort {$a cmp $b} keys %packagelist) {
79                 next if (defined $exclude{$p});
80                 $header = 0;
81                 $fontset = 0;
82                 if (defined $comments{$p}) {
83                         if ($html && defined($comments{$p})) {
84                                 if ($comments{$p} =~ m/^\[REMOVE\]/) {
85                                         $fontset=1;
86                                         print "<span style=\"color: red\">";
87                                 }
88                         }
89                         $header=1;
90                         &PrintPackageHeader($p);
91                         print $comments{$p};
92                 }
93                 for $nr (sort split(/ /, $packagelist{$p})) {
94                         next if (defined $exclude{$nr});
95                         if (! $header) {
96                                 $header = 1;
97                                 &PrintPackageHeader($p);
98                         }
99
100                         if ($html) {
101                             $worry = 1;
102                                 if ($bugs{$nr} =~ m/^\[[^]]*I/ or
103                                         $bugs{$nr} =~ m/ \[[^]]*X/ or
104                                         ($bugs{$nr} =~ m/ \[[^]]*[OSUE]/ and $bugs{$nr} !~ m/ \[[^]]*T/)) {
105                                         $worry = 0;
106                                 }
107                         
108                                 if ($bugs{$nr} =~ m/ \[[^]]*X/) {
109                                         print '<span style="color: #808080">';
110                                 } elsif ($bugs{$nr} =~ m/^\[[^]]*P/) {
111                                         print '<span style="color: #f040d0">';
112                                 } elsif ($bugs{$nr} =~ m/^\[[^]]*\+/) {
113                                         print '<span style="color: #00aa00">';
114                                 } elsif ($bugs{$nr} =~ m/^\[[^]]*H/) {
115                                         print '<span style="color: #ffaa30">';
116                                 }
117                                 print "<strike>" if ($bugs{$nr} =~ m/^\[.......I\]/);
118                                 print "<em class=\"worry\">" if $worry;
119                                 ($sect=$nr) =~ s/([0-9]{2}).*/$1/;
120                                 print "<A NAME=\"$nr\"></A>  " . &wwwnumber($nr) . ' ' .
121                                           htmlsanit($bugs{$nr}) . "\n";
122                                 print "</em>" if $worry;
123                                 print "</strike>" if ($bugs{$nr} =~ m/^\[.......I\]/);
124                         } else {
125                                 printf("  %-6d %s\n", $nr, $bugs{$nr});
126                         }
127                         print $comments{$nr} if (defined($comments{$nr}));
128                         print "[FIX] Fixed by package " . $NMU{$nr, "source"} . ", version " . $NMU{$nr, "version"} . " in Incoming\n" if (defined $NMU{$nr});
129                         print "</span>" if ($html && ($bugs{$nr} =~ m/^\[[^]]*[H+P]/ ||
130                                                       $bugs{$nr} =~ m/ \[[^]]*X/));
131                 }
132                 print "</span>" if ($fontset);
133                 if ($header) {
134                         &PrintPackageFooter($p);
135                 }
136         }
137 }
138
139
140 sub MakeStatistics() {
141         local($bugcount);               # Total number of bugs so far
142         local($count);                  # Number of bugs for this package
143         local($remtotal);               # Total number of bugs for packages marked REMOVE
144         local($patchtotal);             # Total number of bugs marked patch
145         local($pendingtotal);           # Total number of bugs marked pending
146         local($ignoretotal);            # Total number of bugs marked ignore
147         local($nottestingtotal);        # Total number of bugs on packages not in testing
148         local($worrytotal);             # Total number of bugs we're actually worried about
149         local($p);                              # Index variable
150         local(%list);                   # List of bugnumber associated with package
151
152         $bugcount=0;
153         for $p (sort keys %packagelist) {
154                 next if (defined $exclude{$p});
155                 $count=0;
156                 for $nr (split(/ /, $packagelist{$p})) {
157                         $pendingtotal++ if ($bugs{$nr} =~ m/^\[[^]]*P/);
158                         $patchtotal++ if ($bugs{$nr} =~ m/^\[[^]]*\+/);
159                         $ignoretotal++ if ($bugs{$nr} =~ m/^\[[^]]*I/);
160                         $nottestingtotal++ if ($bugs{$nr} =~ m/ \[[^]]*X/);
161                         $worrytotal++ unless (
162                                 $bugs{$nr} =~ m/^\[[^]]*I/ or
163                                 $bugs{$nr} =~ m/ \[[^]]*X/ or
164                                 ($bugs{$nr} =~ m/ \[[^]]*[OSUE]/ and $bugs{$nr} !~ m/ \[[^]]*T/));
165
166                         if (not defined($exclude{$nr})) {
167                                 $bugcount++;
168                                 $count++;
169                         } 
170                 }
171                 $remtotal+=$count if (defined($comments{$p}) && $comments{$p} =~ m/^\[REMOVE\]/);
172         }
173
174         if ($html) {
175                 print "<strong>Total number of release-critical bugs:</strong> $bugcount<BR>\n";
176                 printf("<strong>Number that will disappear after removing packages marked [REMOVE]:</strong> %d<BR>\n", $remtotal);
177                 printf("<strong>Number that have a patch:</strong> %d<BR>\n", $patchtotal);
178                 printf("<strong>Number that have a fix prepared and waiting to upload:</strong> %d<BR>\n", $pendingtotal);
179                 printf("<strong>Number that are being ignored:</strong> %d<BR>\n", $ignoretotal);
180                 printf("<strong>Number on packages not in testing:</strong> %d<BR>\n", $nottestingtotal);
181                 printf("<strong>Number concerning the next release (excluding ignored and not-in-testing):</strong> %d<P>\n", $worrytotal);
182         } else {
183                 print "Total number of release-critical bugs: $bugcount\n";
184                 printf("Number that will disappear after removing packages marked [REMOVE]: %d\n", $remtotal);
185                 printf("Number that have a patch: %d\n", $patchtotal);
186                 printf("Number that have a fix prepared and waiting to upload: %d\n", $pendingtotal);
187                 printf("Number that are being ignored: %d\n", $ignoretotal);
188                 printf("Number on packages not in testing: %d\n", $nottestingtotal);
189                 printf("Number concerning the next release (excluding ignored and not-in-testing): %d\n", $worrytotal);
190         }
191 }
192
193
194 sub FilterPackages() {
195         local($filter) = shift;         # Distribution we want to keep
196
197         for $p (sort keys %packagelist) {
198                 delete $packagelist{$p} unless ($section{$p} =~ m/^$filter/);
199         }
200 }
201
202 sub FilterBugs() {
203         for $p (sort keys %packagelist) {
204                 $packagelist{$p} = join(' ', grep { check_worry($bugs{$_}) } split / /, $packagelist{$p});
205                 delete $packagelist{$p} if ($packagelist{$p} eq '');
206         }
207 }
208
209 getopts('VhHlstd:S:C:');
210 ShowUsage if ($opt_h);
211 ShowVersion if ($opt_V);
212 $statusfile=$opt_S if ($opt_S);
213 $commentsfile=$opt_C if ($opt_C);
214 $html=1 if ($opt_H);
215
216 &readstatus($statusfile);
217 &readcomments($commentsfile);
218 &readNMUstatus($NMUfile);
219
220 &FilterPackages($opt_d) if ($opt_d);
221 &FilterBugs() if ($opt_t);
222
223 MakeStatistics if ($opt_s);
224 if ($opt_l) {
225         MakeBuglist 
226 }
227
228 exit 0;
229