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


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

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

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

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

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

1.4
date     89.01.04.16.06.23;  author dew;  state Exp;
branches ;
next     1.3;

1.3
date     88.10.05.15.51.32;  author dew;  state Exp;
branches ;
next     1.2;

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

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


desc
@original name: unix2pws
Checks everything out of RCS in preparation for the turn.
This base version is unix2pws.
@


1.9
log
@Fixed the -f option.  Apparently Larry Fenske left out the $ sign on PWSNAME
@
text
@########################################################################
#
#       RCS2PWS for PWS 3.2
#
#       script to copy the RCS file to PWS
#
#       Author: Angelika Hierath
#               April 1986
#       Modification History:
#               19880119 Larry Fenske   skip SRM, go over LAN
#
########################################################################
#
#       usage: rcs2pws -a | -u | -f <file name> <nocheck>
#
#       rcs2pws can be called with three different options. The -a option
#       copies all RCS files from $RCSSRC/*/RCS onto the SRM system. If
#       rcs2pws is invoked with the -u option only those files in those
#       directories are copied that are newer than $LASTXFR. In the last
#       mode the user can specify a file name which contain the names of
#       all the files which should be copied. Those files are not compared
#       against a given file, they are always copied. The files have to be
#       in one of the two forms:
#               <dir>/RCS/file_name,v
#               <dir>/file_name,v
#       <dir> has to be relative to RCSSRC.
#       The file names on SRM are derived from the original one (all modes).
#       All lower case letters in directory names are translated into upper
#       case letters. If there is a suffix .c, .p or .h at the end of the
#       file name it is stripped. A .TEXT is appended to all file names on
#       the SRM.
#


SRMVOL=CLAWS
SRMHOME=/NEWCODE
SRMDEV=/dev/srm

RCSSRC=/src/paws/src
NETNAME=/net/pawsturn
PWSSRC=$NETNAME/source
LOGDIR=/src/paws/log
LASTXFR=$LOGDIR/lastxfr
flagfile=$RCSSRC/turninprogress		#must be indentical to newci and
					#allnewrev

netunam $NETNAME paws:error104
if [ $? -eq 1 ]
then
	echo netunam failure
	exit 1
fi
umask 0

USAGE="usage: $0 -a | -u | -f <file name> [nocheck]"
if [ $# -lt 1 -o $# -gt 3 ]
then
	echo $USAGE
	exit 1
fi
case $1 in
	-*) ;;
	*) echo $USAGE
	   exit 1 ;;
esac

