head     1.11;
access   ;
symbols  ;
locks    ; strict;
comment  @# @;


1.11
date     89.09.14.16.58.32;  author dew;  state Exp;
branches ;
next     1.10;

1.10
date     89.09.14.16.54.52;  author dew;  state Exp;
branches ;
next     1.9;

1.9
date     89.01.04.16.40.12;  author dew;  state Exp;
branches ;
next     1.8;

1.8
date     88.11.07.15.12.33;  author dew;  state Exp;
branches ;
next     1.7;

1.7
date     88.10.06.09.36.57;  author dew;  state Exp;
branches ;
next     1.6;

1.6
date     88.10.05.16.53.32;  author dew;  state Exp;
branches ;
next     1.5;

1.5
date     88.10.05.15.55.16;  author dew;  state Exp;
branches ;
next     1.4;

1.4
date     88.03.01.16.46.07;  author bayes;  state Exp;
branches ;
next     1.3;

1.3
date     88.03.01.13.36.08;  author root;  state Exp;
branches ;
next     1.2;

1.2
date     88.02.10.16.16.56;  author larry;  state Exp;
branches ;
next     1.1;

1.1
date     88.02.10.16.15.07;  author larry;  state Exp;
branches ;
next     ;


desc
@original name: pws2unix
Compare everything from the turn with what's in RCS and check it back in.
This base version is pws2unix.
@


1.11
log
@Added support for SCSI
@
text
@#=========================================================================
#
# pws2rcs
# modified by Dave P. Willis 10/88
# original is in olspws2rcs.
#
# Goal:
#
#       The goal of this program is to pass updated or new files from
#       the Pascal Turn machine to the RCS system on the RCS machine.
#
# Givens:
#
#       There exists two seperate machines:
#               1) The RCS machine (currently hpfclw)
#               2) The PWS machine (currently pawsturn)
#
#       Both machines are running UNIX.  The PWS machine is both
#       a UNIX machine and a PWS machine that uses a common HFS disk.
#
#       The naming conventions on the RCS machine and the PWS machine
#       are different.  The name differences determine the file type on
#       the PWS machine.  The differences have been determined historically
#       and I claim no deep understanding as to they whys.
#
# Operation.
#       There are two levels of
#       comparison, first are there files with same names on both machines,
#       and second, are those files identical in content?  When comparing
#       if files are on both machines, the file names are sorted into
#       three categories:
#
#               1) On RCS but not on PWS
#               2) On PWS but not on RCS
#               3) On both.
#
#       for case 1):
#               Log this anomoly.
#
#       for case 2):
#               Using newrcs, add this new PWS file to the RCS system on
#               the RCS machine.
#
#       for case 3):
#               Compare the contents of the files from both systems.
#               if they are identical, do nothing.  Otherwise, check in,
#               using ci, the PWS file into the RCS system on the
#               RCS machine.
#
#       All unix output is logged into the log directory of the RCS machine.
#       the logname is cmplog.<month><day>
#
# DEW - 11/07/88
#   updated to update the build tools on the SRM under RCS control.
#=========================================================================

#
# if the user is running under root, kick them off.
#
if id | grep -l root
then
	echo DO NOT RUN ME AS ROOT!!
	exit 1
fi

PATH=:/bin:/usr/bin:/src/paws/bin:/usr/local/bin
TMPDIR=/tmp/$$
RCSDIR=/src/paws/src
NETNAME=/net/pawsturn
PWSORG=$NETNAME/source
PWSSHADOW=$NETNAME/tmpsrc
REMOVES=/src/paws/bin/nocopies
TOOLSDIR=/src/paws/SRMTOOLS

