Annotation of loncom/build/install_web_site_cronjob, revision 1.11
1.1 harris41 1: #!/usr/bin/perl
2:
1.11 ! raeburn 3: # $Id: install_web_site_cronjob,v 1.11 2012/01/28 23:14:16 raeburn Exp $
! 4:
1.1 harris41 5: =pod
6:
7: =head1 NAME
8:
9: install_web_site_cronjob - maintain install.lon-capa.org web-site every day
10:
11: =head1 DESCRIPTION
12:
13: This is a file that runs periodically on B<install.lon-capa.org>.
14:
15: This file should be run by the 'loninst' user and be part of
16: the 'loninst' crontab entries (to view loninst crontab, login
17: as loninst and crontab C<-l>; to edit loninst crontab, login as
18: loninst and crontab C<-e>).
19:
20: This file should be on the B<install.lon-capa.org> filesystem as
1.2 harris41 21: F</home/loninst/auto/install_web_site_cronjob>.
1.1 harris41 22:
23: The current 'loninst' crontab entry is:
24:
1.2 harris41 25: 13 16 * * * /home/loninst/auto/install_web_site_cronjob
1.1 harris41 26:
1.2 harris41 27: The main goal of B<install_web_site_cronjob> is to periodically produce the
1.3 albertel 28: unstable tarball needed for LON-CAPA installation.
1.1 harris41 29:
1.2 harris41 30: A secondary yet important function of B<install_web_site_cronjob> is that it
1.1 harris41 31: also refreshes the documentation present on the install.lon-capa.org
32: web site.
33:
1.5 harris41 34: This documentation is refreshed based on a file located inside
35: F</home/loninst/public_html/versions>. This file is named
36: F<LATEST-IS-VERSIONNUMBER>, where
37: I<VERSIONNUMBER> is the latest stable release of loncapa (e.g. 0.4 or 0.6.1).
38: The F<LATEST-IS-VERSIONNUMBER> file contains a string
39: that is used to date the release of the current stable version.
1.3 albertel 40:
1.1 harris41 41: The coding of this script is a strange brew of shell commands
42: with perl.
43:
44: =head1 AUTHOR
45:
46:
47: =cut
48:
49: # --------------------------------------------- Making the tarball distribution
1.5 harris41 50:
51: # In an ideal world, this tarball distribution would be always generated with
52: # the "make tardist" command. But instead, unstable is now defined as
53: # "all the gunk we have been working on", whereas the
54: # "make tardist" command means a "carefully inventoried selection of gunk".
1.10 raeburn 55: #`cd /home/loninst/auto; export CVS_RSH=ssh; export CVSROOT=:ext:loninst\@source.lon-capa.org:/home/cvs; rm -Rf loncapa/[C][^V]*; rm -Rf loncapa/[^C]*; cvs -Q co loncapa; cd loncapa/loncom/build; make build 2>/dev/null; make tardist;`;
1.5 harris41 56:
57: # The real world. Just give them all the gunk for the unstable distribution.
1.11 ! raeburn 58: `cd /home/loninst/auto; export CVS_RSH=ssh; export CVSROOT=:ext:loninst\@source.lon-capa.org:/home/cvs; rm -Rf loncapa-unstable; rm -Rf loncapa; cvs -Q co -r HEAD loncapa; cd /home/loninst/auto/loncapa; cvs -Q co -r HEAD modules/TexConvert/tthperl/compiles; cvs -Q co -r HEAD modules/TexConvert/tthperl/commands; cp -p loncom/xml/tth.pm modules/TexConvert/tthperl/tth.pm; `;
1.5 harris41 59:
60: # Generate a README file that advises them about dealing with the gunk.
1.4 harris41 61: open(OUT,'>/home/loninst/auto/loncapa/README');
62: print(OUT <<END);
63: This is a CVS export of LON-CAPA generated on:
64: END
65: print(OUT `date`);
66: print(OUT <<END);
67:
68: To generate an installable tarball distribution from this file, you can
69: execute the following commands:
70: cd loncom/build
1.11 ! raeburn 71: make build
1.4 harris41 72: make tardist
73:
74: Note that the installable tarball distribution (the 'tardist' target)
75: is what encapsulates the stable releases of the LON-CAPA software (as
76: well as ensuring that LON-CAPA's distributability does not rely solely on
77: CVS software).
78:
79: END
80: print(OUT <<END);
81: An alternative Makefile command sequence is:
82: cd loncom/build
83: make build
84: make install
85:
1.11 ! raeburn 86: In this case you will be need to create symbolic links for the following
! 87: in loncom (unless you have done this previously):
! 88:
! 89: hosts.tab
! 90: domain.tab
! 91: dns_hosts.tab
! 92: dns_domain.tab
! 93:
! 94: which will point at development_hosts.tab, development_domain.tab,
! 95: development_dns_hosts.tab, and development_dns_domain.tab respectively
! 96: in loncom.
! 97:
1.4 harris41 98: For more information on Makefile targets, you can just enter the following
99: commands:
100: cd loncom/build
101: make help
102:
103: Finally, if you encounter any problems, be sure to enter them
104: into the bug database http://bugs.lon-capa.org/ or, alternatively,
105: discuss them on one of the mailing lists available at
106: http://mail.lon-capa.org/.
107: END
108: close(OUT);
1.5 harris41 109:
1.7 albertel 110: #'
1.5 harris41 111: # Roll the directory together into the unstable tarball.
1.4 harris41 112: `cd /home/loninst/auto; ln -s loncapa loncapa-unstable; tar cvvf loncapa-unstable.tar loncapa-unstable/* ;gzip -9 -f loncapa-unstable.tar`;
1.5 harris41 113:
1.1 harris41 114: # ---------------------------------------- Dynamically generating documentation
1.9 albertel 115:
116: system("rm /home/loninst/public_html/*html");
117:
118: # pdf and doc targets are borken right now
119: #`cd /home/loninst/auto/loncapa/loncom/build; make pdfdoc`;
120: #`cd /home/loninst/auto/loncapa/loncom/build; make doc`;
121: #`cd /home/loninst/auto/loncapa/loncom/build; cp docs.tar.gz /home/loninst/public_html/docs/.`;
122: #`cd /home/loninst/public_html/docs; tar xzf docs.tar.gz`;
123:
124: `cd /home/loninst/auto/loncapa/loncom/build; make buildwebsite`;
1.10 raeburn 125: system("cp /home/loninst/auto/loncapa/doc/build/*.html /home/loninst/public_html/");
1.1 harris41 126:
127: # ------------------------------------ Copying over the latest unstable tarball
1.3 albertel 128: #my $filename=`cd /home/loninst/auto; find loncapa -type f -name *.tar.gz -maxdepth 1`;
129: #chomp($filename);
130: #$filename=~/loncapa\/loncapa\-(.*?)\.tar\.gz/;
131: #my $version=$1;
132: `cd /home/loninst/auto; cp -f loncapa-unstable.tar.gz ../public_html/versions/loncapa-unstable.tar.gz`;
133: #`cd /home/loninst/public_html/versions; rm -f loncapa-unstable.tar.gz; ln -s loncapa-$version-unstable.tar.gz loncapa-unstable.tar.gz`;
134:
1.5 harris41 135: # ------------------------------------------------ Determine the latest version
1.3 albertel 136: my $filename=`cd /home/loninst/public_html/versions; find . -type f -name LATEST-IS-* -maxdepth 1`;
1.1 harris41 137: chomp($filename);
1.5 harris41 138: $filename =~ /LATEST-IS-(.*)/;
139: my $version = $1;
1.3 albertel 140: open(IN,"</home/loninst/public_html/versions/$filename");
1.5 harris41 141: my $releasedate = <IN>;
1.3 albertel 142: close(IN);
1.5 harris41 143:
1.1 harris41 144: # ------------------ Updating the download page with the date of the last build
1.10 raeburn 145: open(IN,"</home/loninst/public_html/index.html");
1.5 harris41 146: my @lines = <IN>;
1.1 harris41 147: close(IN);
1.5 harris41 148: my $date = `date -I`; chomp($date);
149: my $text = join('',@lines);
150: $text =~ s/loncapa-unstable\.tar\.gz\<\/a\>.*?\./loncapa-unstable\.tar\.gz\<\/a\> (generated $date)\./;
151: $text =~ s/LATESTVERSION/$version/g;
152: $text =~ s/LATESTDATE/$releasedate/g;
1.10 raeburn 153: open(OUT,">/home/loninst/public_html/index.html");
1.1 harris41 154: print(OUT $text);
155: close(OUT);
1.7 albertel 156:
157: #'
158: # ---------------------------------------- Determine the latest testing version
159: my $filename=`cd /home/loninst/public_html/versions; find . -type f -name LATEST-TESTING-IS-* -maxdepth 1`;
160: chomp($filename);
161: $filename =~ /LATEST-TESTING-IS-(.*)/;
162: my $version = $1;
1.8 albertel 163: open(IN,"</home/loninst/public_html/versions/$filename");
164: my $releasedate = <IN>;
165: close(IN);
166: # -------------- Updating the download page with the date of the last build
1.10 raeburn 167: open(IN,"</home/loninst/public_html/index.html");
1.8 albertel 168: my @lines = <IN>;
169: close(IN);
170: my $text = join('',@lines);
1.7 albertel 171: if ($version) {
172: $text =~ s/LATESTTESTINGVERSION/$version/g;
173: $text =~ s/LATESTTESTINGDATE/$releasedate/g;
174: $text =~ s/TESTINGRELEASE_START//g;
175: $text =~ s/TESTINGRELEASE_END//g;
176: } else {
1.10 raeburn 177: $text =~ s/TESTINGRELEASE_START.*TESTINGRELEASE_END//gs;
1.7 albertel 178: }
1.10 raeburn 179: open(OUT,">/home/loninst/public_html/index.html");
1.8 albertel 180: print(OUT $text);
181: close(OUT);
1.9 albertel 182:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>