docheck=1
if [ $# -eq 2 ]
then
	if [ $2 = nocheck ]
	then
		docheck=0
	fi
elif [ $# -eq 3 ]
then
	if [ $3 = nocheck ]
	then
		docheck=0
	fi
fi
if [ docheck -eq 1 ]
then
	chkrcsclean
	if [ $? -eq 1 ]
	then
		echo chkrcsclean failure
		exit 1
	fi
fi

echo "turn in progress." > $flagfile

# directories containing the files to be copied
dirlist="assm comp1 hfs init init2 iolib libr mysys osfs progs rs232 specs hprogs pclib pclib/crt pclib/gen pclib/stdio pclib/sys pclib/include pclib/include/machine pclib/include/sys ccomp vme scsi"

# initialize variables
all=
update=
filecp=
error1=
error2=

# generate logfile name
date=`date`
month=`expr substr "$date" 5 3`
day=`expr substr "$date" 9 2 | tr ' ' 0`
LOGFILE=$LOGDIR/cptosrm.$month$day

# nuke any leftover LOGFILE SFB 013087
>$LOGFILE

echo "\n=============================================================="\
	>>$LOGFILE
# parse options
case $1 in
	-a)             all=y
			echo "*** Full $0 started on `date`"
			echo "*** Full $0 started on `date`" >> $LOGFILE;;
	-u)             if [ ! -f "$LASTXFR" ]
			then
				all=y
				echo "WARNING: file $LASTXFR not existent" >>$LOGFILE
				echo "WARNING: file $LASTXFR not existent"
				echo "*** Full $0 started on `date`" >> $LOGFILE
				echo "*** Full $0 started on `date`"
			else
				echo "*** Update $0 started on `date`" >> $LOGFILE
				echo "*** Update $0 started on `date`"
				update=y
			fi;;
	-f)             filecp=y
			if [ -z $2 ]
			then
				echo "$2 is empty"
				echo $USAGE
				exit 1
			fi
			if [ ! -f "$2" ]
			then
				echo "File $2 not existent"
				exit 1
			else
				echo "Full $0 started for files in $2 on `date`"
				echo "Full $0 started for files in $2 on `date`" >>$LOGFILE
				case $2 in
					/*)     filelist=$2;;
					*)      filelist=`pwd`/$2;;
				esac
			fi;;
	*)              echo $USAGE
			exit 1;;
esac

#       change to the directory containing the PWS source
cd $RCSSRC

if [ -z "$filecp" ]
# all or update
then
	for dir in $dirlist
	do
	if [ -d "$dir" ]
	then
		# Find all the related files in the directory $dir/RCS
		echo "$0 of $dir on `date`"
		echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" >>$LOGFILE
		echo "$0 of $dir on `date`" >>$LOGFILE
		error1=
		if [ -n "$all" ]
		then
			find $dir/RCS -name '*,v' -print >$dir/filelist
			if [ $? != 0 ]
			then
				error1=y
			fi
		else
			find $dir/RCS -name '*,v' -newer $LASTXFR -print  \
			     >$dir/filelist
			if [ $? != 0 ]
			then
				error1=y
			fi
		fi

		# For all those filenames do
		for filename in `cat $dir/filelist`
		do
			# file locked ??
			LOGINFO=`rlog -L -R $filename`
			if [ $? != 0 ]
			then
				echo "ERROR: cannot rlog $filename"
				echo "ERROR: cannot rlog $filename" >>$LOGFILE
			elif [ -n "$LOGINFO" ]
			then
				echo "ERROR: file  $filename locked for editing"
				echo "ERROR: file  $filename locked for editing" >>$LOGFILE
				error1=y
			else

				PWSDIR=$PWSSRC/`echo $dir | tr [a-z] [A-Z]`
				case $filename in
					*.p,v) PWSBNAME=`basename $filename .p,v`;;
					*.c,v) PWSBNAME=`basename $filename .c,v`
						PWSNAME=$PWSDIR/${PWSBNAME}.c;;
					*.h,v) PWSBNAME=`basename $filename .h,v`
						PWSNAME=$PWSDIR/${PWSBNAME}.h;;
					*.s,v) PWSBNAME=`basename $filename .s,v`;;
					*,v)   PWSBNAME=`basename $filename ,v`;;
				esac

				case $filename in
					*.c,v | *.h,v)
						co -p $filename > $PWSNAME;;
#                                               co -p $filename | srmcp -b -t59723 -v$SRMVOL  - $SRMDEV:$PWSNAME;;
					*.p,v | *.s,v | *,v) PWSNAME=$PWSDIR/${PWSBNAME}.TEXT
						co -p $filename | expand > $PWSNAME;;
#                                               co -p $filename | expand | srmcp -p  -v$SRMVOL  - $SRMDEV:$PWSNAME;;
				esac

				if [ $? != 0 ]
				then
					echo "ERROR: cannot copy file $filename"
					echo "ERROR: cannot copy file $filename" >>$LOGFILE
					error1=y
				else
					echo "copied: $filename"
				fi
			fi
		done
		echo "++++++ FILELIST of $dir ++++++" >>$LOGFILE
		cat $dir/filelist >>$LOGFILE
		rm $dir/filelist
		if [ -z "$error1" ]
		then
			echo "copy semaphor for $dir"
		else
			error2=y
		fi
	fi
	done

	echo "*** $0 finished on `date`"
	echo "*** $0 finished on `date`" >> $LOGFILE
	echo "=============================================================="
	echo "=============================================================="\
	       >>$LOGFILE

	# if successful touch $LASTXFR
	touch $LASTXFR

	if [ -z "$error2" ]
	then
		echo "copy semaphor"
	else
		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"\
		      >>$LOGFILE
		echo "ERROR during $0 check $LOGFILE"
		echo "ERROR during $0 check $LOGFILE" >>$LOGFILE
		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
		echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"\
		      >>$LOGFILE
	fi


# copy all files in $2
else
	for path in `cat $filelist`
	do
		filename=`basename $path`
		dir=`dirname $path`
		case $dir in
			*/RCS)  dir=`dirname $dir` ;;
			*)      ;;
		esac
		filename=$dir/RCS/$filename

		# file locked ??
		LOGINFO=`rlog -L -R $filename`
		if [ $? != 0 ]
		then
			echo "ERROR: cannot rlog $filename"
			echo "ERROR: cannot rlog $filename" >>$LOGFILE
		elif [ -n "$LOGINFO" ]
		then
			echo "ERROR: file  $filename locked for editing"
			echo "ERROR: file  $filename locked for editing" >>$LOGFILE
			error1=y
		else
			PWSDIR=$PWSSRC/`echo $dir | tr [a-z] [A-Z]`
			case $filename in
				*.p,v) PWSBNAME=`basename $filename .p,v`;;
				*.c,v) PWSBNAME=`basename $filename .c,v`
					PWSNAME=$PWSDIR/${PWSBNAME}.c;;
				*.h,v) PWSBNAME=`basename $filename .h,v`
					PWSNAME=$PWSDIR/${PWSBNAME}.h;;
				*.s,v) PWSBNAME=`basename $filename .s,v`;;
				*,v)   PWSBNAME=`basename $filename ,v`;;
			esac

			case $filename in
				*.c,v | *.h,v)
					co -p $filename  > PWSNAME;;
