[LON-CAPA-cvs] cvs: loncom /build Makefile doc/loncapafiles buildfiles.lpml removenolongerused.piml

raeburn raeburn at source.lon-capa.org
Wed Aug 7 14:20:25 EDT 2013


raeburn		Wed Aug  7 18:20:25 2013 EDT

  Added files:                 
    /doc/loncapafiles	removenolongerused.piml 

  Modified files:              
    /doc/loncapafiles	buildfiles.lpml 
    /loncom/build	Makefile 
  Log:
  - Add removenolongerused.piml script to LON-CAPA ./UPDATE process to check
    for files installed by earlier versions of LON-CAPA, now no longer used.
  
  
Index: doc/loncapafiles/buildfiles.lpml
diff -u doc/loncapafiles/buildfiles.lpml:1.29 doc/loncapafiles/buildfiles.lpml:1.30
--- doc/loncapafiles/buildfiles.lpml:1.29	Fri Jan 27 23:50:49 2012
+++ doc/loncapafiles/buildfiles.lpml	Wed Aug  7 18:20:22 2013
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- buildfiles.lpml -->
 
-<!-- $Id: buildfiles.lpml,v 1.29 2012/01/27 23:50:49 raeburn Exp $ -->
+<!-- $Id: buildfiles.lpml,v 1.30 2013/08/07 18:20:22 raeburn Exp $ -->
 
 <!--
 
@@ -377,6 +377,16 @@
   </note>
 </file>
 <file>
+  <source>doc/loncapafiles/removenolongerused.piml</source>
+  <target dist='default'>removenolongerused.piml</target>
+  <categoryname>system file</categoryname>
+  <description>
+Check for files and/or directories installed by earlier versions of LON-CAPA which are no longer used by the version being installed.  Prompt the user to confirm deletion for each file and each directory, before deleting them.
+  </description>
+  <note>
+  </note>
+</file>
+<file>
 <source>doc/loncapafiles/valid_hosts.xfml</source>
 <target dist='default'>valid_hosts.xfml</target>
 <categoryname>system file</categoryname>
Index: loncom/build/Makefile
diff -u loncom/build/Makefile:1.202 loncom/build/Makefile:1.203
--- loncom/build/Makefile:1.202	Mon Jul 22 22:17:58 2013
+++ loncom/build/Makefile	Wed Aug  7 18:20:25 2013
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 
-# $Id: Makefile,v 1.202 2013/07/22 22:17:58 raeburn Exp $
+# $Id: Makefile,v 1.203 2013/08/07 18:20:25 raeburn Exp $
 
 # TYPICAL USAGE of this Makefile is primarily for two targets:
 # "make build" and "make install".
@@ -153,6 +153,8 @@
 	@echo "mimetex_version_check: check if mimetex.cgi version has changed,"
 	@echo "                      if so remove files from mimetexcache."
 	@echo "latex_fmtutil: run utility to maintain TeX format files system-wide."
+	@echo "removenolongerused.piml: check if there are files from previous
+	@echo "                         LON-CAPA version; if so, prompt for removal."         
 	@echo "updatequery: solicit the user for machine configuration"
 	@echo "             information; to be incorporated during an update"
 	@echo "             procedure (via the UPDATE command)"
@@ -525,6 +527,11 @@
 	perl piml_parse.pl  $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
 	tee -a WARNINGS
 
+removenolongerused:
+	cat $(SOURCE)/doc/loncapafiles/removenolongerused.piml | \
+	perl piml_parse.pl  $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
+        tee -a WARNINGS
+
 postinstall:
 	make postaboutVERSION
 	make webserverconf
@@ -550,6 +557,7 @@
 	make mimetex_version_check
 	make verify_domconfiguser
 	make latex_fmtutil
+	make removenolongerused
 	sed -i "s/\x08\x08*/.../g" WARNINGS
 VERSION:
 	install -d $(TARGET)/etc

Index: doc/loncapafiles/removenolongerused.piml
+++ doc/loncapafiles/removenolongerused.piml
<piml>
<targetroot>/</targetroot>
<files>
<file>
<target dist="default"></target>
<perlscript mode="fg">

use File::Path qw(remove_tree);

