comparison docs/website/generate-gftp-website.pl @ 222:007145d7d975

2003-7-11 Brian Masney <masneyb@gftp.org> * lib/protocols.c (gftp_calc_kbs) - only call gettimeofday() at the end only if we are throttling this connection * lib/cache.c lib/options.h docs/sample.gftp/gftprc - added cache_ttl option to determine the amount of time that cache entries will stay around * docs/gftp.xml docs/legal.xml docs/figures/* - documentation from Alexander Kirillov <kirillov@math.sunysb.edu> * docs/website - files for generating my main website. They aren't pretty, but hey it works. I'm mainly putting these in CVS just for backup purposes.
author masneyb
date Sun, 13 Jul 2003 12:38:35 +0000
parents
children e599812712f0
comparison
equal deleted inserted replaced
221:c0d7f3b6e8cb 222:007145d7d975
1 #!/usr/bin/perl -w
2
3 # This script will generate the gFTP webpage. You will have to first build the
4 # RPMs, DEBs, and tarballs and put them all in the current directory.
5
6 use Time::Local;
7
8 my @date = localtime (time ());
9
10 my $version = `cat ../../configure | grep ^VERSION= | awk -F= '{print \$2}'`;
11 chop ($version);
12
13 my %rep = ("STABLE_BZ2" => "gftp-" . $version . ".tar.bz2",
14 "STABLE_GZ" => "gftp-" . $version . ".tar.gz",
15 "STABLE_I386RPM" => "gftp-" . $version . "-1.i386.rpm",
16 "STABLE_SRCRPM" => "gftp-" . $version . "-1.src.rpm",
17 "STABLE_I386DEB" => "gftp_" . $version . "-1_i386.deb",
18 "STABLE_I386DEB_COMMON" => "gftp-common_" . $version . "-1_i386.deb",
19 "STABLE_I386DEB_GTK" => "gftp-gtk_" . $version . "-1_i386.deb",
20 "STABLE_I386DEB_TEXT" => "gftp-text_" . $version . "-1_i386.deb");
21
22 $tarfiles = "MD5SUMS changelog.html faq.html gftp-screenshot.png index.html install.html logo.jpg robots.txt screenshots.html";
23
24 print "Generating MD5SUMS...\n";
25
26 open M, ">MD5SUMS" || die "Can't open MD5SUMS: $!\n";
27 foreach $tag (keys %rep)
28 {
29 next if $tag =~ /_KB$/;
30
31 $file = $rep{$tag};
32 if (!-e $file)
33 {
34 undef ($rep{$tag});
35 next;
36 }
37
38 $tarfiles .= " $file";
39 print M `md5sum $file`;
40
41 @st = stat ($file);
42 $rep{$tag . "_KB"} = int ($st[7] / 1024);
43 }
44 close M;
45
46 $rep{"STABLE_VER"} = $version;
47 $rep{"STABLE_DATE"} = ++$date[4] . "/$date[3]/" . ($date[5] + 1900);
48
49 print "Generating changelog.html...\n";
50
51 open C, "<../gftp/ChangeLog-old" or die "Can't open ../gftp/ChangeLog-old: $!\n";
52 open N, ">changelog.html" or die "Can't open changelog.html: $!\n";
53
54 print N "<HTML>\n";
55 print N "<HEAD>\n";
56 print N "<TITLE>gFTP Changelog</TITLE>\n";
57 print N "<META NAME=\"author\" CONTENT=\"Brian Masney\">\n";
58 print N "<LINK REV=MADE HREF=\"mailto:masneyb\@gftp.org\">\n";
59 print N "</HEAD>\n";
60
61 print N "<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\" LINK=\"#336699\" VLINK=\"#336699\" ALINK=\"#336699\">\n";
62 print N "<FONT FACE=\"Lucida,Verdana,Helvetica,Arial\"><SMALL>\n";
63
64 $close = 0;
65
66 while (<C>)
67 {
68 chop;
69 next if /^\s*$/;
70
71 if (/^Changes/)
72 {
73 if ($close)
74 {
75 print N "\n</UL>\n";
76 }
77 else
78 {
79 $close = 1;
80 }
81
82 print N "\n<H4>$_</H4>\n";
83 print N "<UL>";
84 next;
85 }
86
87 s/\</&lt\;/g;
88 s/\>/&gt\;/g;
89 s/\s+$//;
90
91 if (!/^\*/)
92 {
93 s/^\s+//;
94 print N " $_";
95 }
96 else
97 {
98 s/^\*\s+//;
99 print N "\n<LI>$_";
100 }
101 }
102
103 print N "\n</UL>\n\n";
104 print N "<P>Brian Masney <A HREF=\"mailto:masneyb\@gftp.org\">masneyb\@gftp.org</A></P>\n";
105 print N "</SMALL></FONT></BODY></HTML>\n";
106
107 close C;
108 close N;
109
110 print "Generating index.html...\n";
111
112 open I, "<index.html.in" || die "Can't open index.html.in: $!\n";
113 open N, ">index.html" || die "Can't open index.html: $!\n";
114 while (<I>)
115 {
116 $skip = 0;
117 while (($var) = /\%(.*?)\%/)
118 {
119 if (!defined ($rep{$var}))
120 {
121 print STDERR "Warning: $var not found in hash. Skipping.\n";
122 $skip = 1;
123 last;
124 }
125 s/\%$var\%/$rep{$var}/g;
126 }
127
128 next if $skip == 1;
129 print N $_;
130 }
131 close I;
132 close N;
133
134 $tarcmd = "tar -jcvf gftp-$version-website.tar.bz2 $tarfiles";
135 print "Running $tarcmd...\n";
136 system ($tarcmd);
137
138 print "Done.\n";
139