`coexistence=1' keyword for configuration file

Anders Christensen anders@pvv.unit.no
Tue, 22 Aug 1995 23:31:37 +0200


Version 1.73; patch 002: Addition of `coexistence=1' term in `linktree'

This patch allows non-store files to coexist in the linktree, together
with the links. 

It was implemented specifically for Statoil, where this functionality
was required, and it has been running there for several
months. However, this patch was extracted from a larger diff, and it
has not yet been taken back and tested.

The patch consists of the following changes:

  1) A new term is added for the `linktree' statement in the
     configuration file.  This term is `coexistence=1', which turns on
     coexistence for this linktree; it may also take the value '0',
     which turns it off. The default value is off, in which case no
     behavior is changed wrt version 1.73.

  2) At two locations, the deletion of empty directories and the
     deletion of files that aren't not-links; the deletion code is
     skipped for linktrees for which the `coexistence' attribute is
     set.

  3) A new global variable %'coexst is created in lib/conffile.pl

  4) One `print' statement is changed into a call to &'output() in
     order to be conforming to the standard I/O model of Store. This
     is strictly speaking not part of the `coexistence=1' term, but it
     located close to the code that needed changing.

Note that applying this patch without patch 001 for version 1.73 will
not work automatically, since they patch statements that are very
close to eachother.

diff -ur ver-1.73/cclient.pl current/cclient.pl
--- ver-1.73/cclient.pl	Tue Aug 22 19:03:53 1995
+++ current/cclient.pl	Tue Aug 22 19:58:04 1995
@@ -124,7 +124,8 @@
     }
 
     if ( $#emptydirs > -1 ) {
-	&'output('Warning', "Empty directories under $topdir on $linktree (removed):\n"); #'
+	&'output('Warning', "Empty directories under $topdir on $linktree (" .
+		($'coexst{$linktree}?"not ":"") . "removed):\n"); #'
 	for $dir (@emptydirs) {
 	    $_ = $dir;
 	    $edirs{$_}++;
@@ -133,7 +134,11 @@
 		$_ = $1 ;
 	    }
 	}
-	undef @emptydirs ;
+	if ($'coexst{$linktree}) {
+	    undef %edirs ;
+	} else {
+	    undef @emptydirs ;
+	}
 	for $dir ( reverse sort keys %edirs ) {
 	    next unless ( $edirs{$dir} ) ;
 	    if ( rmdir($dir) ) {
@@ -390,6 +395,7 @@
    }
    
    chdir( "$topdir" ) ;
+   @rfiles = () if ($'coexst{$linktree}) ; 
    if ( "@rfiles" ne "" ) {
       $_ = `ls -l @rfiles` ;
       s/[ 	]+/ /g ; s/\n\s*/\n\t/g ; s/^\s*/\n\t/ ; s/\n\t$// ;
@@ -405,8 +411,7 @@
          }
       }
    } else {
-      print "(Debug) No superfluous files under $topdir on $linktree\n"
-                                                       if ($'debug & $'TRACE) ;
+      &'output('Trace', "No superfluous files under $topdir on $linktree\n") ;
    }
 # Print the new notlinks list
    open(NOTLINKS, ">$topdir/etc/notlinks.list") ;
diff -ur ver-1.73/lib/conffile.pl current/lib/conffile.pl
--- ver-1.73/lib/conffile.pl	Tue Aug 22 19:03:53 1995
+++ current/lib/conffile.pl	Tue Aug 22 20:07:47 1995
@@ -85,6 +85,7 @@
    undef @'external_stores ;    # External stores. (For optimization).
 
 
+   undef %'coexst ;             # coexistence with aboriginal files (AChr '95)
    # Indexed by store,$store or linktree,$linktree.
    undef %'unwantedfile ;       # UWapp-file names.
    undef %'uwappsfor ;          # Unwanted applications.
@@ -245,6 +246,7 @@
 # The following two lines added by Anders Christensen 6 jan, 95; 
 # implements linktree warping and coexistence
             $'wrpdir{$linktree}=$1,next if ( m/^warp=(.*)/ ) ;
+            $'coexst{$linktree}=$1,next if ( m/^coexistence=(.*)/ ) ;
 
             # This is like the parsing above:
             if ( m/^unwantedfile=(.*)/ ) {