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

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

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