File:  [LON-CAPA] / loncom / build / install_web_site_cronjob
Revision 1.5: download - view: text, annotated - select for diffs
Sat Feb 1 18:22:34 2003 UTC (21 years, 4 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
making documentation more readable; tidying up some of the coding beauty

    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: Scott Harrison 2002-07-19
   45: 
   46: =cut
   47: 
   48: # --------------------------------------------- Making the tarball distribution
   49: 
   50: # In an ideal world, this tarball distribution would be always generated with
   51: # the "make tardist" command.  But instead, unstable is now defined as
   52: # "all the gunk we have been working on", whereas the 
   53: # "make tardist" command means a "carefully inventoried selection of gunk".
   54: #`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;`;
   55: 
   56: # The real world.  Just give them all the gunk for the unstable distribution.
   57: `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;`;
   58: 
   59: # Generate a README file that advises them about dealing with the gunk.
   60: open(OUT,'>/home/loninst/auto/loncapa/README');
   61: print(OUT <<END);
   62: This is a CVS export of LON-CAPA generated on:
   63: END
   64: print(OUT `date`);
   65: print(OUT <<END);
   66: 
   67: To generate an installable tarball distribution from this file, you can
   68: execute the following commands:
   69: cd loncom/build
   70: make tardist
   71: 
   72: Note that the installable tarball distribution (the 'tardist' target)
   73: is what encapsulates the stable releases of the LON-CAPA software (as
   74: well as ensuring that LON-CAPA's distributability does not rely solely on
   75: CVS software).
   76: 
   77: END
   78: print(OUT <<END);
   79: An alternative Makefile command sequence is:
   80: cd loncom/build
   81: make build
   82: make install
   83: 
   84: For more information on Makefile targets, you can just enter the following
   85: commands:
   86: cd loncom/build
   87: make help
   88: 
   89: Finally, if you encounter any problems, be sure to enter them
   90: into the bug database http://bugs.lon-capa.org/ or, alternatively,
   91: discuss them on one of the mailing lists available at
   92: http://mail.lon-capa.org/.
   93: END
   94: close(OUT);
   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: `cd /home/loninst/auto/loncapa/loncom/build; make pdfdoc`;
  101: `cd /home/loninst/auto/loncapa/loncom/build; make doc`;
  102: `cd /home/loninst/auto/loncapa/loncom/build; cp docs.tar.gz /home/loninst/public_html/docs/.`;
  103: `cd /home/loninst/public_html/docs; tar xzf docs.tar.gz`;
  104: 
  105: # ------------------------------------ Copying over the latest unstable tarball
  106: #my $filename=`cd /home/loninst/auto; find loncapa -type f -name *.tar.gz -maxdepth 1`;
  107: #chomp($filename);
  108: #$filename=~/loncapa\/loncapa\-(.*?)\.tar\.gz/;
  109: #my $version=$1;
  110: `cd /home/loninst/auto; cp -f loncapa-unstable.tar.gz ../public_html/versions/loncapa-unstable.tar.gz`;
  111: #`cd /home/loninst/public_html/versions; rm -f loncapa-unstable.tar.gz; ln -s loncapa-$version-unstable.tar.gz loncapa-unstable.tar.gz`;
  112: 
  113: # ------------------------------------------------ Determine the latest version
  114: my $filename=`cd /home/loninst/public_html/versions; find . -type f -name LATEST-IS-* -maxdepth 1`;
  115: chomp($filename);
  116: $filename =~ /LATEST-IS-(.*)/;
  117: my $version = $1;
  118: open(IN,"</home/loninst/public_html/versions/$filename");
  119: my $releasedate = <IN>;
  120: close(IN);
  121: 
  122: # ------------------ Updating the download page with the date of the last build
  123: open(IN,"</home/loninst/public_html/docs/downloads/index.html");
  124: my @lines = <IN>;
  125: close(IN);
  126: my $date = `date -I`; chomp($date);
  127: my $text = join('',@lines);
  128: $text =~ s/loncapa-unstable\.tar\.gz\<\/a\>.*?\./loncapa-unstable\.tar\.gz\<\/a\> (generated $date)\./;
  129: $text =~ s/LATESTVERSION/$version/g;
  130: $text =~ s/LATESTDATE/$releasedate/g;
  131: open(OUT,">/home/loninst/public_html/docs/downloads/index.html");
  132: print(OUT $text);
  133: close(OUT);

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