Using CVS with your os source

1. making your cvsroot directory

CVS keeps all of its files in a directory somewhere. This directory is refered to as CVSROOT. You can make this directory by doing the following from you home directory:
spam 5 ~> mkdir -p cvsroot/CVSROOT
spam 6 ~> cd cvsroot
spam 7 ~/cvsroot> cvs init
To tell CVS to use this directory as CVSROOT by setting the CVSROOT environment variable.

csh:

spam 7 ~> setenv CVSROOT $HOME/cvsroot

sh:

$ CVSROOT=$HOME/cvsroot
$ export CVSROOT

2.Importing you Souce Tree

To import an alreay existing source base make a copy of the existing directory and weed out all the temporary, object, and other non-essestial files.
spam 14 ~> cp -r myos myos.tmp
spam 15 ~> cd myos.tmp
spam 16 ~/myos.tmp> rm *~ *.o
Now from withing that use the 'cvs import <repository> <vendor-tag> <release-tag>' command.
spam 17 ~/myos.tmp> cvs import myos konk start

*cvs will ask you to enter version info now *

N myos/main.c
N myos/Makefile

No conflicts created by this import
now if you look in $CVSROOT you should see a directory made for your os
spam 23 ~/myos.tmp> ls $CVSROOT
CVSROOT  myos
you can now remove your temporary directory and archive and remove you old os scource directory.
spam 24 ~/myos.tmp> cd ..
spam 25 ~> rm -r myos.tmp
spam 26 ~> tar -cf myos-old.tar myos
spam 27 ~> gzip myos-old.tar
spam 28 ~> rm -r myos

3. Checking out your source

To checkout your source tree simply do a 'cvs checkout <repository>'.
spam 3 ~> cvs checkout myos
cvs checkout: Updating myos
U myos/Makefile
U myos/main.c
spam 4 ~> ls myos
CVS       Makefile  main.c
After this point CVSROOT will be stored in the directory you just checked out so you will not need to set it when using the checked out copy.

4. Updating Files

To update the repository simply do a 'cvs update'. This will update all the source in you checked out copy to reflect changes in the repository.
spam 7 ~/myos> cvs update
cvs update: Updating .
U main.c

5. Commiting Changes

To push changes back to the repository use the 'cvs commit' command.
spam 33 ~/myos> cvs commit > tmp
cvs commit: Examining .
cvs commit: Committing .

*cvs will ask you to enter version info now *

/u/gilling/cvsroot/myos/main.c,v  <--  main.c
new revision: 1.3; previous revision: 1.2
done

6. Adding Files

To add a file to the repository use the 'cvs add <file>' command followed by a 'cvs commit'.
spam 10 ~/myos> cvs add spam.c
cvs add: scheduling file `spam.c' for addition
cvs add: use 'cvs commit' to add this file permanently
spam 11 ~/myos> cvs commit
cvs commit: Examining .
cvs commit: Committing .

*cvs will ask you to enter version info now *

RCS file: /u/gilling/cvsroot/myos/spam.c,v
done
Checking in spam.c;
/u/gilling/cvsroot/myos/spam.c,v  <--  spam.c
initial revision: 1.1
done 

N. Using CVS remotely

There are three ways of using cvs remotely:
  1. pserver
    To use this set your $CVSROOT to ':pserver:<user>@<host>:<cvsroot>' (ex. ':pserver:gilling@spam.acm.uiuc.edu:/home/gilling/cvsroot')

  2. rsh
    This method is less usefull and secure than pserver as the cvs server has to trust the client machine. To use this set you $CVSROOT to ':ext:<user>@<host>:<cvsroot>'. (ex. ':ext:gilling@spam.acm.uiuc.edu:/home/gilling/cvsroot' )

  3. ssh
    This methond is better than the rsh method because you can use a password to access the server and is better than pserver because it encrypts both your password and your data. The disadvantage is your cvs server has to be running sshd and your client has to have ssh. If you meet both of these conditions use this method. To use this method simply set things up as with rsh and set $CVS_RSH to ssh.

Erik Gilling
Last modified: Tue Sep 30 10:42:52 CDT 1997