Added some code to peer into a data structure in Maemian/Schedule.pm. Also added the
[maemian] / nokia-lintian / depcheck / report2html.pl
1 #!/usr/bin/perl -w
2
3 # Copyright (C) 1998 Richard Braakman
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, you can find it on the World Wide
17 # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
18 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19 # MA 02110-1301, USA.
20
21 my %bugs;
22 if (my $buglist = shift) {
23     open(BUGS, '<', $buglist) or die($buglist);
24     while (<BUGS>) {
25         chop;
26         my $bugline = $_;
27         my @b;
28         while ($bugline =~ s/^(\d+)\s//) {
29             push(@b, &make_bugref($1))
30         }
31         $bugs{$bugline} = join(", ", @b);
32     }
33     close(BUGS);
34 }
35
36 my $inmenu = 0;
37
38 while (<STDIN>) {
39     chop;
40     if (s/^\s+//) {
41         my $brokendep = &quotehtml($_);
42         my $bug = $bugs{$_};
43         if (defined $bug) {
44             delete $bugs{$_};
45             $brokendep .= '  [' . $bug . ']';
46         }
47         print("  <LI>$brokendep\n");
48     } elsif (m/^$/) {
49         next;
50     } else {
51         if ($inmenu) {
52             print("</MENU>\n\n");
53         }
54         $_ = &quotehtml($_);
55         print("<H2>$_</H2>\n");
56         print("<MENU>\n");
57         $inmenu = 1;
58     }
59 }
60
61 if ($inmenu) {
62     print("</MENU>\n");
63 }
64
65 exit 0;
66
67 # -----
68
69 sub make_bugref {
70     my $bugnum = shift;
71     my $bugdir = substr($bugnum, 0, 2);
72
73     return "<A HREF=\"http://www.debian.org/Bugs/db/$bugdir/$bugnum.html\">"
74         . "\#$bugnum</A>";
75 }
76
77 sub quotehtml {
78     $_ = shift;
79     s/&/\&amp;/g;
80     s/</\&lt;/g;
81     s/>/\&gt;/g;
82     return $_;
83 }