#                                       co -p $filename  | srmcp -b -t59723 -v$SRMVOL  - $SRMDEV:$PWSNAME;;
				*.p,v | *.s,v | *,v) PWSNAME=$PWSDIR/${PWSBNAME}.TEXT
					co -p $filename | expand > $PWSNAME;;
#                                       co -p $filename | expand | srmcp -p  -v$SRMVOL  - $SRMDEV:$PWSNAME;;
			esac
			if [ $? != 0 ]
			then
				echo "ERROR: cannot copy file $filename"
				echo "ERROR: cannot copy file $filename" >>$LOGFILE
				error1=y
			else
				echo "copied: $filename"
			fi
		fi
	done
	echo "++++++ FILELIST from $filelist ++++++" >>$LOGFILE
	cat $filelist >>$LOGFILE
fi


# Do the rest of what /TOOLS/CPTOLOCAL did.
# All the files are already in .UX form.
echo "renaming some CCOMP files from *.TEXT to *"
echo "renaming some CCOMP files from *.TEXT to *" >>$LOGFILE

( cd $PWSSRC/CCOMP      # local 'cd'
for file in common mac2defs macdefs manifest mfile1 mfile2
	do
	if [ -f $file.TEXT ]
		then
		rm -f $file
		mv $file.TEXT $file
	fi
	echo "CCOMP/$file renamed"
	echo "CCOMP/$file renamed" >>$LOGFILE
done
)

# link the pws c-compiler include files to the /usr/include directory
# on the pws turn machine.
PWSINCLUDE=$NETNAME/usr/include
PWSSRCINCLUDE=$PWSSRC/PCLIB/INCLUDE

echo "linking the pws c-compiler include files to /usr/include."
echo "linking the pws c-compiler include files to /usr/include." >> $LOGFILE

#remove everything under /usr/include
cd $PWSINCLUDE
rm -f -r . >> $LOGFILE 2>&1
mkdir machine sys

cd $PWSSRCINCLUDE/MACHINE
ln * $PWSINCLUDE/machine >> $LOGFILE 2>&1

cd $PWSSRCINCLUDE/SYS
ln * $PWSINCLUDE/sys >> $LOGFILE 2>&1

cd $PWSSRCINCLUDE
ln * $PWSINCLUDE >> $LOGFILE 2>&1  # this will generate two errors.




