Moving a CVS repository to a new machine PDF Print E-mail
Thursday, 09 April 2009 14:03

Firstly, thanks to Hannes for his help with this.  Without him I would have had to do a whole lot more reading and make a whole lot more mistakes.

Background to this is that the server Nevada was getting old and we wanted to shift it to the new server, Taormina.  Note:  The methods outlined below require each user to have an account created on the new machine, which is fine for me cos there were only 4 of us.  If its a large scale deployment hunt out Hannes and pay him to do it, and while you are at it switch to svn.

  • Firstly create the directory on the new machine & rsync all the existing content across.  The -p flag in rsync is important cos it pulls the permissions across.
      TAORMINA:/var/lib # mkdir cvsroot
      TAORMINA:/var/lib # cd cvsroot
      TAORMINA:/var/lib/cvsroot # rsync -rp 192.168.0.54:/var/lib/cvsroot .
      root@ 192.168.0.54's password:
      TAORMINA:/var/lib/cvsroot #
  • Next make the contents of the directory writeable by the people who should have CVS access.  Following the advice of cvsbook.redbean.com I created a cvs group and added the relevant users to it.  Following the advice of Hannes I set the contents of the directory setgid cvs so that any new files created in that directory will be owned by the same group that owns the directory (ok rsync -p should have done this but it can't hurt to make sure).
      TAORMINA:/var/lib/cvsroot # chgrp -R cvs .
      TAORMINA:/var/lib/cvsroot # find -type d -print0 | xargs -0 chmod g+s
      TAORMINA:/var/lib/cvsroot # ls -ld .
      drwxrwsr-x 52 root cvs 1456 2009-04-09 10:58 .
      TAORMINA:/var/lib/cvsroot #
  • Now edit the .bashrc of each user to add/alter the CVSROOT and CVS_RSH directories.
      export CVSROOT=:ext:cianer@taormina:/var/lib/cvsroot
      export CVS_RSH=ssh
  • Finally try to write to the cvs directory to ensure the permissions are set up properly.  If so do a test checkout:
      cianer@TAORMINA:/var/lib/cvsroot> touch testfile
      cianer@TAORMINA:/var/lib/cvsroot> rm testfile
      cianer@TAORMINA:/var/lib/cvsroot> exit
      logout
      Connection to taormina closed.
      cianer@Feegle:~/cvs_test$  cvs co ixp400_xscale_sw
      Password:
      cvs checkout: Updating ixp400_xscale_sw
      U ixp400_xscale_sw/Makefile
      U ixp400_xscale_sw/ixp425_eth.c
      .......


Other things that might be useful:

  • To prevent having to type your password each time create trusted keys for the server.
  • To switch your checkout to the new CVS repository run a variant of this script from the high-level checkout directory (the example below is designed to switch me from the local repository at /var/lib/cvsroot to the remote repository created on taormina at /var/lib/cvsroot):
      find * | grep Root | xargs sed -i 's/\/var/:ext:cianer\@taormina:\/var/'
  • Note:  After you run the above script you will need to make sure your CVSROOT is updated, otherwise will you get the following error:
      cianer@Feegle:~/temp$ cvs status
      cvs [status aborted]: cannot exec : No such file or directory
      cvs [status aborted]: end of file from server (consult above messages if any)
 
Joomla Templates by Joomlashack