bagder: curl-www/docs vulntable.pl,1.4,1.5
[email protected] Wed, 03 Dec 2008 10:51:43 +0000
| Newsgroups | gmane.comp.web.curl.www.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/curl/curl-www/docs
In directory labb:/tmp/cvs-serv8010
Modified Files:
vulntable.pl
Log Message:
add 'index' to each line to count releases
add release dates for each line
add links to the changelog entry for each release
add relative time from the most recent release to each old release
Index: vulntable.pl
===================================================================
RCS file: /cvsroot/curl/curl-www/docs/vulntable.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- vulntable.pl 10 Jul 2007 21:59:20 -0000 1.4
+++ vulntable.pl 3 Dec 2008 10:51:41 -0000 1.5
@@ -21,7 +21,7 @@
print "<table>";
sub head {
- print "<tr class=\"tabletop\"><th>Version</th>";
+ print "<tr class=\"tabletop\"><th>index</th><th>Version</th>";
my $v=1;
for(@vuln) {
my ($id, $start, $stop)=split('\|');
@@ -29,7 +29,7 @@
print "<th title=\"$id\"><a href=\"/docs/security.html\#$id\">#$v</a></th>";
$v++;
}
- print "</tr>\n";
+ print "<th>Release Date</th><th>Since Most Recent</th></tr>\n";
}
head();
@@ -37,8 +37,9 @@
my $l;
while(<STDIN>) {
- if($_ =~ /^SUBTITLE\(Fixed in ([0-9.]*)/) {
+ if($_ =~ /^SUBTITLE\(Fixed in ([0-9.]*) - (.*)\)/) {
my $str=$1;
+ my $date=$2;
my $this = vernum($str);
my @v;
@@ -56,16 +57,50 @@
}
$i++;
}
- printf "<tr class=\"%s\"><td>$str</td>", $l&1?"even":"odd";
+ my $anchor = $str;
+
+ $anchor =~ s/\./_/g;
+
+ my $datesecs=`date -d "$date" +%s`;
+ my $daysbetween;
+
+ if($prevsecs) {
+ # number of seconds between two releases!
+ my $reltime = $prevsecs - $datesecs;
+
+ # convert to days
+ $daysbetween = int($reltime/(3600*24));
+
+ if($daysbetween < 100) {
+ $age = "$daysbetween days";
+ }
+ elsif($daysbetween < 400) {
+ $age = sprintf("%d months", int($daysbetween/30));
+ }
+ else {
+ my $mon = int(($daysbetween%365)/30);
+ $age = sprintf("%d years, %d months",
+ int($daysbetween/365),
+ $mon);
+ }
+ }
+ else {
+ # store the first date
+ $prevsecs = $datesecs;
+ $age="most recent";
+ }
+
+ printf("<tr class=\"%s\"><td>%d</td><td><a href=\"/changes.html#$anchor\">$str</a></td>",
+ $l&1?"even":"odd",
+ $index++);
for my $i (0 .. scalar(@vuln)-1 ) {
- printf("<td>%s</td>", $v[$i]?"yes":" ");
+ printf("<td%s</td>", $v[$i]?" style=\"background-color: #f00000;\">yes":"> ");
}
- print "</tr>\n";
+ print "<td>$date</td><td>$age</td></tr>";
- if(!(++$l % 20)) {
+ if(!(++$l % 25)) {
head();
}
-
}
}