hubertf's NetBSD Blog
Send interesting links to hubert at feyrer dot de!
 
[20050320] Switching CVS servers easily
After copying a few old trees checked out from CVS today, and updating them afterwards, I got the dreaded list of conflicts in files that I've never touched:
 ...
 P distrib/sets/lists/xserver4/md.i386
 P distrib/sets/lists/xserver4/mi
 cvs update: move away distrib/utils/sysinst/Makefile; it is in the way
 C distrib/utils/sysinst/Makefile
 cvs update: move away distrib/utils/sysinst/Makefile.inc; it is in the way
 C distrib/utils/sysinst/Makefile.inc
 cvs update: move away distrib/utils/sysinst/SPELLING.en; it is in the way
 C distrib/utils/sysinst/SPELLING.en
 ...  
Remembering that this is usually caused by having different values in the CVS/Root files, this was the case for me too - I had a generic address of a CVS server in most of the files, but the files under src/distrib had a IPv4-only address in there, which caused the problem.

To end the problem for all times, I remembered of a nice trick I saw recently (I think mentioned by someone from the NetBSD admins team) to use one file for all CVS/Root files, and hardlink that into all "CVS"-directories:

 % cd .../src
 % cat CVS/Root >r
 % find . -name Root | grep CVS/Root \
 ? | sh -c 'while read r ; do echo rm $r ; echo ln r $r ; done' \
 ? | sh -v
 % rm r 
This command first copies the contents of .../src/CVS/Root to a temporary file "r" - make sure it contains the value to be used anywhere! After that, all CVS/Root files are searched, removed and (hard)linked to the temporary file, which is then removed.

Now whenever the CVS repository needs to be switched, updating a single file is enough, due to all the .../CVS/Root files being hardlinks to the same file (watch the link count of 6494):

 % ls -la CVS/Root
 -rw-r--r--  6494 feyrer  wheel  32 Mar 20 20:39 CVS/Root
 % cat bin/ls/CVS/Root 
 anoncvs@anoncvs.netbsd.org:/cvsroot
 % echo anoncvs@anoncvs.fr.netbsd.org:/cvsroot >CVS/Root
 % cat bin/ls/CVS/Root 
 anoncvs@anoncvs.fr.netbsd.org:/cvsroot 



[Tags: ]


Disclaimer: All opinion expressed here is purely my own. No responsibility is taken for anything.

Access count: 36034251
Copyright (c) Hubert Feyrer