File:  [LON-CAPA] / loncom / build / install_web_site_cronjob
Revision 1.9: download - view: text, annotated - select for diffs
Tue Jul 6 18:09:41 2004 UTC (19 years, 9 months ago) by albertel
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_X, version_2_5_99_1, version_2_5_99_0, version_2_5_2, version_2_5_1, version_2_5_0, version_2_4_X, version_2_4_99_0, version_2_4_2, version_2_4_1, version_2_4_0, version_2_3_X, version_2_3_99_0, version_2_3_2, version_2_3_1, version_2_3_0, version_2_2_X, version_2_2_99_1, version_2_2_99_0, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_X, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, version_2_1_3, version_2_1_2, version_2_1_1, version_2_1_0, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, version_2_0_X, version_2_0_99_1, version_2_0_2, version_2_0_1, version_2_0_0, version_1_99_3, version_1_99_2, version_1_99_1_tmcc, version_1_99_1, version_1_99_0_tmcc, version_1_99_0, version_1_3_X, version_1_3_3, version_1_3_2, version_1_3_1, version_1_3_0, version_1_2_X, version_1_2_99_1, version_1_2_99_0, version_1_2_1, version_1_2_0, version_1_1_99_5, version_1_1_99_4, version_1_1_99_3, version_1_1_99_2, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, bz6209-base, bz6209, bz5969, bz5610, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3, GCI_2, GCI_1, BZ5971-printing-apage, BZ5434-fox, BZ4492-merge, BZ4492-feature_horizontal_radioresponse, BZ4492-feature_Support_horizontal_radioresponse, BZ4492-Support_horizontal_radioresponse
- commiting some old changes to install_website_cronjob that had gotten lost

#!/usr/bin/perl

=pod

=head1 NAME

install_web_site_cronjob - maintain install.lon-capa.org web-site every day

=head1 DESCRIPTION

This is a file that runs periodically on B<install.lon-capa.org>.

This file should be run by the 'loninst' user and be part of
the 'loninst' crontab entries (to view loninst crontab, login
as loninst and crontab C<-l>; to edit loninst crontab, login as
loninst and crontab C<-e>).

This file should be on the B<install.lon-capa.org> filesystem as
F</home/loninst/auto/install_web_site_cronjob>.

The current 'loninst' crontab entry is:

13 16 * * *    /home/loninst/auto/install_web_site_cronjob

The main goal of B<install_web_site_cronjob> is to periodically produce the
unstable tarball needed for LON-CAPA installation.

A secondary yet important function of B<install_web_site_cronjob> is that it
also refreshes the documentation present on the install.lon-capa.org
web site.

This documentation is refreshed based on a file located inside
F</home/loninst/public_html/versions>.  This file is named
F<LATEST-IS-VERSIONNUMBER>, where
I<VERSIONNUMBER> is the latest stable release of loncapa (e.g. 0.4 or 0.6.1).
The F<LATEST-IS-VERSIONNUMBER> file contains a string
that is used to date the release of the current stable version.

The coding of this script is a strange brew of shell commands
with perl.

=head1 AUTHOR


=cut

# --------------------------------------------- Making the tarball distribution

# In an ideal world, this tarball distribution would be always generated with
# the "make tardist" command.  But instead, unstable is now defined as
# "all the gunk we have been working on", whereas the 
# "make tardist" command means a "carefully inventoried selection of gunk".
#`cd /home/loninst/auto; export CVS_PASSFILE=/home/loninst/.cvspass; export CVSROOT=:pserver:scott\@localhost:/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;`;

# The real world.  Just give them all the gunk for the unstable distribution.
`cd /home/loninst/auto; export CVS_PASSFILE=/home/loninst/.cvspass; export CVSROOT=:pserver:scott\@localhost:/home/cvs; rm -Rf loncapa-unstable; rm -Rf loncapa; cvs -Q export -r HEAD loncapa;`;

# Generate a README file that advises them about dealing with the gunk.
open(OUT,'>/home/loninst/auto/loncapa/README');
print(OUT <<END);
This is a CVS export of LON-CAPA generated on:
END
print(OUT `date`);
print(OUT <<END);

To generate an installable tarball distribution from this file, you can
execute the following commands:
cd loncom/build
make tardist

