(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

  Next Previous Contents

3. Setting up CVS

First you need to install the CVS package, on Redhat linux use


cd /mnt/cdrom/Redhat/RPMS
rpm -i rcs*.rpm
rpm -i cvs*.rpm
To see the list of files installed do -
rpm -qpl cvs*.rpm | less

and browse output using j,k, CTRL+f, CTRL+D, CTRL+B, CTRL+U or using arrow keys, page up/down keys. See 'man less'.

On other flavors of unix, you may need to download the RCS and CVS tar balls and follow README, INSTALL files to setup CVS. Visit http://www.cyclic.com and http://www.loria.fr/~molli/cvs-index.html

3.1 Environment variables

The following environment variables need to be setup in /etc/profile - default values required for all users. If not set in /etc/profile, than you should add these to your local profile file  /.bash_profile.


export EDITOR=/bin/vi
export CVSROOT=/home/cvsroot
export CVSREAD=yes

Create a directory to store the source code repository and give read, write access to unix group/user. Also make sure that the directory name of CVSROOT does not contain any blank spaces. For example CVSROOT should not be like '/home/my rootcvs'.


export CVSROOT=/home/cvsroot
mkdir $CVSROOT
chmod o-rwx $CVSROOT
chmod ug+rwx $CVSROOT

Now, change the group of $CVSROOT to group-name of users who want to use cvs sytem.
chgrp users $CVSROOT

To initialize the CVS and to put in source code files do -
cvs init

# Change directory is a must
cd $HOME/my_source_code_dir

# Must give vendor tag and revision tag
cvs import my_source_code_dir V1_0 R1_0  

3.2 Migrate RCS to CVS

To migrate the existing RCS files to CVS, use the following script. Make sure that you installed korn shell package pdksh*.rpm from Linux contrib cdrom.

NOTE : Korn shell /bin/ksh is obtained by installing pdksh*.rpm from Linux contrib cdrom


#!/bin/ksh

#############################################################
# Program to Migrate the existing source code in RCS to CVS 
#
# Needs the korn shell RPM package  pdksh*.rpm from Linux 
# contrib cdrom
#############################################################

#
# rcs2cvs - convert source tree from RCS to CVS
#

# project to convert
PROJECT='project'

# current RCS root
RCSROOT="$HOME/rcs"

if cd "$RCSROOT/$PROJECT"
then
        cd "$RCSROOT"
else
        echo >&2 "`basename "$0"`: can't change to RCS directory '$RCSROOT/$PROJECT'."
        exit 1
fi

# current CVS root
CVSROOT="$HOME/cvs"

# create new CVS directory for project 'project'
if mkdir "$CVSROOT/$PROJECT"
then
        :
else
        echo >&2 "`basename "$0"`: can't create CVS directory '$CVSROOT/$PROJECT'."
        exit 2
fi

# create CVS project tree from RCS tree
find "$PROJECT" -type d -name RCS -print |
while read RCS
do
        CVS="`dirname "$RCS"`"
        (if cd "$RCS"
        then
#               if find . -type f -name '*,v' -print | cpio -pdmv "$CVSROOT/$CVS"
                if find . -type f -print | cpio -pdmv "$CVSROOT/$CVS"
                then
                        :
                else
                        echo >&2 "`basename "$0"`: can't convert RCS subdirectory '$RCSROOT/$RCS' to CVS subdirectory '$CVSROOT/$CVS'."
                fi
        else
                echo >&2 "`basename "$0"`: can't change to RCS subdirectory '$RCSROOT/$RCS'."
        fi)
done

Now the RCS is migrated to CVS as 'project'. You can start using the CVS commands on module 'project'.
Next Previous Contents