clevercopy / cleverrename

clevercopy (copy files intelligently)

The simplest tool that offers change propagation control is a clever version of copy. Rather than blindly copying a file onto another one, clevercopy begins by comparing the input with the output and starts the actual copying only if it detects any difference between them. If there is no difference, clevercopy informs the vovserver that the output has not changed.

Any tool can be made to exhibit this effect by inserting a clevercopy on one or more of its outputs.

usage: clevercopy [-fi] [-l label] [-m mode] [-n] [-t filter_tcl_script]
                    [-T filter_tcl_script] [-uv]
   -f:         Force writing of output even if the output file is not
               writable. This controls only the permissions on the output
               file, not its directory. This option may still fail if the
               output directory is not writable.
   -i:         Disable input barriers.  See on-line documentation for more
               information on input barriers.
   -l:         The label is ignored. It is used to annotate the command line.
   -m:         UNIX: set access mode for output files. The argument 'mode'
               should be in octal and has the same form as for chmod().
               WindowsNT: the access mode for output files is set to `Read
               Only'. The argument is ignored. By default, the mode is set to
               allow writing.
   -n:         Do not activate VIL
   -t:         Use script as filter.  Output is the filtered input. See man
               page for information on filter scripts. 
   -T:         Same as -t, but copies unfiltered input
   -u:         Unlink old file if there is a change.  Useful when the output
               is an executable which may be in use.
   -v:         Verbose flag.
Clevercopy can automatically copy many files from one directory to another. In response to the barriers on the inputs, clevercopy can activate one or more of its output barriers. This stops change propagation without having to compare the input with the corresponding output.
# Clevercopy file 'bb' to file 'cc'
% clevercopy bb cc

# Declare a job clevercopying 'aa' to 'bb'. 
J clevercopy aa bb

Please make note that clevercopy is a fully instrumented Altair binary that usually requires no wrapper. (You may need to wrap with a vov if you experience NFS cache issues).

Use filters with clevercopy to:
  • transform files to a canonical form
  • control barrier based on a comparison of the canonical form
Example of a filter:
#
# -- A filter to reduce a file to lowercase.
#
set fp1 [open [shift] "r"]
set fp2 [open [shift] "w"]

puts -nonewline $fp2 [string tolower [read $fp1]]

close $fp1
close $fp2
Use the option -t in clevercopy to apply a filter while copying. Example:
% clevercopy -t tolower.tcl bb clever_cc clevercopy

cleverrename (copy files intelligently, then remove the inputs)

A variation of clevercopy is cleverrename, which reduces storage requirements by deleting the input after the copy is made.
usage: cleverrename [-fi] [-l label] [-m mode] [-n] [-t filter_tcl_script]
                    [-T filter_tcl_script] [-uv]
   -f:         Force writing of output even if the output file is not
               writable. This controls only the permissions on the output
               file, not its directory. This option may still fail if the
               output directory is not writable.
   -i:         Disable input barriers.  See on-line documentation for more
               information on input barriers.
   -l:         The label is ignored. It is used to annotate the command line.
   -m:         UNIX: set access mode for output files. The argument 'mode'
               should be in octal and has the same form as for chmod().
               WindowsNT: the access mode for output files is set to `Read
               Only'. The argument is ignored. By default, the mode is set to
               allow writing.
   -n:         Do not activate VIL
   -t:         Use script as filter.  Output is the filtered input. See man
               page for information on filter scripts. 
   -T:         Same as -t, but copies unfiltered input
   -u:         Unlink old file if there is a change.  Useful when the output
               is an executable which may be in use.
   -v:         Verbose flag.

Please make note that cleverrename, just like clevercopy, is a fully instrumented Altair binary that usually requires no wrapper. (You may need to wrap with a vov if you experience NFS cache issues).

Search Path for Filters

Filters are looked for in the following directories:
  • The current directory
  • $VOVDIR/local/cleverfilters
  • $VOVDIR/etc/cleverfilters