Wednesday, September 2, 2009

How to Configure CVS Repository in Linux

CVS Configuration for Linux:

1 install cvs rpm
2 check the rpm rpm –qa | grep cvs

Method
1 local
2 ext method
3 pserver method

1 local method:

Login to locally access cvs set path like this

Setenv CVSROOT /home/cvsroot

3 Ext method: remote machine access it will ask password through ssh:

Setenv CVSROOT: ext:praveen@bgasic007:/home/cvsroot
Setenv CVS_RSH ssh

Ext method without passwd you can configure rost:


user add:

Useradd –M –d /home/cvs cvs

//cvs hoe directory is used download one copy of file from cvs repository
Group command:

Groupadd cvs

Create Cvs Repository Directory:

Mkdir –p /home/cvsroot

Change permission:

Chmod –R 777 /home/cvsroot

Change owner:

Chown -R cvs.cvs /home/cvsroot

SET environment variable in .bash_profile

Export CVSROOT=/home/cvsroot
Export EDITOR=VI
Export CVSREAD=yes

Initiate cvs repository directory

Cvs –d /home/cvsroot init

Create another user:
Useradd –M –d /home/username username

Change shell:

VI /etc/passwd

/bin/csh /bin/bash

Add user to cvs group:

Vi /etc/passwd

Enter cvs group id

Login to su command user name

CVS In client:

Edit .cshrc file:

Set the environment variable

Save the file

Update

Source .cshrc

Checkout command:

Cvs checkout Cvs repository path

Ex:cvs checkout /home/cvsroot/CVSROOT

Update command

Cvs update CVSROOT

CVS Import Command:
cvs import PCIE_BFM vendor-tag release-tags


Differences Between the ‘ext’ Method and the ‘pserver’ Method

The ‘ext’ Method
:

User account is required on the server.
Uses rsh or similar to provide the connection to the machine on which the repository
Resides. We will be using ssh for our secure connection. This is done by setting the
CVS_RSH environment variable to “ssh”.
Specify server machine and account name when specifying a repository:
:ext:@:



The ‘pserver’ Method:

No user account is required on the server.
Requires a CVS password authentication server to be running on the server.
Specifying server machine and (CVS) account name:
: pserver:@:
User must “log in” to server with CVS login before using repository.
Passwords transmitted over the net in the clear with each CVS operation, and stored
on local host.

Why Use ext/ssh
1
The CVS pserver uses an unencrypted protocol to a TCP server. This means that all data
Transfers, including the “authentication” mechanisms, occur in plain text over the network.
When unencrypted network protocols are used, especially over the Internet, authentication
and authorization mechanisms are prone to abuse, and you may be inviting some serious
trouble. By using SSH, however, you will have the added security of host authentication using
host keys, encrypted user authentication against a local database of syst


Cvs Commands:

The diff Command

The diff command shows the difference between two revisions of a file. If you invoke this command without any options, CVS shows the difference between the current local working file and the earlier revision stored in the repository. The current local working file need not be saved in the repository using the commit command. For example, to show a difference between the new.txt file, which is saved in the repository yesterday, and the local working copy of the same file, the syntax is:

$ cvs diff –D yesterday new.txt new.txt

The checkout Command

The checkout command creates or updates the current working directory with copies of source files from the repository. You need to specify the module in the repository from which you require files. Depending on the file structure in that module, files will be copied to recursively created directories, which is similar to creating a mirror image of the module. The following syntax uses the checkout command:

$ cvs checkout new_module

Option Description
-D Uses the most recent revision of a file.
-f Retrieves the most recent revision, if no matching revision is found.
-k Processes keywords according to kflag.
-l Locates a file in the current working directory.
-n Disables the checkout command.
-P Deletes empty directories from the repository.
-p Retrieves files for the standard output. -R Checks out directory recursively.
-r Implements the revision tag.
-A Resets sticky tags, dates, and –k options.
-c Copies module files.
-d Creates a working directory.

The rtag Command

The rtag command specifies a tag name to a module in the repository. This command does not require a local working copy. This command should be used carefully because it directly affects the repository. A tag name created using rtag can be deleted using the –d command option. For example, to create a new tag, New_tag, in the repository module, my_project, for the revision dated no later than yesterday, the syntax is:
$ cvs rtag –D yesterday New_tag my_project

The rdiff Command

The rdiff command shows the difference between two releases of the same project in the repository. For example, use the following syntax to display the difference between two releases, release1 and release2:

$ cvs rdiff -R release1 release2

various options that you can use with the rdiff command:
Option Description
-f Retrieves the most recent version.
-c Uses the context diff format.
-s Generates a summary change report.
-t Displays a diff of the top two revisions.
-u Uses the unidiff format.

The edit Command

The edit command enables you to edit or modify a file. When you edit a file, the file is temporarily added to the list of file watchers. You can release the file from the list of file watchers using the unedit command. For example, to edit a watched file in the current local working directory, use the following syntax:
$ cvs edit –l watched_file.txt

To release a watched file from the list of file watchers, use the following syntax:
$ cvs unedit –l watched_file.txt

The remove Command

The remove command removes files and directories from a CVS repository. Before removing a file, you need to delete files from the current working copy of the repository. Use the remove and commit commands, respectively, to delete the files from the repository. For example, to use the remove command, the syntax is:
$ rm new.txt
$ cvs remove new.txt
$ cvs commit –m "Removed file" new.txt

Note

You need to explicitly state the file name in all the commands. CVS does not need a method to remove directories. To delete a directory, first delete all the files from working copy of the directory. Use the remove command to delete all the files from CVS and commit the changes. Change the current directory to one level above and run the update command with the –P option, which removes the empty directory.
For example, to use the remove and the commit commands, use the following syntax:
$ rm new1.txt
$ rm new2.txt
$ cvs remove new1.txt new2.txt
$ cvs commit –m "Removed files" new1.txt new2.txt
$ cd
$ cvs update –P

The add Command

The add command adds files and directories to the CVS repository. To add a file to the repository, you need to use the commit command. For example, to add the new.txt file to the CVS repository, use the following syntax:
$ cvs add new.txt
$ cvs commit –m "New text file" new.txt


Note
To add a directory, create the directory using mkdir. Use the add command to add the directory. A CVS subdirectory is automatically created within every directory added to a repository.

To add a binary file, you need to use the –kb command option. For example, to add a binary file, new.gif, the code is:
$ cvs add –kb new.gif


$ cvs commit –m "New binary file" new

No comments:

Post a Comment