[comp.os.minix] Revision assistance

cwr@pnet01.cts.com (Will Rose) (04/15/90)

As revisions go by, the return on automating them seems greater.  I've built
up the following script files across 1.5.3, 1.5.5, and 1.5.6 and they seem
reasonably solid.  Because of differences between systems, it seems unlikely
that the process can be entirely automated, but I found these scripts a great
help in avoiding silly and time-consuming mistakes.
 
Can anyone explain sed's behaviour?  I've used a work-around, but a clear
explanation (either of failure in sed, or my understanding) would be nice.
 
Good luck - Will
============= In case of fire, cut along the dotted line and jump ============
echo x - revise
sed '/^X/s///' > revise << '/'
X#
X#  Assistance in updating Minix from ast's Usenet patches - vn 0.9
X#
X#  Scratch files are used instead of pipes, because on a PC XT
X#  memory is scarce.  Two or three files may need patches' stack
X#  increased to the max.
X#
X#  NB: version specific code
Xold_vers="155"
Xnew_vers="156"
X
Xif test $# -ne 0
Xthen
X    echo " "
X    echo "        This file applies ast's Usenet patches to produce a new"
X    echo "        version of Minix.  It should be run in each directory"
X    echo "        that is to be updated.  Each directory must contain the"
X    echo "        appropriate shell file of patches as posted by ast."
X    echo "        On completion, the script 'clean' can be used to remove"
X    echo "        the debris."
X    echo " "
X    echo "        Note that ALL files of type .s will be removed, to"
X    echo "        prepare for recompiling, and that the script must be"
X    echo "        edited before use to include explicit version numbers."
X    exit 0
Xfi
Xif test -s *0?
Xthen
X       sh *_0?
X       echo " "
X       echo "Press <CR> to continue"
X       getlf
Xelse
X       echo "No shar file found"
X        exit 1
Xfi
Xrm -f Patch_err_new
X#
X# WARNING - extreme DANGER! This system keeps all source .s files as .z,
X# simply to make it easy to clear directories with rm *.s. This may not
X# be a universal habit.
X#
Xrm -f *.s
Xls *cdif >one 2>/dev/null
Xls *cdi >>one 2>/dev/null
X#
X# If there only new files, say so
X#
Xif test ! -s one
Xthen
X       rm -f one
X       echo "No cdif files found"
Xelse
X       cp one two
X#
X# Files with local patches have the original kept with a .15n extension.
X# Add these files to the list, so that they can be checked (and usually
X# removed) when the list is inspected with mined
X#
X       ls *$old_vers >>two
X#
X# There seems to be a bug in sed. Called with more than one command, it
X# applies one of the commands twice; is this really a feature, or have I
X# missed something?
X#
X       sed -e 's/Makefile.cdif/Makefile/' <one >thr
X       sed -e 's/\.h\.cdif$/.h/' <thr >one
X       sed -e 's/\.x\.cdif$/.x/' <one >thr
X       sed -e 's/\.cdif$/.c/' <thr >one
X#
X# Eyeball the files to be patched
X#
X       mined one
X       paste one two >thr
X#
X# Add the command and output files
X#
X       sed  -e 's/^/patch /' <thr >four
X       sed  -e 's/$/ 2>>Patch_err_new/' <four >ggg
X       rm -f one
X       rm -f two
X       rm -f thr
X       rm -f four
X#
X# Check the command file, especially for files already patched locally.
X#
X       mined ggg
X       if test -s ggg
X       then
X               chmod 755 ggg
X               ggg
X       fi
X#
X# Check the results
X#
X       if test -s Patch_err_new
X       then
X               mv Patch_err_new Patch_err_$new_vers
X               mined Patch_err_$new_vers
X       fi
Xfi
X#
X# Wrap up
X#
Xecho "The current crc files are:" 
Xls Crc*
Xecho "Rename the following crc file accordingly:"
Xls *.crc
Xexit 0
/
echo x - clean
sed '/^X/s///' > clean << '/'
X#
X# Removes scrap files from a directory after running revise
X#
Xrm -f *~
Xrm -f *#
Xrm -f *cdif
Xrm -f *cdi
Xrm -f ggg
Xrm -f *0?
X#
X# Final inspection
X#
Xls -l |more
X
/
================================================================
-----------------------------------------------------------------------
"If heaven too had passions  | Will Rose
     even heaven would       | UUCP: {nosc ucsd hplabs!hp-sdd}!crash!pnet01!cw
     grow old."  -  Li Ho.   | ARPA: crash!pnet01!cwr@nosc.mil
                             | INET: cwr@pnet01.cts.com


UUCP: {nosc ucsd hplabs!hp-sdd}!crash!pnet01!cwr
ARPA: crash!pnet01!cwr@nosc.mil
INET: cwr@pnet01.cts.com