summaryrefslogtreecommitdiffstats
path: root/bin/updatehtmllist
blob: 977b378dd4102c2de48d7b367b94a89d2bd8713b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/perl
# Must be run from the website dir
use Getopt::Long;

my $output;
if (! GetOptions(
		"output=s", \$output)
    || ! @ARGV[0]) {
	die "usage: $0 [--output=file] list\n";
}

if (defined $output) {
	open (OUT, ">$output.tmp.$$") || die "output.tmp.$$: $!"; # Set the output to a file
}
else {
	open (OUT, ">&STDOUT"); # Set the output to stdout
}

open (HEAD,"header.html") || die("Could not open header.html: $!");
while(<HEAD>) {
	$line = $_ ;
	print OUT "$line" ;
}
close HEAD;	

print OUT "<dl>\n";

my $pack = 0;
my $date = "";
my $dtsa = "";
my $package = "";
my $desc = "";
open (LIST,@ARGV[0]) || die("Could not open list ".@ARGV[0].": $!");
while(<LIST>) {
	$line = $_ ;
	if ($line=~/^(\[.+\]) (DTSA-[0-9]+-[0-9]+) ([^ ].+) - (.+)$/) {
		if ($pack == 1) {
			# print the previous acvisory, as it wasn't unreleased
			print OUT "<dt>$date <a href='DTSA/$dtsa.html'>$dtsa $package</a></dt>\n";
			print OUT "<dd>$desc</dd>\n";
		}
		$date = $1;
		$dtsa = $2;
		$package = $3;
		$desc = $4;
		$pack = 1;
	}
	if ($line=~/TODO: unreleased$/) {
		$pack = 0;
	}
}
if ($pack == 1) {
	# print the previous acvisory, as it wasn't unreleased
	print OUT "<dt>$date <a href='DTSA/$dtsa.html'>$dtsa $package</a></dt>\n";
	print OUT "<dd>$desc</dd>\n";
}
print OUT "</dl>\n";

open (FOOT,"footer.html") || die("Could not open footer.html: $!"); ;
while(<FOOT>) {
	$line = $_ ;
	print OUT "$line" ;
}
close FOOT;

close OUT;
if (defined $output) {
	rename("$output.tmp.$$", $output) || die "rename: $!";
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy