From 561cd87dbe37dd68de5814f21fa54c2573a3a702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Thu, 9 Oct 2014 14:28:41 +0000 Subject: [PATCH] Refactor. The only major change is that CVE numbers now link to the corresponding NVD database entry. git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@819 185d5e19-27fe-0310-9dcf-9bff6b9f3609 --- misc/history2wiki.pl | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/misc/history2wiki.pl b/misc/history2wiki.pl index 85aeb27..09ed122 100755 --- a/misc/history2wiki.pl +++ b/misc/history2wiki.pl @@ -33,26 +33,30 @@ use strict; use warnings; +my $CVEURL = "http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-"; + while (<>) { if (m/^OpenPAM ([A-Z][a-z]+)\t+(\d\d\d\d-\d\d-\d\d)\s*$/) { my ($relname, $reldate) = ($1, $2); - my $wikitext = "= OpenPAM $relname =\n" . - "\n" . - "OpenPAM $relname was released on $reldate.\n"; + my $changes; while (<>) { last if m/^=+$/; - $wikitext .= $_; + $changes .= $_; } - $wikitext =~ s/^ - ([A-Z]+): / - '''$1''' /gm; - $wikitext =~ s/(\w+\(\d*\))/`$1`/gs; - $wikitext =~ s/([^'])\b([A-Z_]{2,})\b([^'])/$1`$2`$3/gs; - $wikitext =~ s/([.!?])\n +(\w)/$1 $2/gs; - $wikitext =~ s/(\S)\n +(\S)/$1 $2/gs; - $wikitext .= "\n" . - "[http://sourceforge.net/projects/openpam/files/openpam/$relname/ Download from Sourceforge]\n"; + $changes =~ s/^ - ([A-Z]+): / - '''$1''' /gm; + $changes =~ s/([\w.-]+\(\d*\))/`$1`/gs; + $changes =~ s/([^'])\b([A-Z_]{2,})\b([^'])/$1`$2`$3/gs; + $changes =~ s/`CVE`-(\d{4}-\d+)/[$CVEURL$1 CVE-$1]/gs; + $changes =~ s/([.!?])\n +(\w)/$1 $2/gs; + $changes =~ s/(\S)\n +(\S)/$1 $2/gs; open(my $fh, ">", "$relname.txt") or die("$relname.txt: $!\n"); - print($fh $wikitext); + print($fh "= OpenPAM $relname =\n", + "\n", + "OpenPAM $relname was released on $reldate.\n", + $changes, + "\n", + "[http://sourceforge.net/projects/openpam/files/openpam/$relname/ Download from Sourceforge]\n"); close($fh); print("|| $reldate || [[Releases/$relname|$relname]] ||\n"); }