Whole document tree 3. Setting up CVSFirst 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 the 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 the README, INSTALL files to setup CVS. Visit http://www.cyclic.com and http://www.loria.fr/~molli/cvs-index.html 3.1 Environment variablesThe following environment variables need to be setup in /etc/profile - default values required for all users. If not set in /etc/profile, then you should add these to your local profile file /.bash_profile.
export EDITOR=/bin/vi export CVSROOT=/home/cvsroot export CVSREAD=yes And of course, individual users can override the environment variables set in /etc/profile by resetting them in their local profile file /.bash_profile # File ~/.bash_profile # Overriding env variables by resetting export EDITOR=/usr/bin/emacs export CVSROOT=/home/anotherdir/java/cvsroot 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'. bash$ su - root bash# export CVSROOT=/home/cvsroot bash# groupadd --help bash# groupadd cvs bash# useradd --help bash# useradd -g cvs -d /home/cvsroot cvs bash# ls -ld $CVSROOT ... (you should see the listing) bash# chgrp -R cvs $CVSROOT bash# chmod o-rwx $CVSROOT bash# chmod ug+rwx $CVSROOT #To initialize the CVS repository and to put in source code files do: bash# cvs init # Add the unix users to the cvs group. Create supplementary groups for users. # Note that you MUST not put any blank spaces after comma seperating the # group names in -G option. # In example below user tom belongs to groups cvs, users and staff and user # johnson belongs to group cvs only. bash# usermod --help bash# usermod -G cvs some_unix_username bash# usermod -G cvs,users,staff tom bash# usermod -G cvs,users,staroffice billclinton bash# usermod -G cvs johnson bash# exit .... (logout of root superuser mode) # Login as a user and import files into cvs.... bash$ su - billclinton bash$ export EDITOR=/bin/vi bash$ export CVSROOT=/home/cvsroot bash$ export CVSREAD=yes # Change directory is a must bash$ cd $HOME/somedir/anotherdir/directory/my_source_code_dir # Must give vendor tag and revision tag cvs import somedir/anotherdir/directory/my_source_code_dir Vendor1_0 Rev1_0 # Also note that it is very important to give the directory tree starting # from the $HOME, that is, in above example starting from somedir. # For example I did: bash$ cd $HOME/howto/foobar bash$ cvs import howto/foobar Vendor1_0 Rev1_0 # Another example is: bash$ cd $HOME/javafilesdir bash$ cvs import javafilesdir Vendor1_0 Rev1_0 # A sample testing and verification: bash$ cd $HOME/howto/foobar bash$ cvs checkout myfoo.java TROUBLESHOOTING: When doing checkout it says module is unknown. It is a common mistake not to change directory while doing cvs import. You MUST change directory to the source-code-directory and then do cvs import. For example: bash$ cd $HOME/somedirectory/foobardir bash$ cvs import somedirectory/foobardir Vendor1_0 Rev1_0 3.2 Migrate RCS to CVSTo migrate the existing RCS files to CVS, use the following script. Make sure that you installed the Korn shell package pdksh*.rpm from the Linux contrib cdrom. NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the 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 |