echo "*** $0 finished on `date`"
echo "*** $0 finished on `date`" >> $LOGFILE
echo "=============================================================="
echo "=============================================================="\
      >>$LOGFILE
@


1.8
log
@fixed various problems with the nocheck option.
@
text
@d307 1
a307 1
					co -p $filename | expand > PWSNAME;;
@


1.7
log
@*** empty log message ***
@
text
@d1 1
a1 1
#`#######################################################################
d14 1
a14 1
#       usage: rcs2pws -a | -u | -f <nocheck> <file name>
d55 2
a56 2
USAGE="usage: $0 -a | -u | -f [nocheck] <file name>"
if [ $# -lt 1 -o $# -gt 2 ]
d68 1
a68 1
if [ $# -ge 2 ]
a71 1
		set $1 $3
d74 6
d94 1
a94 1
dirlist="assm comp1 hfs init init2 iolib libr mysys osfs progs rs232 specs hprogs pclib pclib/crt pclib/gen pclib/stdio pclib/sys pclib/include pclib/include/machine pclib/include/sys ccomp vme"
d134 1
@


1.6
log
@*** empty log message ***
@
text
@d67 2
a68 2

if [ $2 = nocheck ]
d70 8
a77 2
	set $1 $3
else
@


1.5
log
@*** empty log message ***
@
text
@d55 1
a55 1
USAGE="usage: $0 -a | -u | -f <nocheck> <file name>"
d73 5
@


1.4
log
@now put a flag file in /src/paws/src to indicate turn is in proress.
Before doing anything, run chkrcsclean which checks for clearn
directory structure and no rcs files locked.
@
text
@d14 1
a14 1
#       usage: rcs2pws -a | -u | -f <file name>
d47 7
d55 1
a55 1
USAGE="usage: $0 -a | -u | -f <file name>"
d61 5
d67 2
a68 2
chkrcsclean
if [ $? -eq 1 ]
d70 3
a72 1
	exit 1
a74 2
netunam $NETNAME paws:error104
umask 0
@


1.3
log
@updated rcs2pws to handle the newly added rcs directories: pclib/include
pclib/include/machine and pclib/include/sys.
@
text
@d34 1
d44 2
a45 2
netunam $NETNAME paws:error104
umask 0
d47 1
d54 10
@


1.2
log
@changed to copy files over LAN instead of SRM.
This is the first real rcs2pws.
@
text
@d3 1
a3 3
#	RCS2PWS for PWS 3.2
#	
#	script to copy the RCS file to PWS
d5 1
a5 4
#	Author: Angelika Hierath
#		April 1986
#	Modification History:
#		19880119 Larry Fenske	skip SRM, go over LAN
d7 5
d14 1
a14 1
#	usage: rcs2pws -a | -u | -f <file name>
d16 17
a32 17
#	rcs2pws can be called with three different options. The -a option
#	copies all RCS files from $RCSSRC/*/RCS onto the SRM system. If 
#	rcs2pws is invoked with the -u option only those files in those
#	directories are copied that are newer than $LASTXFR. In the last
#	mode the user can specify a file name which contain the names of
#	all the files which should be copied. Those files are not compared
#	against a given file, they are always copied. The files have to be
#	in one of the two forms:
#		<dir>/RCS/file_name,v
#		<dir>/file_name,v
#	<dir> has to be relative to RCSSRC.
#	The file names on SRM are derived from the original one (all modes).
#	All lower case letters in directory names are translated into upper
#	case letters. If there is a suffix .c, .p or .h at the end of the
#	file name it is stripped. A .TEXT is appended to all file names on
#	the SRM.
#	
d39 2
a40 1
PWSSRC=/net/pawsturn/source
d43 1
a43 1
netunam /net/pawsturn paws:error104
d47 1
a47 1
if [ $# -lt 1 -o $# -gt 2 ] 
d54 1
a54 1
dirlist="assm comp1 hfs init init2 iolib libr mysys osfs progs rs232 specs hprogs pclib pclib/crt pclib/gen pclib/stdio pclib/sys ccomp vme"
d76 1
a76 1
	-a)		all=y
d79 1
a79 1
	-u)		if [ ! -f "$LASTXFR" ]
d91 1
a91 1
	-f)		filecp=y	