#=========================================================================
# make sure that the rcs directory structure is clean and that there
# are no locked files.
#=========================================================================
docheck=1
if [ $# -ge 1 ]
then
	if [ $1 = nocheck ]
	then
		docheck=0
	fi
fi
if [ docheck -eq 1 ]
then
	chkrcsclean
	if [ $? -eq 1 ]
	then
		echo chkrcsclean failure
		exit 1
	fi
fi

#=========================================================================
# set up a remote access to the PWS machine filesystem.
#=========================================================================
netunam $NETNAME paws:error104

#=========================================================================
# determine the logfile name
#=========================================================================
date=`date`
month=`expr substr "$date" 5 3`
day=`expr substr "$date" 9 2 | tr ' ' 0`
LOGFILE=$RCSDIR/../log/cmplog.$month$day


#=========================================================================
# create a shadow subtree on the PWS machine that will contain
# files linked to the original tree, but will have names more
# (but not completely) compatible with the RCS machine.
#
# file name modification conventions for this go around:
#       x.TEXT -> x.TEXT
#       x.c, x.h -> x.c, x.h
#       CCOMP Specials -> Special.TEXT
#
# some files are purposely NOT linked accross.
#=========================================================================
echo +++++ linking files in $PWSORG to files in $PWSSHADOW +++++ >>$LOGFILE
echo linking files in $PWSORG to files in $PWSSHADOW
rm -rf $PWSSHADOW
mkdir $PWSSHADOW
cd $PWSSHADOW

mkdir OSFS INIT PROGS HPROGS IOLIB HFS INIT2 ASSM COMP1 LIBR MYSYS SPECS RS232 PCLIB PCLIB/CRT PCLIB/GEN PCLIB/STDIO PCLIB/SYS PCLIB/INCLUDE PCLIB/INCLUDE/SYS PCLIB/INCLUDE/MACHINE CCOMP VME SCSI

#
# link x.TEXt -> x.TEXT
#
for d in OSFS INIT PROGS HPROGS IOLIB HFS INIT2 ASSM COMP1 LIBR MYSYS SPECS RS232 PCLIB PCLIB/CRT PCLIB/SYS VME SCSI
  do
  ln $PWSORG/$d/*.TEXT $PWSSHADOW/$d 2> /dev/null
  done

#
# link x.h, x.c -> x.h, x.c
#
for d in HPROGS PCLIB/GEN PCLIB/STDIO PCLIB/INCLUDE PCLIB/INCLUDE/SYS PCLIB/INCLUDE/MACHINE
  do
  ln $PWSORG/$d/*.c $PWSORG/$d/*.h $PWSSHADOW/$d
  done

#
# handle CCOMP specially
#
ln $PWSORG/CCOMP/* $PWSSHADOW/CCOMP
rm $PWSSHADOW/CCOMP/*.CODE $PWSSHADOW/CCOMP/*.s
for f in common manifest macdefs mac2defs mfile1 mfile2
  do
  mv $PWSSHADOW/CCOMP/$f $PWSSHADOW/CCOMP/$f.TEXT
  done

#
# Remove files from the shadow directory that shouldn't be there.
#
for i in `cat $REMOVES`; do rm $PWSSHADOW/$i; done

echo +++++ done linking files +++++ >>$LOGFILE
echo done linking files



#=========================================================================
# Compute the first level of comparison.
# Determine which files are on both system, and on one system but
# not the other.
#=========================================================================
echo +++++Results of PWS/RCS comparison $date+++++ >>$LOGFILE
echo Compare PWS sources with RCS sources $date

# run out of a junk directory
mkdir $TMPDIR

# look at each rcs directory
cd $RCSDIR
find . -type d -print | cut -c3- | grep -v RCS > $TMPDIR/rcssubdirs
cd $TMPDIR

for subdir in `cat $TMPDIR/rcssubdirs`
do

subdiruc=`echo $subdir | tr '[a-z]' '[A-Z]'`
echo subdirectory $subdir
echo "\nsubdirectory $subdir" >>$LOGFILE

# make the following lists of files:
#       RCSf -- files on RCS machine
#       RCSp -- files on RCS, pws-style names
#       PWSf -- files on PWS
#       hnt (here not there) -- files on RCS, not on PWS
#       tnh (there not here) -- files on PWS, not on RCS
#       both -- files in both places
#
# suffix changes to produce PWS names:
#       .p,.s -> .TEXT
#       .c,.h remain
#       no suffix -> .TEXT

ls -1 $RCSDIR/$subdir/RCS | grep '.*,v$' >RCSf
sed '1,${
s/,v$//
/\.[ps]$/s/\.[ps]$//
/\.[ch]$/!s/$/.TEXT/
}' < RCSf >RCSp

ls $PWSSHADOW/$subdiruc | egrep '.TEXT$|.c$|.h$' | sort >PWSf

comm -23 RCSp PWSf >hnt
comm -13 RCSp PWSf >tnh
comm -12 RCSp PWSf >both



#=========================================================================
# Second level comparison or handling.
#  for files on rcs but not on PWS, note in log
#  for files on pws but not on rcs, add them to the RCS system.
#  for files on both, compare.  If differences, update RCS system.
#=========================================================================

thisdir=`pwd`

# files here but not there -- just note them in log
if [ -s hnt ]; then
{ echo '\nFile(s) on RCS machine but not on PWS machine'
  cat hnt
  echo
}>>$LOGFILE
fi

# files there but not here -- we check them in
if [ -s tnh ]; then
echo checking in new files...
for newfile in `cat tnh`; do
    rcsname=`basename $newfile .TEXT`
    cp $PWSSHADOW/$subdiruc/$newfile $rcsname
    cd $RCSDIR/$subdir
    newrcs $thisdir/$rcsname
    cd $thisdir
done
{ echo '\nFile(s) on PWS machine but not on RCS machine, newly checked into rcs'
  cat tnh
  echo
}>>$LOGFILE
fi

# files in both places -- we do a comparison
echo comparing common files...
paste RCSf RCSp | fgrep -f both |\
while read rcsfile pwsfile; do
    co -q $RCSDIR/$subdir/RCS/$rcsfile
    namercs=`basename $rcsfile ,v`
    # be sure no name conflicts with pws name
    mv $namercs 5$namercs
    cp $PWSSHADOW/$subdiruc/$pwsfile $pwsfile
    expand $pwsfile > /tmp/exp.$$
    mv /tmp/exp.$$ $pwsfile
    normalize $pwsfile
    if cmp -s 5$namercs $pwsfile; then
	: files are the same
    else
	# files are different
	{ echo "\n$subdir/$pwsfile is different; diffs follow
	  (new file already put back into RCS)"
	  diff 5$namercs $pwsfile
	}>>$LOGFILE 2>&1
	cd $RCSDIR/$subdir
	co -q -l $namercs
	mv -f $thisdir/$pwsfile $namercs
	ci $namercs <<@@

pws2rcs automatic delta on $date
@@
	cd $thisdir
    fi
    rm -f 5$namercs $pwsfile
done
done

#=========================================================================
# update the build tools on the SRM to UNIX under RCS control
#=========================================================================
cd $TOOLSDIR
toolsupdate 2>&1 | tee >> $LOGFILE


#=========================================================================
# clean up
#=========================================================================
rm -f -r $TMPDIR
cd /

echo "removing $PWSSHADOW" >>$LOGFILE
echo "removing $PWSSHADOW"
rm -rf $PWSSHADOW

echo "\ndone" >>$LOGFILE
echo "done `date`"
@


1.10
log
@changes have been made to pws2rcs in Feb, 1989.  However, RCS
was notupdated.  It appears the chagnes had to do with chkrcsclean.
@
text
@d129 1
a129 1
mkdir OSFS INIT PROGS HPROGS IOLIB HFS INIT2 ASSM COMP1 LIBR MYSYS SPECS RS232 PCLIB PCLIB/CRT PCLIB/GEN PCLIB/STDIO PCLIB/SYS PCLIB/INCLUDE PCLIB/INCLUDE/SYS PCLIB/INCLUDE/MACHINE CCOMP VME
d134 1
a134 1
for d in OSFS INIT PROGS HPROGS IOLIB HFS INIT2 ASSM COMP1 LIBR MYSYS SPECS RS232 PCLIB PCLIB/CRT PCLIB/SYS VME
@


1.9
log
@Added call to chkrcsclean
@
text
@d79 2
a80 2
chkrcsclean
if [ $? -eq 1 ]
d82 4
a85 1
	exit 1
d87 9
d136 1
a136 1
  ln $PWSORG/$d/*.TEXT $PWSSHADOW/$d
@


1.8
log
@Now updates the TOOLS directory on the SRM to the /src/paws/SRMTOOLS/RCS
directory, under RCS control
@
text
@d76 10
@


1.7
log
@Because am now using FIND when searching for the subdirectories of the
RCS tree, the if [ $subdir = RCS ] check will no longer work.  The thing
to do is pipe the find output through grep and cut out all directories
that have an RCS in them.
@
text
@d47 1
a47 1
#               using newci, the PWS file into the RCS system on the
d53 2
d73 1
d252 1
a252 1
	newci $namercs <<@@
d254 1
a254 3
ipws2rcs automatic delta on $date
:w
:q
d261 6
@


1.6
log
@Fixed a left over bug from the previous update.
a variable name srmfile was changed to pwsfile in all cases except one.
did it in the missing case.
@
text
@d155 1
a155 1
find . -type d -print | cut -c3- > $TMPDIR/rcssubdirs
a159 1
if [ $subdir = RCS ]; then continue; fi
@


1.5
log
@updated for two reasons:
	1) primarily to add support for the newly added RCS directories:
		pclib/include, pclib/include/sys, pclib/include/machine.
	2) update the comments with reality.
@
text
@d201 2
a211 1
thisdir=`pwd`
d230 1
a230 1
while read rcsfile srmfile; do
@


1.4
log
@Moved remover. SFB
@
text
@d1 1
a1 14
######################################################################
# Check SRM to be sure all PWS sources are correctly in RCS.
# $pwsdir is directory on PWS, which contains various subdirs.
# These subdirs contain the interesting files.
# $s500dir has the same set of subdirs, with RCS files in directories
# named RCS under these subdirs.
# We first check to see if there are files on one machine, but not
# the other.
# If a file is on the 500, but not the SRM, we ignore it.
# If a file is on the SRM, but not the 500, we check it into RCS,
# and note the fact in the logfile.
# If a file is in both places, we copy over the SRM file, check out
# the 500 file, and compare.  If the two are the same, we do nothing.
# If they are different, we note the differences in the log file.
d3 58
a60 4
# Filenames will mantain case. There will be no case conversion.
######################################################################
if [ "$LOGNAME" = root ]; then
	echo DO NOT RUN ME AS ROOT	
d65 6
a70 5
tmpdir=/tmp/$$
s500dir=/src/paws/src
pwsorg=/net/pawsturn/source
pwsdir=/net/pawsturn/tmpsrc
removes=/src/paws/bin/nocopies
d72 4
a75 1
netunam /net/pawsturn paws:error104
d77 3
a79 1
# get a logfile name
d83 1
a83 1
logfile=$s500dir/../log/cmplog.$month$day
d85 24
a108 7
echo +++++ linking files in $pwsorg to files in $pwsdir +++++ >>$logfile
echo linking files in $pwsorg to files in $pwsdir
# this step partly replaces the stream "SRMCLEAN"
rm -rf $pwsdir
mkdir $pwsdir
cd $pwsdir
mkdir OSFS INIT PROGS HPROGS IOLIB HFS INIT2 ASSM COMP1 LIBR MYSYS SPECS RS232 PCLIB PCLIB/CRT PCLIB/GEN PCLIB/STDIO PCLIB/SYS CCOMP VME
d111 1
a111 1
  ln $pwsorg/$d/*.TEXT $pwsdir/$d
d114 4
a117 5
# rm $pwsdir/OSFS/CTBETA.TEXT
# replaced with a more regular "remover", to allow files to be selectively
# suppressed from pws2rcs transmission. SFB

for d in HPROGS PCLIB/GEN PCLIB/STDIO
d119 1
a119 1
  ln $pwsorg/$d/*.c $pwsorg/$d/*.h $pwsdir/$d
a120 1
ln $pwsorg/CCOMP/* $pwsdir/CCOMP
d122 5
a126 3
# can't easily be replaced by regular "remover" SFB
rm $pwsdir/CCOMP/*.CODE $pwsdir/CCOMP/*.s

d129 1
a129 1
  mv $pwsdir/CCOMP/$f $pwsdir/CCOMP/$f.TEXT
d132 4
a135 2
# regular "remover" SFB
for i in `cat $removes`; do rm $pwsdir/$i; done
d137 1
a137 1
echo +++++ done linking files +++++ >>$logfile
a139 1
echo +++++Results of SRM comparison $date+++++ >>$logfile
a140 1
echo Compare SRM and S500 PWS sources $date
d142 8
d151 1
a151 2
mkdir $tmpdir
cd $tmpdir
d154 6
a159 3
# pclib has subdirs itself
for subdir in `ls $s500dir` `ls $s500dir/pclib`; do
# seen this before? ($s500dir/pclib/RCS)
a160 4
# use full names for pclib
if [ $subdir = gen -o $subdir = crt -o $subdir = stdio -o $subdir = sys ]; then
	subdir=pclib/$subdir
fi
d164 1
a164 1
echo "\nsubdirectory $subdir" >>$logfile
d167 13
a179 11
# 	500 -- files on 500
# 	500s -- files on 500, srm-style names
# 	srm -- files on srm
# 	hnt (here not there) -- files on 500, not on srm
# 	tnh (there not here) -- files on srm, not on 500
# 	both -- files in both places
# suffix changes to produce SRM names:
#	.p,.s -> .TEXT
#	.c,.h remain
#	no suffix -> .TEXT 
ls -1 $s500dir/$subdir/RCS | grep '.*,v$' >500
d184 1
a184 6
}' < 500 >500s
ls $pwsdir/$subdiruc | egrep '.TEXT$|.c$|.h$' | sort >srm
#srmls -v$pwsvol /dev/srm:$pwsdir/$subdiruc | egrep '.TEXT$|.c$|.h$' | sort >srm
comm -23 500s srm >hnt
comm -13 500s srm >tnh
comm -12 500s srm >both
d186 15
d203 1
a203 1
{ echo '\nFile(s) on 500 but not on SRM'
d205 2
a206 2
  echo 
}>>$logfile
d215 2
a216 3
    cp $pwsdir/$subdiruc/$newfile $rcsname
#   srmcp -p -v$pwsvol /dev/srm:$pwsdir/$subdiruc/$newfile $rcsname
    cd $s500dir/$subdir
d220 1
a220 1
{ echo '\nFile(s) on SRM but not on 500, newly checked into rcs'
d222 2
a223 2
  echo 
}>>$logfile
d228 11
a238 10
paste 500 500s | fgrep -f both |\
while read s500file srmfile; do
    co -q $s500dir/$subdir/RCS/$s500file
    name500=`basename $s500file ,v`
    # be sure no name conflicts with srm name
    mv $name500 5$name500
    cp $pwsdir/$subdiruc/$srmfile $srmfile
#   srmcp -p -v$pwsvol /dev/srm:$pwsdir/$subdiruc/$srmfile $srmfile
    normalize $srmfile
    if cmp -s 5$name500 $srmfile; then
d242 1
a242 1
	{ echo "\n$subdir/$srmfile is different; diffs follow
d244 10
a253 8
	  diff 5$name500 $srmfile
	}>>$logfile 2>&1
	cd $s500dir/$subdir
	co -q -l $name500
	mv -f $thisdir/$srmfile $name500 
	newci $name500 <<@@
Pws2unix automatic delta on $date
.
d257 1
a257 2
    rm -f 5$name500 $srmfile
done 
d259 1
d261 2
d264 3
a266 5
if [ $thisdir = $tmpdir ]; then
	rm -f *
	cd /
	rmdir $tmpdir
fi
d268 3
a270 3
echo "removing $pwsdir" >>$logfile
echo "removing $pwsdir"
rm -rf $pwsdir
d272 1
a272 1
echo "\ndone" >>$logfile
@


1.3
log
@Added selective suppression of transmission back to RCS via the
"nocopies" file in /src/paws/bin. SFB
@
text
@a52 1
for i in `cat $removes`; do rm $pwsdir/$i; done
d59 2
d62 1
d67 4
@


1.2
log
@changed to copy files over LAN instead of SRM.
This is the first real pws2rcs.
@
text
@d28 2
d49 6
a54 1
rm $pwsdir/OSFS/CTBETA.TEXT
@


1.1
log
@Initial revision
@
text
@d26 3
a28 2
pwsvol=CLAWS
pwsdir=/PWS_SOURCE
d35 26
d100 2
a101 1
srmls -v$pwsvol /dev/srm:$pwsdir/$subdiruc | egrep '.TEXT$|.c$|.h$' | sort >srm
d120 2
a121 1
    srmcp -p -v$pwsvol /dev/srm:$pwsdir/$subdiruc/$newfile $rcsname
d140 2
a141 1
    srmcp -p -v$pwsvol /dev/srm:$pwsdir/$subdiruc/$srmfile $srmfile
d170 4
@
