Jump to content

HOWTO CVS tutorial (HOWTO)


aru
 Share

Recommended Posts

 

illogic-al

Senior user

Joined: 01 May 2002

Posts: 358

Location: Smack dab in the middle of it all.

 

Posted: Fri May 03, 2002 7:11 pm Post subject: CVS tutorial (HOWTO)

_________________________________________________________________

 

 

I can do CVS now, whoohoo. Might give KDE3 a try just to test my new found abilities. Found this on tutorial gentoo's site. Ripped word for word.

 

CVS -- do you have it?

 

Before you can actually use CVS, you need to get it installed on your system. The easiest way to test to see if it's installed is to type:

 

Code listing 1

 

Code:

                                   # cvs



 

 

If a cvs command is found, then you've got it! Otherwise, you'll need to either track down a binary package for your particular distribution, or install it from sources. Installing CVS from sources is actually quite simple, and I'll show you how in the next panel.

 

Installing CVS from sources

 

Installing CVS from sources is easy. First, grab the cvs-1.11.tar.gz tarball from 1.11.tar.gz (if there's a newer version listed here, you might as well grab the new one instead.) Then perform the following steps (command output has been omitted for brevity):

 

Code listing 2

 

Code:

                         # tar xzvf cvs-1.11.tar.gz

                              # cd cvs-1.11

                              # ./configure

                                  # make

                              # make install



 

 

Now you should be ready to go.

 

The CVSROOT

 

Before we begin, there are a few CVS fundamentals that you need to know. The first is that in order to connect to a CVS repository, you first need to know a path called the "CVSROOT". The CVSROOT is a string, like a URL, that tells the cvs command where the remote repository is and how we'd like to connect to it. Just to make things interesting, CVS has a number of CVSROOT formats, depending on whether the CVS repository is local or remote and what method you're going to use to connect to it. Here are some example CVSROOTs, along with explanations...

 

A local CVSROOT

 

Code listing 3

 

Code:

                           CVSROOT=/home/cvsroot



 

 

This is an example of a local CVSROOT path; you'd use a CVSROOT like this if you wanted to connect to a local repository that exists at /home/cvsroot; or maybe you have a repository mounted via NFS at /home/cvsroot.

 

A remote password server CVSROOT

 

Code listing 4

 

Code:

               CVSROOT=:pserver:cvs@foo.bar.com:/home/cvsroot



 

[/code]

 

Here's an example of a CVSROOT that uses the RSH or SSH protocol; in this example, the CVS server will attempt to access the repository on foo.bar.com using the drobbins account. If the CVS_RSH environment variable is set to "ssh", then our cvs client will attempt to use ssh to connect; otherwise rsh will be used. The ssh access method is popular with those who are concerned about security; however, neither the RSH or SSH method provides a way for anonymous users to get the sources. In order to use this method, you must have a login account at foo.bar.com.

 

A few more things...

 

In addition to the CVSROOT, you'll also need to know the name of the module (collection of sources) that you'd like to check out, as well as an anonymous password that you'll need to log in to the CVS password server. Unlike anonymous ftp, there is no "standard" format for the anonymous password, so you'll need to get the specific password from the developer web site or the developers themselves. Once you have all this info, you're ready to begin.

 

Interacting with CVS, part 1

 

Grabbing the sources is a two-stage process. First, we log in to the password server. Then, we grab the sources with a checkout command.

Here's an example set of commands that can be used to check out the latest Samba sources, a popular UNIX/Windows integration project:

 

Code listing 6

 

Code:

          # export CVSROOT=:pserver:cvs@pserver.samba.org:/cvsroot



 

 

This first command sets the CVSROOT environment variable. If you don't set this variable, the following two commands will require an additional -d :pserver:cvs@pserver.samba.org:/cvsroot following the cvs command. Exporting the CVSROOT saves a us bit of typing.

 

Interacting with CVS, part 2

 

Here are the commands needed to get a current copy of the developer sources. You may want to jump forward to the next panel to read the explanation of these commands, and then jump back here:

 

Code listing 7

 

Code:

                                # cvs login

                             (Logging in to )

                   CVS password: (enter password here)



                            # cvs -z5 co samba

                             U samba/COPYING

                             U samba/Manifest

                              U samba/README

                        U samba/Read-Manifest-Now

                             U samba/Roadmap

                           U samba/WHATSNEW.txt

          (this is just a snippet of the complete cvs co output)



 

 

Interacting with CVS -- the explanation

 

The first cvs command above logs us in to the pserver, and the second tells our CVS client to check out ("co") the samba module using a gzip compression level of 5 ("-z5") to speed up the transfer over a slow link. For every new file that is created locally, cvs prints out a "U [path]" indicating that this particular file has been updated on disk.

 

Checkout complete

 

Once the checkout command completes, you'll see a "samba" directory in your current working directory that contains the latest sources. You'll also notice that all the directories have a "CVS" directory inside them -- CVS stores accounting information inside these direcotries, and they can safely be ignored. From this point forward, we don't need to worry about having the CVSROOT environment variable set nor do we need to specify it on the command line because it's now cached inside all those extra "CVS" directories. Remember -- you only need to have the CVSROOT set for the initial login and checkout.

 

Updating the sources

 

Well, there you are -- fresh sources! Now that you have the sources, you can go ahead and compile and install them, inspect them, or do whatever you like with them.

 

Every now and then, you may want to bring your checked-out source directory in-sync with the current version on CVS. To do this, you don't need to log in to the pserver again; your authentication info is also cached by cvs inside those "CVS" accounting directories. First, enter the main checked-out directory (in this case "samba"), and type:

 

Code listing 8

Code:

                              # cvs update -dP



 

 

Looking at "cvs update", part 1

 

If there are any new files, cvs will output "U [path]" lines for each one as it updates them. Also, if you compiled the sources, you will probably see a lot of "? [path]" lines; these are object files that

cvs notices are not from the remote repository.

 

Looking at "cvs update", part 2

 

Also, notice the two command-line options we used for "cvs update". "-d" tells cvs to create any new directories that may have been added to the repository (this doesn't happen by default), and "-P" tells cvs to remove any empty directories from your locally checked-out copy of the sources. "-P" is a good idea, because cvs has a tendency to collect a lot of empty (once used, but now abandoned) directory trees over time.

 

The bastards won't allow us to post in the How-To section. They're trying keep us down. NEWBIES UNITE. Let us beat back the oppresors who seek to reprive us of our most basics right to learn :roll:Uhh.. yeah

 

Edit by JeroenM:

nice tutorial.

I have no idea why you posted it in "off-topic" instead of "tips & tricks"

Guess this section is more appropriate

 

 

 

Editor's note: This thread was originally posted at the old MUB (Mandrake User Board at club-nihil). This post is the result of a 99% automatic backup, so due to its nature some text may be lost (improbable but possible).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...