Note that the installable tarball distribution (the 'tardist' target)
is what encapsulates the stable releases of the LON-CAPA software (as
well as ensuring that LON-CAPA's distributability does not rely solely on
CVS software).

END
print(OUT <<END);
An alternative Makefile command sequence is:
cd loncom/build
make build
make install

For more information on Makefile targets, you can just enter the following
commands:
cd loncom/build
make help

Finally, if you encounter any problems, be sure to enter them
into the bug database http://bugs.lon-capa.org/ or, alternatively,
discuss them on one of the mailing lists available at
http://mail.lon-capa.org/.
END
close(OUT);

#'
# Roll the directory together into the unstable tarball.
`cd /home/loninst/auto; ln -s loncapa loncapa-unstable; tar cvvf loncapa-unstable.tar loncapa-unstable/* ;gzip -9 -f loncapa-unstable.tar`;

# ---------------------------------------- Dynamically generating documentation

system("rm /home/loninst/public_html/*html");

# pdf and doc targets are borken right now
#`cd /home/loninst/auto/loncapa/loncom/build; make pdfdoc`;
#`cd /home/loninst/auto/loncapa/loncom/build; make doc`;
#`cd /home/loninst/auto/loncapa/loncom/build; cp docs.tar.gz /home/loninst/public_html/docs/.`;
#`cd /home/loninst/public_html/docs; tar xzf docs.tar.gz`;

`cd /home/loninst/auto/loncapa/loncom/build; make buildwebsite`;

# ------------------------------------ Copying over the latest unstable tarball
#my $filename=`cd /home/loninst/auto; find loncapa -type f -name *.tar.gz -maxdepth 1`;
#chomp($filename);
#$filename=~/loncapa\/loncapa\-(.*?)\.tar\.gz/;
#my $version=$1;
`cd /home/loninst/auto; cp -f loncapa-unstable.tar.gz ../public_html/versions/loncapa-unstable.tar.gz`;
#`cd /home/loninst/public_html/versions; rm -f loncapa-unstable.tar.gz; ln -s loncapa-$version-unstable.tar.gz loncapa-unstable.tar.gz`;

# ------------------------------------------------ Determine the latest version
my $filename=`cd /home/loninst/public_html/versions; find . -type f -name LATEST-IS-* -maxdepth 1`;
chomp($filename);
$filename =~ /LATEST-IS-(.*)/;
my $version = $1;
open(IN,"</home/loninst/public_html/versions/$filename");
my $releasedate = <IN>;
close(IN);

# ------------------ Updating the download page with the date of the last build
open(IN,"</home/loninst/public_html/docs/downloads/index.html");
my @lines = <IN>;
close(IN);
my $date = `date -I`; chomp($date);
my $text = join('',@lines);
$text =~ s/loncapa-unstable\.tar\.gz\<\/a\>.*?\./loncapa-unstable\.tar\.gz\<\/a\> (generated $date)\./;
$text =~ s/LATESTVERSION/$version/g;
$text =~ s/LATESTDATE/$releasedate/g;
open(OUT,">/home/loninst/public_html/docs/downloads/index.html");
print(OUT $text);
close(OUT);

#'
# ---------------------------------------- Determine the latest testing version
my $filename=`cd /home/loninst/public_html/versions; find . -type f -name LATEST-TESTING-IS-* -maxdepth 1`;
chomp($filename);
$filename =~ /LATEST-TESTING-IS-(.*)/;
my $version = $1;
open(IN,"</home/loninst/public_html/versions/$filename");
my $releasedate = <IN>;
close(IN);
# -------------- Updating the download page with the date of the last build
open(IN,"</home/loninst/public_html/docs/downloads/index.html");
my @lines = <IN>;
close(IN);
my $text = join('',@lines);
if ($version) {
    $text =~ s/LATESTTESTINGVERSION/$version/g;
    $text =~ s/LATESTTESTINGDATE/$releasedate/g;
    $text =~ s/TESTINGRELEASE_START//g;
    $text =~ s/TESTINGRELEASE_END//g;
} else {
    $text =~ s/TESTINGRELEASE_START.*TESTINGRELEASE_END//g;
}
open(OUT,">/home/loninst/public_html/docs/downloads/index.html");
print(OUT $text);
close(OUT);

system("cp /home/loninst/auto/loncapa/doc/build/*.html /home/loninst/public_html/");

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>