Friday, June 23, 2006

CVS-Concurrent Versioning System


CVS is a version control system. Using it, you can record the history of your source files.

CVS started out as a bunch of shell scripts written by Dick Grune, posted to the newsgroup
comp.sources.unix in the volume 6 release of July, 1986. While no actual code from these shell
scripts is present in the current version of CVS much of the CVS conflict resolution algorithms
come from them.

n April, 1989, Brian Berliner designed and coded CVS. Jeff Polk later helped Brian
with the design of the CVS module and vendor branch support.

You can get CVS in a variety of ways, including free download from the Internet.
For more information on downloading CVS and other CVS topics, see:

2.CVS Installation:

Now a days Most of the linux distributions bundled with CVS packages.
If you want to upgrade or install , get the source code from the internet.
untar and compile as follow,

tar -xvzf <cvspack.tar.gz>

Inside cvspack dir,

make install

For detailed information read the INSTALL file.

3.CVS Repository Settings:

Create the user and group as cvs.

Give write permission to /home/cvs and ownership as cvs:cvs.

login as cvs and give

$ cvs init

Add the users under cvs group.

The directory being imported must have read permission by cvs otherwise
to avoid confusion chown as cvs:cvs for whole directory.

To specify about binary files, provide binary file details under CVSROOT/cvswrappers files as follow,

*.gif -k 'b'
*.png -k 'b'
*.tgz -k 'b'
*.doc -k 'b'
*.zip -k 'b'
*.pdf -k 'b'
*.so -k 'b'
*.o -k 'b'
*.a -k 'b'
*.psd -k 'b'
*.tiff -k 'b'
*.exe -k 'b'
*.jpg -k 'b'
*.ico -k 'b'
*.bmp -k 'b'
*.png -k 'b'
*.afm -k 'b'
*.jpeg -k 'b'
*.tif -k 'b'

For Binary files

There are two issues with using CVS to store binary files. The first is that
CVS by default converts line endings between the canonical form in which they
are stored in the repository (linefeed only), and the form appropriate to the operating
system in use on the client (for example, carriage return followed by line feed for Windows NT).

The second is that a binary file might happen to contain data which looks like a keyword
(see section Keyword substitution), so keyword expansion must be turned off.
The `-kb' option available with some CVS commands insures that neither line ending
conversion nor keyword expansion will be done.

$ cvs import -I ! -W "*.o -k 'b'" <module name> <vendor tag> <reltag>

-I name
Specify file names that should be ignored during import. You can use this option repeatedly.
To avoid ignoring any files at all (even those ignored by default), specify `-I !'.

-W spec
Specify file names that should be filtered during import. You can use this option repeatedly.
spec can be a file name pattern of the same type that you can specify in the `.cvswrappers' file.

-kb Insures that neither line ending conversion nor keyword expansion will be done.

In /etc/profile in server(for client side see remote repository section)

export EDITOR=/usr/bin/emacs
export CVSROOT=/home/cvs

4.Accessing Remote Repository using pserver (Password Authentication server).

From the Server side..........

Set /etc/xinet.d/cvs as

service cvspserver
port =2401
socket_type = stream
protocol =tcp
wait = no
user = root
passenv =PATH
group = cvs
server = /usr/bin/cvs
server_args =-f --allow-root=/home/cvs pserver
disable = no

In client side in /etc/profile add the following lines,

export CVSROOT=":pserver:x.x.x.x:2401/home/cvs"
export EDITOR="/usr/sbin/emacs"

x.x.x.x - Server IP Address

5.Read-only Permission

It is possible to grant read-only repository access to people using the password-authenticated server

There are two ways to specify read-only access for a user: by inclusion, and by exclusion.
"Inclusion" means listing that user specifically in the `$CVSROOT/CVSROOT/readers' file, which is simply a newline-separated list of users. Here is a sample `readers' file:


"Exclusion" means explicitly listing everyone who has write access--if the file


exists, then only those users listed in it have write access, and everyone else has read-only access (of course, even the read-only users still need to be listed in the CVS `passwd' file). The `writers' file has the same format as the `readers' file.

If `readers' exists, and this user is listed in it, then she gets read-only access. Or if `writers' exists, and this user is NOT listed in it, then she also gets read-only access (this is true even if `readers' exists but she is not listed there). Otherwise, she gets full read-write access.

Thats successfully set the cvs repository for ur project.

6.Getting Repository

To get the repository login and give your passwd

$cvs login

To get the files checkout the project as follows,

$cvs checkout <module>

After checkout the module (project) if you want to add the binary files,

$ cvs add -kb -m"A test file" <bin_file>
$ cvs ci -m"First checkin; contains a keyword" kotest

If a file accidentally gets added without `-kb', one can use the cvs admin command to recover. For example:

$ cvs add -m"A test file" <bin_file>
$ cvs ci -m"First checkin; contains a keyword" <bin_file>
$ cvs admin -kb <bin_file>
$ cvs update -A <bin_file>
$ cvs commit -m "make it binary" <bin_file>

7.Script for Binary files

If you import large project with lot of binary files, enjoy with the following
automated script


#Searching binary files and put that path in to forcvs.tmp
find * -exec file {} ';'|grep -v text|grep -v directory|grep -v Entries|grep -v Repository|grep -v Root|grep -v empty |grep -v Text| awk '{print $1}'|cut -d ":" -f1 >forcvs.tmp

#Reading line by line and specifying it as binary files.
cat forcvs.tmp | while read line;

echo $line

cvs admin -kb $line
cvs update -kb $line
cvs commit -m "binary files" $line

Run the above script inside the repository.

Errors and Solutions:

Problem : Connection Refused
Solution : Due to wrong ip or port.

Problem : Failed to open /home/bala/.cvspass for reading: No such file or directory.
: Fatal error aborting,
bala :no such user
Solution : Check whether the user exist and the home directories are created.

Problem : Authorization failed.
Solution : Add the user name in writers and passwd file.

Problem : Can not make the directory.. (while checkout)
Solution : Give Permission to the directory where u want to checkout.

Problem : cvs[init aborted]: can not make directory Emptydir :permission denied
Solution : logout and login again .

Problem : Lock problem while checkout ....
Solution : After first import change the mode of the files by the users under cvs group can
able to read the files.

technorati tags:, ,

1 comment:

Anonymous said...

Bio-tech, it's the new final frontier, eh?. [url=]Mulberry uk[/url] Its critical to have legal counsel experienced in administrative claims in your jurisdiction.. [url=]canada goose[/url] Cyrqcsyvb
[url=]pandora bracelet charms[/url] Eihykdwhb [url=]canada goose toronto factory[/url] ihrbeonfg