my @rcgifs = qw(anno.gif anot.gif anot2.gif back.gif bchat.gif bkm.gif blog.gif brws.gif catalog.gif ccat.gif ccrs.gif chrt.gif clst.gif com.gif conf.gif courses.gif cprv.gif cstr.gif del.gif docs.gif egrd.gif enrl.gif eval.gif fdbk.gif forw.gif grds.gif grps.gif keys.gif ledsend.gif list.gif logout.gif mail.gif mcrs.gif mrk.gif nav.gif new.gif parm.gif pcsrt.gif pcstr.gif pdfupload.gif pgrd.gif port.gif pparm.gif pref.gif prt.gif pub.gif rcrs.gif reload.gif remotebg.gif res.gif roles.gif rsrv.gif rtrv.gif sbkm.gif sctr.gif spacer.gif sprs.gif src.gif srvr.gif stat.gif subm.gif title.gif vbkm.gif);

my %paths = (
              'londaemons' => '/home/httpd/perl',
              'apache'     => '/home/httpd/lib/perl/Apache',
              'londocroot' => '/home/httpd/html',
              'rcgifs'     => '/home/httpd/html/res/adm/pages',
            );
 
my %files = (
              'londaemons' => ['lonManage','lchtmldir','lonhttpd'],
              'apache'     => ['londropadd.pm','lonconstruct.pm',
                               'lonremote.pm','admbookmarks.pm'],
              'londocroot' => ['adm/rat/extpickcode.html',
                               'adm/rat/extpickframe.html',
                               'res/adm/pages/imgmaps.html',
                               'res/adm/pages/menu.html',
                               'res/adm/pages/homeworkmenu.html'],
            );

my %dirs = (
              'londocroot' => 'adm/lonLCDfont',
                              'htmlarea',
                              'res/adm/pages/bookmarkmenu',
           );

my %multis = (
                 rcgifs'     => \@rcgifs,
             ); 
my @filestodelete = ();
my @dirstodelete = ();
my @multistodelete = ();
my @gifstodelete = ();
foreach my $key (sort(keys(%files))) {
    if ($paths{$key} ne '') {
        if (ref($files{$key}) eq 'ARRAY') {
            foreach my $file (@{$files{$key}}) {
                if (-f $paths{$key}.'/'.$file) {
                    push(@filestodelete,$paths{$key}.'/'.$file);
                }
            }
        }
    }
}

foreach my $key (sort(keys(%dirs))) {
    if ($paths{$key} ne '') {
        if (ref($dirs{$key}) eq 'ARRAY') {
            foreach my $dir (@{$dirs{$key}}) {
                if (-d $paths{$key}.'/'.$dir) {
                    push(@dirstodelete,$paths{$key}.'/'.$dir);
                }
            }
        }
    }
}

foreach my $key (sort(keys(%multis))) {
    if ($paths{$key} ne '') {
        if (ref($multis{$key}) eq 'ARRAY') {
            foreach my $file (@{$dirs{$key}}) {
                if (-f $paths{$key}.'/'.$file) {
                    push(@multistodelete,$paths{$key}.'/'.$file);
                    push(@gifstodelete,$file);
                }
            }
        }
    }
}

if (@dirstodelete > 0) {
    print "\nThe following directories were installed for an earlier version of LON-CAPA, and are no longer needed. It is recommended that you delete them. For each one, enter Y if you would the directory to be deleted.\n\n";
    foreach my $dir (@dirstodelete) {
        next if (($dir =~/*/) || ($dir eq '') || ($dir eq '/'));  
        print "$dir  -- delete? Enter: Y or N:\n";
        my $choice=<>;
        chomp($choice);
        if ($choice==Y) {
            remove_tree($dir);
        }
    }
}

if (@filestodelete > 0) {
   print "\nThe following files were installed for an earlier version of LON-CAPA, and are no longer needed. It is recommended that you delete them. For each one, enter Y if you would the file to be deleted.\n\n";
    foreach my $file (@filestodelete) {
        next if (($file =~/*/) || ($file eq '') || ($file eq '/'));
        print "$file -- remove? Enter? Y or N:\n";
        my $choice=<>;
        chomp($choice);
        if ($choice==Y) {
            unlink($file);
        }
    }
}

if (@multistodelete > 0) {
    my $num = scalar(@multistodelete);
    print "\nThe following $num gif image files were installed in $paths{rcgifs}/ for use with the LON-CAPA Remote Control (available in an earlier version of LON-CAPA), and now no longer used:\n".join(' ', at gifstodelete)."\n".
          "Enter Y if you would all $num files to be deleted.\n\n".
          "Remove? Y or N:\n";
    my $choice=<>;
    chomp($choice);
    if ($choice==Y) {
        foreach my $item (@multistodelete) {
            next if ((($item =~/*/) || ($item eq '') || ($item eq '/'));
            unlink($item);
        }
    }
}

</perlscript>
</file>
</files>
</piml>




More information about the LON-CAPA-cvs mailing list