f9654bbd03aefb2e94070aa96737de20ac731c18
[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 use strict;
10 use warnings;
11
12 my $Version             = "BugReport 1.4\nCopyright (C) 1998-2002 Wichert Akkerman <wakkerma\@debian.org>\n";
13 my $html                = 0;
14 my $statusfile          = "status";
15 my $commentsfile        = "comments";
16 my $NMUfile             = "/debian/home/doogie/public_html/incoming/bugs_closed";
17 $NMUfile                = "/debian/home/doogie/chgscan/db/bugs_closed"; # Changed as of request by dark  -Joey, 99/11/22
18 $NMUfile                = "http://auric.debian.org/~doogie/incoming/bugs_closed"; # Changed as of request by dark  -Joey, 99/11/22
19
20 sub ShowVersion() {
21         print "$Version\n";
22         exit 0;
23 }
24
25 sub ShowUsage() {
26         print <<EOF;
27 Usage:
28   $0 [-V] [-h] [-H] [-l] [-s] [-d distrib] [-S file] [-C file]
29 Options:
30   -V    show version
31   -h    show some (hopefully) helpful information
32   -H    produce HTML output
33   -l    list all release-critical bugs
34   -s    list bug statistics
35   -t    show bugs relevant for testing only
36   -d    only list these distributions (comma-separated)
37   -S    use different statusfile
38   -C    use different commentsfile
39 EOF
40         exit 0;
41 }
42
43 sub PrintPackageHeader() {
44         my $p   = shift;        # Package to print
45         my ($name, $email);     # Name & email of maintainer
46
47         if ($html) {
48                 print "<div class=\"package\"><pre>";
49                 print "<a name=\"$p\"><strong>Package:</strong></a> " . scanlib::wwwname($p);
50                 print " ($scanlib::section{$p}).\n";
51                 print "<strong>Maintainer:</strong> ";
52                 if (defined($scanlib::maintainer{$p})) {
53                         if ($scanlib::maintainer{$p} =~ /(.*) <([^>]*)>/) {
54                                 ($name,$email) = ($1,$2);
55                         } elsif ($scanlib::maintainer{$p} =~ /<(.*) \((.*)\)>/) {
56                                 ($name,$email) = ($1,$2);
57                         } elsif ($scanlib::maintainer{$p} =~ /<(.*)>/) {
58                                 $name = $email = $1;
59                         }
60                         print "$name &lt;<a href=\"http://bugs.debian.org/$email\">$email</A>&gt;\n";
61                 } else {
62                         print "unknown\n";
63                 }
64         } else {
65                 print "\nPackage: $p ($scanlib::section{$p})\n";
66                 print "Maintainer: " . (defined($scanlib::maintainer{$p}) ? $scanlib::maintainer{$p} : "unknown") . "\n";
67         }
68 }
69
70 sub PrintPackageFooter() {
71         my $p   = shift;        # Package to print
72
73         if ($html) {
74                 print "</pre></div>\n";
75         }
76 }
77
78 sub MakeBuglist() {
79         my $p;                          # Index variable
80         my $nr;                 # Current bugnumber
81         my $sect;                       # BTS-subsection for bugnumber
82         my $header;             # Flag if packagename has already been printed
83         my $fontset;            # Did we change the font?
84
85         for my $p (sort {$a->[0] <=> $b->[0]} keys %scanlib::packagelist) {
86                 next if (defined $bugcfg::exclude{$p});
87                 $header = 0;
88                 $fontset = 0;
89                 if (defined $scanlib::comments{$p}) {
90                         if ($html && defined($scanlib::comments{$p})) {
91                                 if ($scanlib::comments{$p} =~ m/^\[REMOVE\]/) {
92                                         $fontset=1;
93                                         print "<span style=\"color: red\">";
94                                 }
95                         }
96                         $header=1;
97                         &PrintPackageHeader($p);
98                         print $scanlib::comments{$p};
99                 }