d105 2
a106 2
					/*)	filelist=$2;;
					*)	filelist=`pwd`/$2;;
d109 1
a109 1
	*)		echo $USAGE
d113 1
a113 1
#	change to the directory containing the PWS source	
d143 1
a143 1
	
d148 1
a148 1
			LOGINFO=`rlog -L -R $filename` 
d159 1
a159 1
	
d174 1
a174 1
#						co -p $filename | srmcp -b -t59723 -v$SRMVOL  - $SRMDEV:$PWSNAME;;
d177 1
a177 1
#						co -p $filename | expand | srmcp -p  -v$SRMVOL  - $SRMDEV:$PWSNAME;;
d179 1
a179 1
				
d195 1
a195 1
			echo "copy semaphor for $dir"	
d201 1
a201 1
	
d207 1
a207 1
	
d210 1
a210 1
	
d233 2
a234 2
			*/RCS)	dir=`dirname $dir` ;;
			*)	;;
d237 1
a237 1
		
d239 1
a239 1
		LOGINFO=`rlog -L -R $filename` 
d264 1
a264 1
#					co -p $filename  | srmcp -b -t59723 -v$SRMVOL  - $SRMDEV:$PWSNAME;;
d267 1
a267 1
#					co -p $filename | expand | srmcp -p  -v$SRMVOL  - $SRMDEV:$PWSNAME;;
d289 1
a289 1
( cd $PWSSRC/CCOMP	# local 'cd'
d301 24
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
#	UNIX2PWS for PWS 3.2
d9 2
d14 1
a14 1
#	usage: unix2pws -a | -u | -f <file name>
d16 3
a18 3
#	unix2pws can be called with three different options. The -a option
#	copies all RCS files from $UXSRC/*/RCS onto the SRM system. If 
#	unix2pws is invoked with the -u option only those files in those
d26 1
a26 1
#	<dir> has to be relative to UXSRC.
d38 2
a39 2
UXSRC=/src/paws/src
PWSSRC=/NEWCODE
d42 2
d45 1
a45 1
USAGE="usage: unix2pws -a | -u | -f <file name>"
d76 2
a77 2
			echo "*** Full unix2pws started on `date`"
			echo "*** Full unix2pws started on `date`" >> $LOGFILE;;
d83 2
a84 2
				echo "*** Full unix2pws started on `date`" >> $LOGFILE
				echo "*** Full unix2pws started on `date`"
d86 2
a87 2
				echo "*** Update unix2pws started on `date`" >> $LOGFILE
				echo "*** Update unix2pws started on `date`"
d101 2
a102 2
				echo "Full unix2pws started for files in $2 on `date`"
				echo "Full unix2pws started for files in $2 on `date`" >>$LOGFILE
d113 1
a113 1
cd $UXSRC
d123 1
a123 1
		echo "unix2pws of $dir on `date`"
d125 1
a125 1
		echo "unix2pws of $dir on `date`" >>$LOGFILE
d172 2
a173 1
						co -p $filename  | srmcp -b -t59723 -v$SRMVOL  - $SRMDEV:$PWSNAME;;
d175 2
a176 1
						co -p $filename | expand | srmcp -p  -v$SRMVOL  - $SRMDEV:$PWSNAME;;
d201 2
a202 2
	echo "*** unix2pws finished on `date`"
	echo "*** unix2pws finished on `date`" >> $LOGFILE
d217 2
a218 2
		echo "ERROR during unix2pws check $LOGFILE"
		echo "ERROR during unix2pws check $LOGFILE" >>$LOGFILE
d262 2
a263 1
					co -p $filename  | srmcp -b -t59723 -v$SRMVOL  - $SRMDEV:$PWSNAME;;
d265 2
a266 1
					co -p $filename | expand | srmcp -p  -v$SRMVOL  - $SRMDEV:$PWSNAME;;
d283 21
a303 2
echo "*** unix2pws finished on `date`"
echo "*** unix2pws finished on `date`" >> $LOGFILE
@
