Author: joeyh Date: 2005-01-04 23:53:54 +0100 (Tue, 04 Jan 2005) New Revision: 230 Modified: sarge-checks/checklist Log: add html output mode Modified: sarge-checks/checklist ==================================================================--- sarge-checks/checklist 2005-01-04 17:45:42 UTC (rev 229) +++ sarge-checks/checklist 2005-01-04 22:53:54 UTC (rev 230) @@ -1,10 +1,27 @@ #!/usr/bin/perl # Must run on a machine with madison. +my $html=0; +if ($ARGV[0] eq ''html'') { + shift; + $html=1; +} + if (! @ARGV) { - die "usage: $0 list\n"; + die "usage: $0 [html] list\n"; } +if ($html) { + print "<title>testing security issues</title>\n"; + print "<ul>\n"; +} + +sub printid { + my $id=shift; + $id=~s#((?:CAN|CVE)-\d+-\d+)#<a href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=$1">$1</a>#g if $html; + return $id; +} + foreach my $list (@ARGV) { if (-d $list) { $list="$list/list"; @@ -23,20 +40,30 @@ my $package=$1; my $version=$2; if ($version=~/unfixed/) { - print "$package $version for $id\n"; + if ($html) { + print "<li>"; + $version=~s!bug #(\d+)!<a href="http://bugs.debian.org/$1">bug #$1</a>!g; + } + print "$package $version for ".printid($id)."\n"; next; } my $maddy=`madison -s testing ''$package''`; if (length $maddy) { my @fields = split(/\s*\|\s*/, $maddy); - my $cmp=system("dpkg --compare-versions ''$fields[1]'' ''>='' ''$version''"); + my $havver=$fields[1]; + my $cmp=system("dpkg --compare-versions ''$havver'' ''>='' ''$version''"); if ($cmp != 0) { - print "$package $version needed, have $fields[1] for $id\n"; + if ($html) { + print "<li>"; + $havver=''<a href="http://bjorn.haxx.se/debian/testing.pl?package=''.$package.''">''.$havever.''</a>''; + } + print "$package $version needed, have $havver for ".printid($id)."\n"; } } } - elsif (/HELP/) { - print $_." ($id)\n"; - } } } + +if ($html) { + print "</ul>\n"; +}