[LON-CAPA-cvs] cvs: doc /loncapafiles mimetex_version_check.piml loncom/build Makefile

raeburn raeburn@source.lon-capa.org
Thu, 18 Dec 2008 22:30:24 -0000


raeburn		Thu Dec 18 22:30:24 2008 EDT

  Added files:                 
    /doc/loncapafiles	mimetex_version_check.piml 

  Modified files:              
    /loncom/build	Makefile 
  Log:
  - If mimetex.cgi version has changed, remove gif files generated by previous version from mimetexcache directory.
  
  
Index: loncom/build/Makefile
diff -u loncom/build/Makefile:1.188 loncom/build/Makefile:1.189
--- loncom/build/Makefile:1.188	Sun Sep 21 00:38:53 2008
+++ loncom/build/Makefile	Thu Dec 18 22:30:20 2008
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 
-# $Id: Makefile,v 1.188 2008/09/21 00:38:53 raeburn Exp $
+# $Id: Makefile,v 1.189 2008/12/18 22:30:20 raeburn Exp $
 
 # TYPICAL USAGE of this Makefile is primarily for two targets:
 # "make build" and "make install".
@@ -136,6 +136,8 @@
         @echo "latex_fixup: regenerate ls-R database for the latex base."
 	@echo "picins_check: check for picins.sty, retrieve and rebuild"
 	@echo "             filename databases used by LaTeX"
+	@echo "mimetex_version_check: check if mimetex.cgi version has changed,"
+	@echo "                      if so remove files from mimetexcache."
 	@echo "updatequery: solicit the user for machine configuration"
 	@echo "             information; to be incorporated during an update"
 	@echo "             procedure (via the UPDATE command)"
@@ -492,6 +494,11 @@
 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
 	tee -a WARNINGS
 
+mimetex_version_check:
+	cat $(SOURCE)/doc/loncapafiles/mimetex_version_check.piml | \
+	perl piml_parse.pl  $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
+	tee -a WARNINGS
+
 postinstall:
 	make webserverconf
 	make reseval_fixup
@@ -512,6 +519,7 @@
 	make wrap_setuid
 	make latex_fixup
 	make picins_check
+	make mimetex_version_check
 VERSION:
 	install -d $(TARGET)/etc
 	echo -n "LON-CAPA release $(VERSION)-" > $(TARGET)/etc/loncapa-release

Index: doc/loncapafiles/mimetex_version_check.piml
+++ doc/loncapafiles/mimetex_version_check.piml
<!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN" 
	"http://lpml.sourceforge.net/DTD/piml.dtd">
<!-- mimetex_version_check.piml -->
<!-- Stuart Raeburn -->

<!-- $Id: mimetex_version_check.piml,v 1.1 2008/12/18 22:30:24 raeburn Exp $ -->

<!--

This file is part of the LearningOnline Network with CAPA (LON-CAPA).

LON-CAPA is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

LON-CAPA is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with LON-CAPA; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

/home/httpd/html/adm/gpl.txt

http://www.lon-capa.org/

-->

<piml>
<files>
<file>
<target dist="default">/</target>
<perlscript mode="fg">
    my $currversionfile = '/home/httpd/lonTabs/mimetex-version';
    my $newversionfile = '../cgi/mimeTeX/VERSION';
    my $fh;
    if (-e $newversionfile) {
        if (open($fh, "&lt;$newversionfile")) {
            my $newversion = &lt;$fh&gt;;
            close($fh);
            chomp($newversion);
            if ($newversion=~ /^\d+\.\d+$/) { 
                if (-e $currversionfile) {
                    if (open($fh, "&lt;$currversionfile")) {
                        my $currversion = &lt;$fh&gt;;
                        close($fh);
                        chomp($version);
                        if ($currversion=~ /^\d+\.\d+$/) {
                            if ($currversion ne $newversion) {
                                unlink('/home/httpd/cgi/mimetexcache/*.gif');
                                print "All .gif files cached by previous mimeTeX version have been removed from the mimetexcache directory\n";
                                if (open($fh, "&gt;$currversionfile")) {
                                    print $fh "$newversion";
                                    close($fh);
                                    print "mimetex-version file in /home/httpd/lonTabs set to version: $newversion.\n";
                                }
                            }
                        }
                    }
                } else {
                    unlink('/home/httpd/cgi/mimetexcache/*.gif');
                    print "All .gif files cached by previous mimeTeX version have been removed from the mimetexcache directory\n";
                    if (open($fh, "&gt;$currversionfile")) {
                        print $fh "$newversion";
                        close($fh);
                        print "mimetex-version file in /home/httpd/lonTabs set to version: $newversion.\n";`
                    }
                }
            }
        }
    }
</perlscript>
</file>
</files>
</piml>