CVS-RCS-HOWTO Document for Linux (Source Code Control System)
alavoor[AT?yahoo.comv22.5, 2002-05-29
This document is a "practical guide" to very quickly setup CVS/RCS source code control system. This document has custom shell scripts that are wrappers on top of CVS. These scripts provide an easy user interface for CVS. Several shell scripts are provided to make RCS easier to use. The information in this document applies to Linux and as well as to all other flavors of Unix liks Solaris, HPUX, AIX, SCO, Sinix, BSD, SCO, Apple Macintosh (which is BSD unix) etc.. and BeOS.
(The latest version of this document is at
http://www.milkywaygalaxy.freeservers.com.
You may want to check there for changes).
A source code control system is a MUST to manage the changes occurring to a software project during development. Developers need a complete history of changes to backtrack to previous versions in case of any problems. Since source code is the most vital component of any software project and software development takes a huge amount of time and money, it is very important to spend some time in safe-guarding the source code by using source code control systems like CVS and RCS.
CVS (Concurrent Version Control System) is a powerful tool which allows concurrent development of software by multiple users. It uses RCS underneath and has an application layer interface as a wrapper on top of RCS.
CVS can record the history of your files (usually, but not always, source code). CVS only stores the differences between versions, instead of every version of every file you've ever created. CVS also keeps a log of who, when and why changes occurred, among other aspects.
CVS is very helpful for managing releases and controlling the concurrent editing of source files among multiple authors. Instead of providing version control for a collection of files in a single directory, CVS provides version control for a hierarchical collection of directories consisting of revision controlled files.
These directories and files can then be combined to form a software release.
CVS can be used for storing "C", "C++", Java, Perl, HTML and other files.
HISTORY of CVS: CVS is a very highly sophisticated and complex system. It is the "State of the Art" technology and is so called "software miracle". The CVS software is a very advanced and capable system developed over a very long period of time. And it took several years to mature!!. It tooks about 20 to 30 years of research to develop CVS algorithms and later coding it into a software. And even today, it is still evolving!!
CVS algorithms actually started in Universities several decades ago and CVS implementation started out as a bunch of shell scripts written by Dick Grune, who posted it to the newsgroup comp.sources.unix in the volume 6 release of December, 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. In April, 1989, Brian Berliner designed and coded CVS. Jeff Polk later helped Brian with the design of the CVS module and vendor branch support.
And today each and every major software development project in the world is written using CVS as the safe repository. As good old software hats say - "You are in very safe hands, if you are using CVS !!!"
CVS actually uses RCS underneath. CVS is a lot more powerful tool and can control a complete source code tree. It is very strongly recommended that you use CVS, because you can greatly customize CVS with scripting languages like PERL, Korn and bash shells. See the sample korn shell scripts at Shell Scripts .
Advantages of CVS:
from the repostitory and have his own separate stable source directory tree. *
*
*
via shell scripts or PERL scripts. CVS supports weak locking with the command 'cvs watches' and also no locking permitting concurrent editing of files. *
Disadvantages of CVS:
*
technology. The cvs software is a very advanced and capable system developed over a very long period of time (it took several years!!). It tooks about 20 to 30 years of research to develop CVS and it is still evolving!! *
learning curve for beginners. The shell scripts at Shell Scripts can ease usage. *
Advantages of RCS:
*
*
*
*
Downside of RCS:
locking and being limited to a single working directory. Because of the single working directory limitation, changes to files by multiple developers can cause failure of the 'make' command. *
*
This document also has shell scripts which provide simple commands to check-out, check-in, and commit files. See shell scripts at Shell Scripts
For RCS see the RCS mini-howto on the Linux cdrom:
cd /mnt/cdrom/Redhat/RPMS ls -l howto-6.0-.noarch.rpm rpm -qpl howto-6 | grep -i rcs
or visit
http://www.!LinuxDoc.org/HOWTO/mini/RCS.html
See also the RCS shell scripts at rcs_scripts
First you need to install the CVS package. On Redhat Linux use:
cd /mnt/cdrom/Redhat/RPMS rpm -i rcs*.rpm rpm -i cvs*.rpm rpm -i openssh*.rpm To see the list of files installed do - rpm -qpl cvs*.rpm | less
and browse the output using j,k, CTRL+f, CTRL+D, CTRL+B, CTRL+U or using arrow keys, page up/down keys. See 'man less'.
The Openssh is required if you want to use ssh (Secure Shell) wich CVS.
On other flavors of Unix, you may need to download the RCS and CVS tar balls
and follow the README, INSTALL files to setup CVS.
Visit
http://www.cyclic.com
and
http://www.loria.fr/molli/cvs-index.html
The following environment variables need to be setup in /etc/profile - default values required for all users. If not set in /etc/profile, then you should add these to your local profile file /.bash_profile.
export EDITOR=/bin/vi export CVSROOT=/home/cvsroot
And of course, individual users can override the environment variables set in /etc/profile by resetting them in their local profile file /.bash_profile
export EDITOR=/usr/bin/emacs export CVSROOT=/home/someotherdir/java/cvsroot
Create a directory to store the source code repository and give read, write access to Unix group/user. Also make sure that the directory name of CVSROOT does not contain any blank spaces. For example CVSROOT should not be like '/home/my rootcvs'.
bash$ su - root bash# export CVSROOT=/home/cvsroot bash# groupadd --help bash# groupadd cvs bash# useradd --help bash# useradd -g cvs -d $CVSROOT cvs bash# mkdir $CVSROOT bash# ls -ld $CVSROOT ... (you should see the listing) bash# chgrp -R cvs $CVSROOT bash# chmod o-rwx $CVSROOT bash# chmod ug+rwx $CVSROOT
bash# cvs init
bash# usermod --help bash# usermod -G cvs some_unix_username bash# usermod -G cvs,users,staff tom bash# usermod -G cvs,users,staroffice billclinton bash# usermod -G cvs johnson bash# exit .... (logout of root superuser mode)
bash$ su - billclinton bash$ export EDITOR=/bin/vi bash$ export CVSROOT=/home/cvsroot
bash$ export CVSREAD=yes
bash$ cd $HOME/somedir/anotherdir/directory/my_source_code_dir
cvs import somedir/anotherdir/directory/my_source_code_dir Vendor1_0 Rev1_0
bash$ cd $HOME/howto/foobar bash$ cvs import howto/foobar Vendor1_0 Rev1_0
bash$ cd $HOME/javafilesdir bash$ cvs import javafilesdir Vendor1_0 Rev1_0
bash$ cd $HOME/howto/foobar bash$ cvs checkout myfoo.java
TROUBLESHOOTING: When doing checkout it says module is unknown. It is a common mistake not to change directory while doing cvs import. You MUST change directory to the source-code-directory and then do cvs import. For example:
bash$ cd $HOME/somedirectory/foobardir bash$ cvs import somedirectory/foobardir Vendor1_0 Rev1_0
On client boxes where you want to use the CVS, you should install cvs packages and ssh package (if you want to use ssh). Setup the environment variables:
bash$ export CVSROOT=":ext:developer@cvs_server_box.domain.com:/home/cvsroot" bash$ export CVS_RSH="ssh"
The cvs_server_box.domain.com is the IP address of the remote CVS repository server and 'developer' is the user id. Another example using pserver is given below:
bash$ export CVSROOT=:pserver:username@cvs.tldp.org:/cvsroot bash$ export CVS_RSH="ssh"
See also multiuser .
To migrate the existing RCS files to CVS, use the following script. Make sure that you installed the Korn shell package pdksh*.rpm from the Linux contrib cdrom.
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
#
contrib cdrom
#
#
PROJECT='project'
RCSROOT="$HOME/rcs" if cd "$RCSROOT/$PROJECT" then cd "$RCSROOT" else echo >&2 "`basename "$0"`: can't change to RCS directory '$RCSROOT/$PROJECT'." exit 1 fi
CVSROOT="$HOME/cvsroot"
if mkdir "$CVSROOT/$PROJECT" then : else echo >&2 "`basename "$0"`: can't create CVS directory '$CVSROOT/$PROJECT'." exit 2 fi
find "$PROJECT" -type d -name RCS -print | while read RCS do CVS="`dirname "$RCS"`" (if cd "$RCS" then
if find . -type f -print | cpio -pdmv "$CVSROOT/$CVS" then : else echo >&2 "`basename "$0"`: can't convert RCS subdirectory '$RCSROOT/$RCS' to CVS subdirectory '$CVSROOT/$CVS'." fi else echo >&2 "`basename "$0"`: can't change to RCS subdirectory '$RCSROOT/$RCS'." fi) done
Now the RCS is migrated to CVS as 'project'. You can start using the CVS commands on module 'project'.
CVS provides a rich variety of commands (cvs_command in the Synopsis), each of which often has a wealth of options, to satisfy the many needs of source management in distributed environments. However, you don't have to master every detail to do useful work with CVS; in fact, five commands are sufficient to use (and contribute to) the source repository. The most commonly used CVS commands are: checkout, update, add, remove, commit and diff.
cvs checkout modules... A necessary preliminary for most CVS work: creates your private copy of the source for modules (named collections of source; you can also use a path relative to the source repository here). You can work with this copy without interfering with others' work. At least one subdirectory level is always created.
bash$ cvs --help checkout Usage: cvs checkout [-ANPRcflnps? [-r rev? [-d dir? [-j rev1? [-j rev2? [-k kopt? modules...
(Specify the --help global option for a list of other help options)
cvs update Execute this command from within your private source directory when you wish to update your copies of source files from changes that other developers have made to the source in the repository.
bash$ cvs --help update Usage: cvs update [-APdflRp? [-k kopt? [-r rev? [-j rev? [-I ign? [-W spec? [files...?
(Specify the --help global option for a list of other help options) In order to receive changes from the latest commits from your peer developers, do: bash$ cvs update If another developer has done bigger changes such as adding new directories etc. do: bash$ cvs update -d
cvs add file... Use this command to enroll new files in CVS records of your working directory. The files will be added to the repository the next time you run `cvs commit'. Note: You should use the `cvs import' command to bootstrap new sources into the source repository. `cvs add' is only used for new files to an already checked-out module.
bash$ cvs --help add Usage: cvs add [-k rcs-kflag? [-m message? files...
(Specify the --help global option for a list of other help options) To add a new file to the repository do: bash$ cvs add newFile bash$ cvs commit To add a new binary file to the repository do: bash$ cvs add -kb newBinaryFile bash$ cvs commit (-kb specifies that file is binary) To add a new directory to the repository do: bash$ cvs add newDirectory bash$ cvs commit To remove an existing file from the repository do: bash$ rm existingFile bash$ cvs remove existingFile bash$ cvs commit
cvs remove file... Use this command (after erasing any files listed) to declare that you wish to eliminate files from the repository. The removal does not affect others until you run `cvs commit'.
bash$ cvs --help remove Usage: cvs remove [-flR? [files...?
(Specify the --help global option for a list of other help options)
cvs commit file... To check in modifications (on existing files). Use this command when you wish to ``publish'' your changes to other developers, by incorporating them in the source repository.
NOTE : It's usually a very good idea to do 'cvs update' before commiting changes.
bash$ cvs --help commit Usage: cvs commit [-nRlf? [-m msg? [-r rev? files...
(Specify the --help global option for a list of other help options)
cvs diff file... Show differences between files in the working directory and source repository, or between two revisions in the source repository. (Does not change either repository or working directory.)
bash$ cvs --help diff Usage: cvs diff [-lNR? [rcsdiff-options? [[[-r rev1? [-r rev2?] [files...?
--ifdef=arg Output diffs in ifdef format. (consult the documentation for your diff program for rcsdiff-options. The most popular is -c for context diffs but there are many more). (Specify the --help global option for a list of other help options)
Since there usually are several files with different version numbers in a project, it's a good idea to "stamp" the files with a release tag for each release, this can be done like this (for version "v001"):
bash$ cvs tag -R "v001" bash$ cvs commit This release can be checked out with bash$ cvs checkout -r "v001" !YourProject?
Emacs is a powerful editor and it supports CVS/RCS - especially
for revision merging and comparing. The main Emacs site
is at
http://www.gnu.org/software/emacs/emacs.html.
CVS is a powerful system and is highly customizable. CVS supports:
Shell Scripts
.
Also read the
Reserved checkouts.
Here is a patch (
http://www.cvshome.org/dev/patches/editf) from
Eric Griswold for reserved checkouts.
*
Also see "cvs edit" to give a warning(
http://www.cvshome.org/dev/text2/res2) if
someone else is already editing the file.
*
*
The following are wrappers around the basic CVS commands. These scripts give you initial booster-push into the CVS system and are useful until you become very familiar with the CVS commands. The scripts are written for Korn shell since it is always available on all flavors of Unix, but you can translate to bash or Perl if needed. You can customize these scripts to your taste. They are basically CVS commands, but features are added to make it site specific. For example, the sedit script provides locking so that users will know someone is editing the file. Of course users can directly use the CVS commands to bypass these scripts. These scripts demonstrate how CVS can be customized to a great extent.
NOTE: The wrapper shell scripts assume the user's home directory as the root and check out the tree from CVS to build the tree underneath user's home directory.
TIP: In these shell scripts, every target filename is composed of 3 parts - Home directory, sub-directory and the filename. The full-path is $HOME/$subdir/$fname And in CVS the same directory structure is maintained (by variable $subdir) therefore in cvs there will be something like $CVSROOT/$subdir/$fname. In all scripts, these 4 variables $HOME, $CVSROOT, $subdir and $fname play an important role. For example, sample values can be like HOME=/home/aldev, subdir=myproject/src, CVSROOT=/home/cvsroot, and fname=foo.cpp
Copy these scripts to /usr/local/bin and this should be in the user's PATH environment.
To get a file or entire directory from CVS in READ ONLY mode. Click sget
#
To edit a file in order to make changes to code. This will lock the file so that nobody else can check it out. Of course you can change the script to your requirement - make no locking, warning message, or very strong locking. Click sedit
#
To commit the changes you made to filename or entire directory. Upload your changes to CVS. Click scommit
#
To update a filename or to update an entire directory by getting the latest files from CVS. Click supdate
#
To unlock the file got by sedit. Will release the lock. Click sunlock
#
To see the list of files currently being edited by you. Does 'ls -l | grep | ...' command. Click slist . Note that there is also another Unix command by the name slist (list available Netware servers). You should make sure cvs script slist comes before other in your PATH environment.
#
To get the information of changes/revisions to a file. Click sinfo
#
To get the history of changes/revisions to a file from CVS. Click slog
#
sdif -r rev1 -r rev2 <filename> To get the diff of your file with CVS. Click sdif
NOTE: sdif has only one 'f' because there is already another Unix command called 'sdiff'
#
To add a new file to CVS repository. Click sadd
#
To delete a file from CVS repository. Click sdelete
#
To freeze the code, that is make a release of the entire source tree. Click sfreeze
For example :
cd $HOME; sfreeze REVISION_1_0 srctree
This will freeze code with tag REVISION_1_0 so that you can later checkout the entire tree by using the revision name.
#
******************************************************
At Unix prompt type:
#
#
#
#
#
#
#
http://www.loria.fr/molli/cvs-index.html
#
The tkcvs
http://www.tkcvs.org
is the Tcl/Tk GUI interface to CVS. It also has online help. Try the following:
*
*
*
*
button on the text '1.3' and click the LEFT Mouse button on text '1.1'. Then click on "Diff" button. This will display a two-pane window!! *
Click on "Center" to center the text. *
There is also a Windows 95 client for CVS called WinCVS (see:
http://www.wincvs.org
and
cyclicsite).
WinCVS can be used along with Samba(on cdrom samba*.rpm) -
http://www.samba.org
The essential command are:
*
*
*
*
*
*
*
This gives a diff between version 1.4 and 1.5 on filename. *
On Linux systems, you can find the CVS documentation in postscript format at /usr/doc/cvs*/*.ps. Also there is an FAQ and other useful information.
bash# cd /usr/doc/cvs* bash# gv cvs.ps
The documentation on CVS from "CVS Organisation" is at
http://www.cvshome.org/docs
The Official manual for CVS by Cederqvist
is at
http://www.cvshome.org/docs/manual/cvs.html
FAQ for CVS is at
http://www.cs.utah.edu/dept/old/texinfo/cvs/FAQ.txt
*
http://rpmfind.net/tools/CVS/training/cvstrain.html
*
*
http://www.loria.fr/molli/cvs/cvs-tut/cvs_tutorial_toc.html
*
*
http://atlas.web.cern.ch/Atlas/GROUPS/SOFTWARE/OO/tools/srt/
*
*
http://durak.org/cvswebsites/
*
*
http://www-users.informatik.rwth-aachen.de/wge/tools/cvs/cvsclient/cvsclient_toc.html
*
*
http://www-users.informatik.rwth-aachen.de/wge/tools/cvs.html
General utilities for cvs (third party):
*
http://cvsbook.red-bean.com has
third-party-tools
and mirror sites at
Zevils
*
*
http://rcs.ee.washington.edu/spp/Projects/Manastash/Links/cvsbook_toc.html
*
The following GUI front ends for CVS are available:
http://cervisia.sourceforge.net, get
RPM packages at
Cervisia RPMs
*
http://www.cvshome.org/dev/addons.html
*
http://www.devguy.com/fp/cfgmgmt/cvs/cvs_admin_nt.htm#CVSWEBIIS and at
http://stud.fh-heilbronn.de/zeller/cgi/cvsweb.cgi
*
http://www.tkcvs.org is the Tcl/Tk GUI interface to CVS
and at
cyclicsite
*
http://www.arachne.org/software/gcvs
*
http://www.jcvs.org
And at
cyclicsite
*
http://www.cvshome.org/cyclic/cvs/soft-maccvs.html
and at
cyclicsite
*
http://www.componentsoftware.com/cvs
*
http://www.mis3.udel.edu/jlaker/development
*
*
http://ppprs1.phy.tu-dresden.de/trogisch/lincvs/lincvsen.html
*
*
http://www.loria.fr/molli/cvs/doc/cvs_toc.html
*
It is very strongly recommended that you use Samba(on cdrom samba*.rpm) and a PC X Server on MS Windows 95/NT. By using Samba the remote directory on Unix will look like local folder on MS Windows. See the next section for PC X Server.
For Apple Macintosh - Mac OS:
See !MacCvs? at
http://www.cvsgui.org
and !MacCvsPro? at
http://www.maccvs.org
It is VERY STRONGLY recommended that you use Samba(on cdrom samba*.rpm) and a VNC viewer (or PC X Server) on MS Windows 95/NT. With samba the Unix/Linux CVS server will be like a file server. By using Samba the remote directory on Unix will look like a local folder on MS Windows on the local disk. Install samba*.rpm on Unix/Linux server(which has the CVS repository) and install the VNC viewer (or PC X server) on MS Windows 95/NT/2000/XP desktop. Using a VNC (or PC X server) you can easily log on to the Unix box and check-out/check-in the files. And you can use tools like Java Visual Cafe or Java JBuilder on MS Windows to edit the files located in Unix/Linux folder(via samba). After editing, you can check-in the files to Unix through VNC or PC X-server.
Advantages of using CVS on Linux/Unix via MS Windows are:
*
*
*
*
BRS, Arkeia, Bru
mirrors at
http://aldev0.webjump.com,
angelfire,
geocities,
virtualave,
50megs,
theglobe,
NBCi,
Terrashare,
Fortunecity,
Freewebsites,
Tripod,
Spree,
Escalix,
Httpcity,
Freeservers.
*
and dust free. Small room keeps the cooling/heating costs down. *
*
The best tool for remote access is VNC. The VNC is lightweight and is much better than the PC X servers. The VNC is very strongly recommended over PC X server. The remote access methods available are:
http://www.uk.research.att.com/vnc
VNC is not an X-server but can display the remote Unix on Windows.
VNC is the best tool in the market for remote access, it is very lightweight and
is a very powerful software.
*
rpmfind.
*
it from
http://www.qvwm.org.
*
like MS Windows, Mac or Linux.
*
List of X11 Windows Managers. *
Compiling qvwm on Solaris :
On Solaris you should install the following packages which you can get
from
http://sun.freeware.com - xpm, imlib, jpeg, libungif, giflib, libpng, tiff.
And you can download the binary package for solaris from
http://www.qvwm.org.
Or you can download the qvwm source for solaris from
http://www.qvwm.org and compile it using gcc.
Troubleshooting compile: You should put unsigned long before arg in usleep() usleep((unsigned long) 10000)
The following PC X servers are available:
http://www.microimages.com and
click on "X-Server (MI/X) for Windows"
*
There are more than 2 dozen vendors for X servers for Windows:
*
University resources:
*
http://www.et.byu.edu/support/pc/xterm.html
*
http://mirriwinni.cse.rmit.edu.au/brad/co338/sem1/floppy.html
*
You can install the Redhat Cygwin and install the CVS clients and SSH packages via Cygwin. With cygwin the Windows 95/NT/2000/XP will be like a Unix client. Bring up the cygwin bash shell prompt and you can access the remote CVS server. With cygwin the Windows 95/NT will be like any other Linux CVS client.
You can install and run CVS on MS Windows directly.
Download cvsnt from
http://www.cvsnt.org.
See the installation instructions and other documents of CVS on NT/2000
at
http://www.devguy.com/fp/cfgmgmt/cvs/cvs_admin_nt.htm#install.
You can also use the ftp tools on MS Windows to transfer files from a Unix/Linux (CVS repository) to windows:
Using Samba and a PC X server it is possible to use CVS on MS Windows platform. And the tools like Symantec Visual Cafe (Java), Inprise JBuilder, MS Visual C++ and others are easily supported by CVS.
You can also store the HTML files on a CVS repository via Samba and easily access them from MS Windows.
To administer samba use the admin tools from
http://www.samba.org. Go here
and click on "GUI Interfaces Tools".
To make a CVS server and CVS repository secure do the following:
see Performance Tuning. *
external vandals running it. Just in case vandals break into the system, you do not want to give them a chance to run dangerous programs. *
Multi-User Repository *
http://cvshome.org/dev/codelinux.html.
*
http://www.cvshome.org and post your security questions in the
mailing list.
*
The Cederqvist manual at
http://cvshome.org/docs/manual/cvs_2.html#SEC30
describes how to setup CVS for external access.
In order to use CVS for a group, one has to set up a permissions system to allow people to access the system from other machines. There are three ways to do this (:server:, :pserver:, and :ext:). The pserver mechanism and use of rsh are both insecure. Only the :ext: (with ssh) offers sufficient security protection.
If you set CVS_RSH to SSH or some other rsh replacement, the instructions may be similar to `.rhosts' but consult the documentation for your rsh replacement.
To get ssh visit
http://rpmfind.net and in the search box enter "ssh".
Or visit
http://www.redhat.com/apps/download and in the search box enter "ssh".
Download and install the ssh RPM and then configure CVS to use it.
See also
http://www.ssh.org.
Note: If you plan to configure CVS for use with rsh then you MUST do this critical step:
bash# chmod 600 .rhosts
See also JA-SIG UPortal CVS repository
http://www.mis3.udel.edu/jlaker/development.
If you're tired of entering passwords for each simple CVS command, then you can distribute your ssh-identity from the client to the server in order to allow automatic identification (i.e. no password needed!), this can be done by On the CVS server box do:
For ssh 1: bash$ cd $HOME bash$ ssh-keygen For ssh 2: bash$ cd $HOME bash$ ssh-keygen -t rsa
You should be asked to save 'your identification' in /home/developer/.ssh/identity (ssh 1) or /home/developer/.ssh/id_rsa.pub (ssh 2) (or wherever $HOME points to), just hit enter. When asked for password and confirmation of password, continue hitting enter. Then copy your public key (identity.pub for ssh 1 or id_rsa.pub for ssh 2) to the server using secure copy (a part of ssh):
ssh 1: clientbox$ scp .ssh/identity.pub developer@serverbox.domain.com:/.ssh ssh 2: clientbox$ scp .ssh/id_rsa.pub developer@serverbox.domain.com:/.ssh
Then log onto the server and fix the authorized_keys file.
ssh 1: clientbox$ ssh developer@serverbox.domain.com serverbox$ cd .ssh serverbox$ cat identity.pub >> authorized_keys ssh 2: clientbox$ ssh developer@serverbox.domain.com serverbox$ cd .ssh serverbox$ cat id_rsa.pub >> authorized_keys2 serverbox$ chmod go-w authorized_keys2
You should now be able to ssh directly from the client to server without having to enter password, this can be tested with:
ssh 1 or ssh 2: clientbox$ ssh developer@serverbox.domain.com
Version control from this point should not require you to enter the password.
Note: This enables anyone getting access to your client to continue into the server without knowing the password on the server.
Encrypted Disks
If you fear such a situation, this can (somewhat) be prevented by using a encrypted disk, e.g. PGPDisk holding the $HOME directory on the client. So when an intruder takes over your machine s/he needs to know the password for your encrypted disk in order to get further into the server. Another advantage of using a encrypted disk is that your (checked out) source code can reside on it.
If you want to use RCS instead of CVS then you can use the following shell scripts.
#
See also cofiles.sh
user will run this script under his home directory.
check_out_directory() {
RCSDIR=$1 DIRNAME=$2
if [ "$DIRNAME" = "" -o ! -d $RCSDIR/$DIRNAME?; then print "\nDirectory DIRNAME=$DIRNAME does not exist!!" print "\nAborting the program ... and exiting...\n" exit fi mkdir -p $DIRNAME ln -s $RCSDIR/$DIRNAME/RCS $DIRNAME ( cd $DIRNAME
if [ -d RCS?; then ls RCS/* | cut -d'/' -f2 | sed -e's/,v$//g' | \ while read ii do
if [ -f "RCS/$ii,v"?; then co $ii fi done fi ) }
if [ "$RCSDIR" = "" -o ! -d $RCSDIR?; then print "\nDirectory RCSDIR=$RCSDIR does not exist!!" print "\nAborting the program ... and exiting...\n" exit fi
if [ "$1" != ""?; then (cd $RCSDIR; find $1 -type d -print ) | while read DIRNAME do
tmpaa=` basename $DIRNAME ` if [ "$tmpaa" != "RCS"?; then check_out_directory $RCSDIR $DIRNAME fi done else (cd $RCSDIR; find * -type d -print ) | while read DIRNAME do echo DIRNAME=$DIRNAME
tmpaa=` basename $DIRNAME ` if [ "$tmpaa" != "RCS"?; then check_out_directory $RCSDIR $DIRNAME fi done fi
if [ ! -d RCS?; then print "\nDirectory RCS does not exist!!" print "\nAborting the program ... and exiting...\n" exit fi
while true do print -n "\n\nCheck-out all files in read-write mode? <y/n> [n?: " read ans if [ "$ans" = "" -o "$ans" = "n" -o "$ans" = "N"?; then ans="N" break elif [ "$ans" = "y" -o "$ans" = "Y"?; then ans="Y" break else print "\nWrong entry! Try again!!" fi done
if [ $# -eq 0?; then
if [ "$ans" = "Y"?; then ls RCS | sed -e's/,v$//g' | xargs co -l else ls RCS | sed -e's/,v$//g' | xargs co fi elif [ $# -eq 1?; then if [ -f "RCS/$1,v"?; then
if [ "$ans" = "Y"?; then co -l "$1" else co "$1" fi else
tmpaa="RCS/$1,v" # will be like RCS/db*.sql,v ls $tmpaa | \ while read ii do
if [ "$ans" = "Y"?; then co -l "$ii" else co "$ii" fi done fi else for ii in $@ do
if [ "$ans" = "Y"?; then co -l "$ii" else co "$ii" fi done fi
if [ ! -d RCS?; then print "\nDirectory RCS does not exist!!" print "\nWill be creating RCS directory now ...\n" mkdir RCS fi print "\n\nNOTE: This is not log message!" print "Please enter description (will be used for" print -n "all the files checked in) : " read description
if [ $# -eq 0?; then listoffiles="*" else listoffiles="$@" fi
find $listoffiles -maxdepth 0 -type f | while read ii do
ci -m"$description" $ii else
ci $ii << EOF $description EOF fi done
For optimum performance a CVS server must be running on a stand alone Linux/Unix box.
To get more bang for a given CPU processing power, do the following:
which are not used. See the kernel
howto at
http://www.linuxdoc.org/HOWTO/Kernel-HOWTO.html
*
bash$ su - root bash# man chkconfig bash# chkconfig --help bash# chkconfig --list | grep on | less From the above list, turn off the processes you do not want to start automatically - bash# chkconfig --level 0123456 <service name> off Next time when the machine is booted these services will not be started. Now, shutdown the services manually which you just turned off. bash# cd /etc/rc.d/init.d bash# ./<service name> stop
*
*
consume memory and contribute to CPU load. It can also be a serious security hole from outside attacks. The X Window managers generally used are KDE, GNOME, CDE, XDM and others. You must exit the X Window immediately after using and most of the time you should see a command line console login prompt on the CVS server machine. *
Along with CVS, you may want to use project tracking system or problem
reporting system. Every software project needs a problem reporting system
that track bugs and assigns them to various developers.
See GNU gpl GNATS at
http://www.gnu.org/software/gnats/gnats.html
and
http://dcl.sourceforge.net
And commercial PRS at
http://www.stonekeep.com
look for a project tracking system.
What is Configuration Management (CM) ?
There are a number of different interpretations. It is about the tracking and control of software development and its activities. That is, it concerns the mangement of software development projects with respect to issues such as multiple developers working on the same code at the same time, targeting multiple platforms, supporting multiple versions, and controlling the status of code (for example a beta test versus a real release). Even within that scope there are different schools of thought:
of sources (and sometimes binaries) and the ability to perform builds (or compiles) of the entities. Other functions may be included as well.
*
activities. For example, it might check to ensure that a change request existed and had been approved for fixing and that the associated design, documentation, and review activities have been completed before allowing the code to be "checked in" again. *
While process management and control are necessary for a repeatable, optimized development process, a solid configuration management foundation for that process is essential.
Visit the following links:
http://www.iac.honeywell.com/Pub/Tech/CM/CMFAQ.html
*
http://linas.org/linux/cmvc.html
*
http://www.cmtoday.com/yp/commercial.html
*
http://www.iac.honeywell.com/Pub/Tech/CM/CMTools.html
*
http://devguy.com/fp/cfgmgmt/cvs
*
* Yahoo category site *
http://www.canb.auug.org.au/millerp/aegis/aegis.html
*
http://www.loria.fr/cgi-bin/molli/cm/wilma/fcmt
*
http://www.rational.com/products/clearcase/prodinfo.jsp
*
Related URLs are at:
http://www.milkywaygalaxy.freeservers.com
and mirrors at
http://aldev0.webjump.com,
angelfire,
geocities,
virtualave,
50megs,
theglobe,
NBCi,
Terrashare,
Fortunecity,
Freewebsites,
Tripod,
Spree,
Escalix,
Httpcity,
Freeservers.
*
http://www.loria.fr/molli/cvs-index.html
*
http://cssc.sourceforge.net and
mirror-site
*
http://www.bitmover.com/bitkeeper
*
SCCS (Source Code Control System) is no longer being enhanced or improved. The general consensus has been that this tool is clumsy and not suited to large numbers of users working on one project. Actually, SCCS interleaves all the versions, but it can make new development get progressively slower. Hence, SCCS is NOT recommended for new projects; however, it is still there to support old code base in SCCS.
RCS (Revision Control System) is often considered to be
better than SCCS. One reason for this is that RCS baselines the most
recent version and keeps deltas for earlier ones, making new
development faster. Additional discussions concerning SCCS vs RCS
are at
http://www.faqs.org/faqs/unix-faq/faq/part7
Note that RCS learned from the mistakes of SCCS...
CVS, which requires RCS, extends RCS to control concurrent editing of sources by several users working on releases built from a hierarchical set of directories. "RCS is [analogous to using? assembly language, while CVS is [like using? Pascal".
This document is published in 14 different formats namely: DVI, Postscript, Latex, Adobe Acrobat PDF, LyX, GNU-info, HTML, RTF(Rich Text Format), Plain-text, Unix man pages, single HTML file, SGML (Linuxdoc format), SGML (Docbook format), and MS !WinHelp? format.
This howto document is located at:
*
http://www.linuxdoc.org and click on HOWTOs and search
for the howto document name using CTRL+f or ALT+f within the web-browser.
*
You can also find this document at the following mirrors sites:
*
http://www.caldera.com/LDP/HOWTO
*
*
http://www.linux.ucla.edu/LDP
*
*
http://www.cc.gatech.edu/linux/LDP
*
*
http://www.redhat.com/mirrors/LDP
*
http://www.linuxdoc.org/mirrors.html
select a site and go to directory /LDP/HOWTO/xxxxx-HOWTO.html
*
Postscript or SGML formats from -
ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO/other-formats/
and
http://www.linuxdoc.org/docs.html#howto
*
ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO
and
http://www.linuxdoc.org/docs.html#howto
*
http://www.linuxdoc.org/docs.html#howto
A single HTML file can be created with the command (see man sgml2html) -
sgml2html -split 0 xxxxhowto.sgml
*
Chinese, and Japanese are in
ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO
and
http://www.linuxdoc.org/docs.html#howto
Any help from you to translate to other languages is welcome.
*
The document is written using a tool called "SGML-Tools" which can be got from:
http://www.sgmltools.org
Compiling the source you will get the following commands like:
*
*
*
*
A PDF file can be generated from postscript file using
either acrobat distill or Ghostscript.
And a postscript file is generated
from DVI which in turn is generated from a !LaTex? file.
You can download distill software from
http://www.adobe.com. Given below
is a sample session:
bash$ man sgml2latex bash$ sgml2latex filename.sgml bash$ man dvips bash$ dvips -o filename.ps filename.dvi bash$ distill filename.ps bash$ man ghostscript bash$ man ps2pdf bash$ ps2pdf input.ps output.pdf bash$ acroread output.pdf &
Or you can use the Ghostscript command ps2pdf. ps2pdf is a work-alike for nearly all the functionality of Adobe's Acrobat Distiller product: it converts !PostScript files to Portable Document Format (PDF) files. ps2pdf is implemented as a very small command script (batch file) that invokes Ghostscript, selecting a special "output device" called pdfwrite. In order to use ps2pdf, the pdfwrite device must be included in the makefile when Ghostscript was compiled; see the documentation on building Ghostscript for details.
This document is written in linuxdoc SGML format. The Docbook SGML format supercedes the linuxdoc format and has a lot more features than linuxdoc. The linuxdoc is very simple and easy to use. To convert linuxdoc SGML file to Docbook SGML use the program ld2db.sh and some Perl scripts. The ld2db output is not 100% clean and you need to use the clean_ld2db.pl Perl script. You may need to manually correct a few lines in the document.
http://www.dcs.gla.ac.uk/rrt/docbook.html
or from
Milkyway Galaxy site
click on "Source code for C++ howto".
*
from Milkyway Galaxy site click on "Source code for C++ howto". *
The ld2db.sh is not 100% clean, so you will get some errors when you run it.
bash$ ld2db.sh file-linuxdoc.sgml db.sgml bash$ cleanup.pl db.sgml > db_clean.sgml bash$ gvim db_clean.sgml bash$ docbook2html db.sgml
And you may have to manually edit some of the minor errors after running the Perl script. For example you may need to put closing tag < /Para> for each < Listitem>
You can convert the SGML howto document to a Microsoft Windows Help file, First convert the sgml to html using:
bash$ sgml2html xxxxhowto.sgml (to generate html file) bash$ sgml2html -split 0 xxxxhowto.sgml (to generate a single page html file)
Then use the tool
You can also use sgml2rtf and then use the RTF files for generating winhelp files.
In order to view the document in dvi format, use the xdvi program. The xdvi program is located in tetex-xdvi*.rpm package in Redhat Linux which can be located through !ControlPanel | Applications | Publishing | TeX menu buttons. To read a dvi document give the command:
xdvi -geometry 80x90 howto.dvi man xdvi
And resize the window with the mouse. To navigate use Arrow keys, Page Up, Page Down keys, also you can use 'f', 'd', 'u', 'c', 'l', 'r', 'p', 'n' letter keys to move up, down, center, next page, previous page etc. To turn off expert menu press 'x'.
You can read a postscript file using the program 'gv' (ghostview) or 'ghostscript'. The ghostscript program is in the ghostscript*.rpm package and the gv program is in the gv*.rpm package in Redhat Linux which can be located through !ControlPanel | Applications | Graphics menu buttons. The gv program is much more user friendly than ghostscript. Also ghostscript and gv are available on other platforms like OS/2, Windows 95 and NT. You can view this document even on those platforms.
all OSes from
http://www.cs.wisc.edu/ghost
*
To read a postscript document give the command:
gv howto.ps ghostscript howto.ps
You can read an HTML format document using Netscape Navigator, Microsoft Internet explorer, Redhat Baron Web browser or any of the 10 other web browsers.
You can read the latex, LyX output using LyX an X Window front end to !LaTex?.
Copyright Al Dev (Alavoor Vasudevan) 1998-2000.
License is GNU GPL, but it is requested that you retain the author's name and email on all copies.
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` Usage() { print "\nUsage: $cmdname [-r revision_number/symbolic_tag_name? <file/directory name> " print "The options -r are optional " print "For example - " print " $cmdname -r 1.1 foo.cpp" print " $cmdname foo.cpp " print " $cmdname some_directory " print "Extract by symbolic revision tag like - " print " $cmdname -r REVISION_1 some_directory " print " " exit }
while getopts r: ii do case $ii in r) FLAG1=$ii; OARG1="$OPTARG";; ?) Usage; exit 2;; esac done shift ` expr $OPTIND - 1 `
if [ $# -lt 1?; then Usage fi bkextn=sget_bak homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi cur_dir=`pwd`
len=${#homedir} len=$(($len + 2))
subdir=` echo $cur_dir | cut -b $len-2000 `
tmpaa=`dirname $1` if [ "$tmpaa" = "."?; then fname=$1 if [ "$subdir" = ""?; then subdir=$tmpaa fi else fname=`basename $1` if [ "$subdir" = ""?; then subdir=$tmpaa else subdir="$subdir/$tmpaa" fi fi
if [ -f "$HOME/$subdir/$fname"?; then tmpaa="$HOME/$subdir/$fname" user_perms=" " group_perms=" " other_perms=" " user_perms=`ls -l $tmpaa | awk '{print $tmpaa }' | cut -b3-3 ` group_perms=`ls -l $tmpaa | awk '{print $tmpaa }' | cut -b6-6 ` other_perms=`ls -l $tmpaa | awk '{print $tmpaa }' | cut -b9-9 ` if [[ "$user_perms" = "w" -o "$group_perms" = "w" \
print "\nError: The file is writable. Aborting $cmdname ......" print " You should either backup, scommit or delete the file and" print " try $cmdname again\n" exit fi fi
mkdir -p "$HOME/$subdir" touch "$HOME/$subdir/$fname" 2>/dev/null \mv -f "$HOME/$subdir/$fname" "$HOME/$subdir/$fname.$bkextn"
( cd $homedir
if [ "$FLAG1" = ""?; then if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A $fname else cvs -r checkout -A "$subdir/$fname" fi else if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A -$FLAG1 $OARG1 $fname else cvs -r checkout -A -$FLAG1 $OARG1 "$subdir/$fname" fi fi )
if [ -f "$HOME/$subdir/$fname"?; then print "\nREAD-ONLY copy of the file $subdir/$fname obtained." print "Done $cmdname"
fi
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` Usage() {
print "\nUsage: $cmdname [-r revision_number? <filename>" print "The options -r are optional " print "For example - " print " $cmdname -r 1.1 foo.cpp" print " $cmdname foo.cpp "
print " " }
while getopts r: ii do case $ii in r) FLAG1=$ii; OARG1="$OPTARG";;
?) Usage; exit 2;; esac done shift ` expr $OPTIND - 1 `
if [ $# -lt 1?; then Usage exit fi homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi bkextn=sedit_bak cur_dir=`pwd`
len=${#homedir} len=$(($len + 2))
subdir=` echo $cur_dir | cut -b $len-2000 ` tmpaa=`dirname $1` if [ "$tmpaa" = "."?; then fname=$1 if [ "$subdir" = ""?; then subdir=$tmpaa fi else fname=`basename $1` if [ "$subdir" = ""?; then subdir=$tmpaa else subdir="$subdir/$tmpaa" fi fi
cvs_root=` echo $CVSROOT | cut -f1 -d' ' ` if [ "$cvs_root" = ""?; then print "\nError: \$CVSROOT is not set!!\n" exit fi mkdir -p "$CVSROOT/$subdir/Locks" 2>/dev/null if [ ! -e "$CVSROOT/$subdir/$fname,v"?; then print "\nError: File $fname does not exist in CVS repository!!\n" exit fi
if [ ! -d "$homedir/$subdir/CVS"?; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -maxdepth 0 -type f -print | head -1 ) ` tmpbb=`basename $tmpaa | cut -d',' -f1 ` if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v"?; then print "\nThe directory $homedir/$subdir/CVS does not exist" print "You must do a sget on `basename $subdir` directory. Give -" print " cd $homedir/`dirname $subdir` " print " sget `basename $subdir` " exit else
( cd "$homedir" if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A $tmpbb else cvs -r checkout -A "$subdir/$tmpbb" fi ) fi fi
tmpfile=$homedir/sedit-lock.tmp \rm -f $tmpfile 2>/dev/null if [ "$FLAG1" = ""?; then ( cd $homedir if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs log $fname | head -6 | grep head: | awk '{print $2}' > $tmpfile else cvs log "$subdir/$fname" | head -6 | grep head: | awk '{print $2}' > $tmpfile fi ) OARG1=`cat $tmpfile` \rm -f $tmpfile 2>/dev/null fi lockfile="$CVSROOT/$subdir/Locks/$fname-$OARG1"
if [ -e $lockfile?; then print "\nError: File $fname Revision $OARG1 already locked by another developer !!" aa=` ls -l $lockfile | awk '{print "Locking developers unix login name is = " $3}' ` print $aa print "That developer should do scommit OR sunlock to release the lock" print " "
exit fi
if [ ! -e "$HOME/$subdir/$fname"?; then ( cd $homedir if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout $fname 1>/dev/null else cvs -r checkout "$subdir/$fname" 1>/dev/null fi ) fi
tmpaa="$HOME/$subdir/$fname" if [ -f $tmpaa?; then user_perms=" " group_perms=" " other_perms=" " user_perms=`ls -l $tmpaa | awk '{print $tmpaa }' | cut -b3-3 ` group_perms=`ls -l $tmpaa | awk '{print $tmpaa }' | cut -b6-6 ` other_perms=`ls -l $tmpaa | awk '{print $tmpaa }' | cut -b9-9 ` if [[ "$user_perms" = "w" -o "$group_perms" = "w" \
print "\nError: The file is writable. Aborting $cmdname ......" print " You must backup, scommit or delete file and" print " try $cmdname again\n" exit fi
\mv -f $tmpaa $tmpaa.$bkextn chmod 444 $tmpaa.$bkextn elif [ -d $tmpaa?; then print "\nError: $tmpaa is a directory and NOT a file. Aborting $cmdname ....\n" exit fi
print "\nNow getting the file $fname from CVS repository ...\n" ( cd $homedir
if [ "$FLAG1" = ""?; then if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -w checkout -A $fname else cvs -w checkout -A "$subdir/$fname" fi else if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -w checkout -A -$FLAG1 $OARG1 $fname else cvs -w checkout -A -$FLAG1 $OARG1 "$subdir/$fname" fi fi ) if [ -e "$HOME/$subdir/$fname"?; then
touch $lockfile if [ -e $lockfile?; then print "\nDone $cmdname" else print "\nFatal Error: File $fname Revision $OARG1 not locked !!" print "\nCheck the reason for this failure.. before proceeding..." fi fi
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` Usage() { print "\nUsage: $cmdname [-r revision_number? <filename>" print "The options -r are optional " print "For example - " print " $cmdname -r 1.1 foo.cpp" print " $cmdname foo.cpp " print " " }
while getopts r: ii do case $ii in r) FLAG1=$ii; OARG1="$OPTARG";; ?) Usage; exit 2;; esac done shift ` expr $OPTIND - 1 `
if [ $# -lt 1?; then Usage exit 2 fi if [ -d $1?; then Usage exit 2 fi homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi
cur_dir=`pwd`
len=${#homedir} len=$(($len + 2))
subdir=` echo $cur_dir | cut -b $len-2000 ` tmpaa=`dirname $1` if [ "$tmpaa" = "."?; then fname=$1 if [ "$subdir" = ""?; then subdir=$tmpaa fi else fname=`basename $1` if [ "$subdir" = ""?; then subdir=$tmpaa else subdir="$subdir/$tmpaa" fi fi
cvs_root=` echo $CVSROOT | cut -f1 -d' ' ` if [ "$cvs_root" = ""?; then print "\nError: \$CVSROOT is not set!!\n" exit fi mkdir -p "$CVSROOT/$subdir/Locks" 2>/dev/null
if [ ! -d "$homedir/$subdir/CVS"?; then tmpaa=` (cd "$CVSROOT/$subdir"; find * -prune -type f -print | head -1 ) ` tmpbb=`basename $tmpaa | cut -d',' -f1 ` if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v"?; then print "\nThe directory $homedir/$subdir/CVS does not exist" print "You must do a sget on `basename $subdir` directory. Give -" print " cd $homedir/`dirname $subdir` " print " sget `basename $subdir` " exit else
( cd "$homedir" if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A $tmpbb else cvs -r checkout -A "$subdir/$tmpbb" fi ) fi fi
tmpfile=$homedir/sedit-lock.tmp \rm -f $tmpfile 2>/dev/null if [ "$FLAG1" = ""?; then ( cd $homedir if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs status $fname 2>/dev/null | grep "Working revision:" | awk '{print $3}' >$tmpfile else cvs status "$subdir/$fname" 2>/dev/null | grep "Working revision:" | awk '{print $3}' >$tmpfile fi ) OARG1=`cat $tmpfile` \rm -f $tmpfile 2>/dev/null fi if [ "$OARG1" = "" -o "$OARG1" = "New" -o "$OARG1" = "NEW"?; then print "The file $subdir/$fname is NEW, it is not in the CVS repository" print "The OARG1 is $OARG1" else lockfile="$CVSROOT/$subdir/Locks/$fname-$OARG1" if [ -e $lockfile?; then
aa=` ls -l $lockfile | awk '{print $3}' ` userid=`id | cut -d'(' -f2 | cut -d')' -f1 ` if [ "$aa" != "$userid"?; then print " " print "The file $subdir/$fname is NOT locked by you!!" print "It is locked by unix user name $aa and your login name is $userid"
print "You need to wait untill other developer does scommit" print "or sunlock" print "Aborting the $cmdname ...." print " " exit 2 fi else
if [ -f "$CVSROOT/$subdir/$fname,v"?; then print "You did not lock the file $subdir/$fname with sedit!!" print "Aborting the $cmdname ...." exit 2 else print "\nThe file $subdir/$fname does not exist in CVS repository yet!!" print "You should have done sadd on $subdir/$fname ...." exit 2 fi fi fi
( cd $homedir
if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs commit $fname else cvs commit "$subdir/$fname" fi exit_status=$? if [ $exit_status -eq 0?; then lockfile="$CVSROOT/$subdir/Locks/$fname-$OARG1" if [ -e $lockfile?; then \rm -f $lockfile fi
chmod a-w "$HOME/$subdir/$fname" print "\nDone $cmdname. $cmdname successful"
fi )
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` if [ $# -lt 1?; then print "\nUsage: $cmdname <filename>" exit fi
tmpaa="$1"
if [ $# -gt 0 -a -f $tmpaa?; then user_perms=" " group_perms=" " other_perms=" " user_perms=`ls -l $tmpaa | awk '{print $tmpaa }' | cut -b3-3 ` group_perms=`ls -l $tmpaa | awk '{print $tmpaa }' | cut -b6-6 ` other_perms=`ls -l $tmpaa | awk '{print $tmpaa }' | cut -b9-9 ` if [[ "$user_perms" = "w" -o "$group_perms" = "w" \
while : do print "\n$cmdname will backup your working file " print "$tmpaa to $tmpaa.supdate_bak before doing any merges." print "Are you sure you want the merge the changes from" print -n "CVS repository to your working file ? <y/n> [n?: " read ans if [ "$ans" = "y" -o "$ans" = "Y"?; then if [ -f $tmpaa.supdate_bak?; then print "\nWarning : File $tmpaa.supdate_bak already exists!!" print "Please examine the file $tmpaa.supdate_bak and delete it" print "and then re-try this $cmdname " print "Aborting $cmdname ...." exit else cp $tmpaa $tmpaa.supdate_bak break fi elif [ "$ans" = "n" -o "$ans" = "N" -o "$ans" = "" -o "$ans" = " "?; then exit fi done fi fi if [ -d $tmpaa?; then print "\nDirectory update is disabled because cvs update" print "merges the changes from repository to your working directory." print "Hence give the filename to update - as shown below: " print " Usage: $cmdname <filename>" exit
else cvs update $tmpaa fi print "\nDone $cmdname. $cmdname successful" print "\n\nThe original file is backed-up to $tmpaa.supdate_bak" print "\nHence your original file is SAVED to $tmpaa.supdate_bak" print "\n\n"
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` Usage() { print "\nUsage: $cmdname [-r revision_number? <filename>" print " The options -r is optional " print "For example - " print " $cmdname -r 1.1 foo.cpp" print " $cmdname foo.cpp " print " " }
while getopts r: ii do case $ii in r) FLAG1=$ii; OARG1="$OPTARG";; ?) Usage; exit 2;; esac done shift ` expr $OPTIND - 1 ` if [ $# -lt 1?; then Usage exit fi homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi cur_dir=`pwd`
len=${#homedir} len=$(($len + 2))
subdir=` echo $cur_dir | cut -b $len-2000 `
tmpaa=`dirname $1` if [ "$tmpaa" = "."?; then fname=$1 if [ "$subdir" = ""?; then subdir=$tmpaa fi else fname=`basename $1` if [ "$subdir" = ""?; then subdir=$tmpaa else subdir="$subdir/$tmpaa" fi fi
cvs_root=` echo $CVSROOT | cut -f1 -d' ' ` if [ "$cvs_root" = ""?; then print "\nError: \$CVSROOT is not set!!\n" exit fi if [ ! -e "$CVSROOT/$subdir/$fname,v"?; then print "\nError: File $fname does not exist in CVS repository!!\n" exit fi
if [ ! -d "$homedir/$subdir/CVS"?; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -maxdepth 0 -type f -print | head -1 ) ` tmpbb=`basename $tmpaa | cut -d',' -f1 ` if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v"?; then print "\nThe directory $homedir/$subdir/CVS does not exist" print "You must do a sget on `basename $subdir` directory. Give -" print " cd $homedir/`dirname $subdir` " print " sget `basename $subdir` " exit else
( cd "$homedir" if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A $tmpbb else cvs -r checkout -A "$subdir/$tmpbb" fi ) fi fi
tmpfile=$homedir/sunlock-lock.tmp \rm -f $tmpfile 2>/dev/null if [ "$FLAG1" = ""?; then
( cd $homedir if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs log $fname | head -6 | grep head: | awk '{print $2}' > $tmpfile else cvs log "$subdir/$fname" | head -6 | grep head: | awk '{print $2}' > $tmpfile fi ) OARG1=`cat $tmpfile` \rm -f $tmpfile 2>/dev/null fi lockfile="$CVSROOT/$subdir/Locks/$fname-$OARG1"
if [ ! -e $lockfile?; then print "\nFile $fname revision $OARG1 is NOT locked by anyone" print " " exit fi ans="" while : do print "\n\n***************************************************" print "WARNING: $cmdname will release lock and enable other" print " developers to edit the file. It is advisable" print " to save your changes with scommit command" print "***************************************************" print -n "\nAre you sure you want to unlock the file <y/n>? [n?: " read ans if [ "$ans" = "" -o "$ans" = " " -o "$ans" = "n" -o "$ans" = "N"?; then print "\nAborting $cmdname ...." exit fi if [ "$ans" = "y" -o "$ans" = "Y"?; then print "\n\n\n\n\n " print "CAUTION: You may lose all the changes made to file!!" print -n "Are you sure? Do you really want to unlock the file <y/n>? [n?: " read ans if [ "$ans" = "y" -o "$ans" = "Y"?; then break elif [ "$ans" = "" -o "$ans" = " " -o "$ans" = "n" -o "$ans" = "N"?; then exit else print "\n\nWrong entry. Try again..." sleep 1 fi else print "\n\nWrong entry. Try again..." sleep 1 fi done if [ -e $lockfile?; then \rm -f $lockfile print "\nDone $cmdname" else print "\nFile $fname is NOT locked by anyone" print " " fi
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
Note that there is also another Unix command by the name slist (list available Netware servers). You should make sure the CVS script slist comes before other in your PATH environment.
homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi cur_dir=`pwd`
len=${#homedir} len=$(($len + 2))
subdir=` echo $cur_dir | cut -b $len-2000 `
cvs_root=` echo $CVSROOT | cut -f1 -d' ' ` if [ "$cvs_root" = ""?; then print "\nError: \$CVSROOT is not set!!\n" exit fi
if [ ! -d $CVSROOT/$subdir?; then print "\nThe directory $subdir does not exist in $CVSROOT" exit fi
if [ $# -eq 0?; then
tmpbb=` find * -maxdepth 0 -type d ` elif [ $# -eq 1?; then if [ "$1" = "."?; then
tmpbb=` find * -maxdepth 0 -type d ` else if [ -d $1 -a ! -d $CVSROOT/$subdir/$1?; then print "\nThe directory $subdir/$1 does not exist in $CVSROOT" exit fi tmpbb=$@ fi else tmpbb=$@ fi
dirnames="" for ii in $tmpbb ; do if [ -d $CVSROOT/$subdir/$ii?; then dirnames="$dirnames $ii " fi done
if [ "$dirnames" != ""?; then find $dirnames -type f | while read ii do
if [ -f "$CVSROOT/$subdir/$ii,v"?; then
ls -l $ii | grep ^\-rw fi done; fi
listfiles=`ls $tmpbb `
find * -maxdepth 0 -type f | while read ii do for jj in $listfiles ; do if [ "$jj" = "$ii"?; then
if [ -f "$CVSROOT/$subdir/$ii,v"?; then
ls -l $ii | grep ^\-rw fi fi done done;
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` if [ $# -lt 1?; then print "\nUsage: $cmdname [file/directory name? " print "For example - " print " $cmdname foo.cpp" print " $cmdname some_directory " print " " exit fi homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi cur_dir=`pwd`
len=${#homedir} len=$(($len + 2))
subdir=` echo $cur_dir | cut -b $len-2000 `
tmpaa=`dirname $1` if [ "$tmpaa" = "."?; then fname=$1 if [ "$subdir" = ""?; then subdir=$tmpaa fi else fname=`basename $1` if [ "$subdir" = ""?; then subdir=$tmpaa else subdir="$subdir/$tmpaa" fi fi
if [ ! -d "$homedir/$subdir/CVS"?; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -maxdepth 0 -type f -print | head -1 ) ` tmpbb=`basename $tmpaa | cut -d',' -f1 ` if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v"?; then print "\nThe directory $homedir/$subdir/CVS does not exist" print "You must do a sget on `basename $subdir` directory. Give -" print " cd $homedir/`dirname $subdir` " print " sget `basename $subdir` " exit else
( cd "$homedir" if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A $tmpbb else cvs -r checkout -A "$subdir/$tmpbb" fi ) fi fi
if [ -f $1?; then ( cd $homedir clear print "\ncvs status is : " cvs status "$subdir/$fname" ) elif [ -d $1?; then ( cd $homedir clear print "\ncvs status is : " tmpfile="$homedir/cvs_sinfo.tmp" rm -f $tmpfile echo " " >> $tmpfile echo " ****************************************" >> $tmpfile echo " Overall Status of Directory" >> $tmpfile echo " ****************************************" >> $tmpfile cvs release "$subdir/$fname" 1>>$tmpfile 2>>$tmpfile << EOF N EOF echo "\n -------------------------------\n" >> $tmpfile aa=`cat $tmpfile | grep ^"M " | awk '{print $2}' ` for ii in $aa do jj="(cd $homedir; cvs status \"$subdir/$ii\" );" echo $jj | /bin/sh \ | grep -v Sticky | awk '{if (NF != 0) print $0}' \ 1>>$tmpfile 2>>$tmpfile done cat $tmpfile | grep -v ^? | grep -v "Are you sure you want to release" \ | less rm -f $tmpfile ) else print "\nArgument $1 if not a file or directory" exit fi
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` if [ $# -lt 1?; then print "\nUsage: $cmdname <filename> \n" exit fi
if [ ! -f "$1"?; then print "\nError: $1 is NOT a file. Aborting $cmdname ......" exit fi homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi cur_dir=`pwd`
len=${#homedir} len=$(($len + 2))
subdir=` echo $cur_dir | cut -b $len-2000 `
tmpaa=`dirname $1` if [ "$tmpaa" = "."?; then fname="$1" if [ "$subdir" = ""?; then subdir=$tmpaa fi else fname=`basename $1` if [ "$subdir" = ""?; then subdir=$tmpaa else subdir="$subdir/$tmpaa" fi fi
if [ ! -d "$homedir/$subdir/CVS"?; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -maxdepth 0 -type f -print | head -1 ) ` tmpbb=`basename $tmpaa | cut -d',' -f1 ` if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v"?; then print "\nThe directory $homedir/$subdir/CVS does not exist" print "You must do a sget on `basename $subdir` directory. Give -" print " cd $homedir/`dirname $subdir` " print " sget `basename $subdir` " exit else
( cd "$homedir" if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A $tmpbb else cvs -r checkout -A "$subdir/$tmpbb" fi ) fi fi
( cd $homedir cvs log "$homedir/$subdir/$fname" | less ) print "\nDone $cmdname. $cmdname successful"
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` Usage() { print "\nUsage: $cmdname <filename> " print "$cmdname -r<rev1> -r<rev2> <filename> \n" exit } homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi FLAG1="" FLAG2="" OARG1="" OARG2=""
while getopts r:r: ii do case $ii in r) if [ "$FLAG1" = ""?; then FLAG1=$ii; OARG1="$OPTARG" else FLAG2=$ii; OARG2="$OPTARG" fi ;; ?) Usage; exit 2;; esac done shift ` expr $OPTIND - 1 ` if [ "$FLAG2" = ""?; then FLAG2=r OARG2=HEAD fi cur_dir=`pwd`
len=${#homedir} len=$(($len + 2))
subdir=` echo $cur_dir | cut -b $len-2000 `
tmpaa=`dirname $1` if [ "$tmpaa" = "."?; then fname="$1" if [ "$subdir" = ""?; then subdir=$tmpaa fi else fname=`basename $1` if [ "$subdir" = ""?; then subdir=$tmpaa else subdir="$subdir/$tmpaa" fi fi
if [ ! -d "$homedir/$subdir/CVS"?; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -maxdepth 0 -type f -print | head -1 ) ` tmpbb=`basename $tmpaa | cut -d',' -f1 ` if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v"?; then print "\nThe directory $homedir/$subdir/CVS does not exist" print "You must do a sget on `basename $subdir` directory. Give -" print " cd $homedir/`dirname $subdir` " print " sget `basename $subdir` " exit else
( cd "$homedir" if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A $tmpbb else cvs -r checkout -A "$subdir/$tmpbb" fi ) fi fi
( cd $homedir if [ "$FLAG1" = ""?; then cvs diff -r HEAD "$homedir/$subdir/$fname" | less else cvs diff -$FLAG1 $OARG1 -$FLAG2 $OARG2 "$homedir/$subdir/$fname" | less fi )
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` if [ $# -lt 1?; then print "\nUsage: $cmdname <filename/directory> \n" exit fi onearg="$1" if [ ! -f "$onearg" -a ! -d "$onearg"?; then print "\nArgument $onearg is not a file or a directory!" print "Usage: $cmdname <filename/directory> \n" exit fi
homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi cvs_root=` echo $CVSROOT | cut -f1 -d' ' ` if [ "$cvs_root" = ""?; then print "\nError: \$CVSROOT is not set!!\n" exit fi cur_dir=`pwd` len=${#homedir} len=$(($len + 2)) subdir=` echo $cur_dir | cut -b $len-2000 `
tmpaa=`dirname "$onearg" ` if [ "$tmpaa" = "."?; then fname="$onearg" if [ "$subdir" = ""?; then subdir=$tmpaa fi else fname=`basename "$onearg" ` if [ "$subdir" = ""?; then subdir=$tmpaa else subdir="$subdir/$tmpaa" fi fi
if [ ! -d "$homedir/$subdir/CVS"?; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -maxdepth 0 -type f -print | head -1 ) ` tmpbb=`basename $tmpaa | cut -d',' -f1 ` if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v"?; then print "\nThe directory $homedir/$subdir/CVS does not exist" print "You must do a sget on `basename $subdir` directory. Give -" print " cd $homedir/`dirname $subdir` " print " sget `basename $subdir` " exit else
( cd "$homedir" if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A $tmpbb else cvs -r checkout -A "$subdir/$tmpbb" fi ) fi fi
if [ $# -eq 1?; then if [ -f "$onearg"?; then cvs add "$onearg" exit fi elif [ $# -gt 1?; then print "\n\n\nAdding all the files in the current directory to CVS" print "Directories will not be added" print -n "Hit return to continue or CTRL+C to abort..." read ans for ii in $@ do if [ -f "$ii"?; then cvs add "$ii" fi done; exit fi
if [ "$subdir" = "."?; then
if [ -d "$CVSROOT/$onearg"?; then print "\nDirectory $onearg already exists in CVSROOT" exit else
if [ "$2" = "" -o "$3" = ""?; then print "\nUsage: $cmdname <directory> <vendor tag> <release tag>" print "For example - " print " $cmdname foo_directory V_1_0 R_1_0" exit else ( cd "$homedir/$subdir"; cvs import "$onearg" $2 $3 ) fi fi else
if [ -d "$CVSROOT/$subdir/$onearg"?; then print "\nDirectory $onearg already in CVS repository!" exit else ( if [ -d "$homedir/$subdir/$onearg/CVS"?; then print "\nError: Directory $homedir/$subdir/$onearg/CVS exists!!" print "\nAborting now ...." exit fi
cd "$homedir/$subdir/$onearg"; cvs import "$subdir/$onearg" Ver_1 Rel_1 ) fi fi
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` if [ $# -lt 1?; then print "\nUsage: $cmdname <filename> \n" exit fi onearg="$1" homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi cur_dir=`pwd` len=${#homedir} len=$(($len + 2)) subdir=` echo $cur_dir | cut -b $len-2000 `
tmpaa=`dirname "$onearg" ` if [ "$tmpaa" = "."?; then fname="$onearg" if [ "$subdir" = ""?; then subdir=$tmpaa fi else fname=`basename "$onearg" ` if [ "$subdir" = ""?; then subdir=$tmpaa else subdir="$subdir/$tmpaa" fi fi
if [ ! -d "$homedir/$subdir/CVS"?; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -maxdepth 0 -type f -print | head -1 ) ` tmpbb=`basename $tmpaa | cut -d',' -f1 ` if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v"?; then print "\nThe directory $homedir/$subdir/CVS does not exist" print "You must do a sget on `basename $subdir` directory. Give -" print " cd $homedir/`dirname $subdir` " print " sget `basename $subdir` " exit else
( cd "$homedir" if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A $tmpbb else cvs -r checkout -A "$subdir/$tmpbb" fi ) fi fi
( cd $homedir
if [ ! -f "$subdir/$fname"?; then
sget "$subdir/$fname" if [ ! -f "$subdir/$fname"?; then print "\nError: $subdir/$fname does NOT exist in CVS repository." print "\nAborting $cmdname ......" exit fi fi bkextn=cvs_sdelete_safety_backup \mv -f "$subdir/$fname" "$subdir/$fname.$bkextn" cvs remove "$subdir/$fname" print "\nsdelete command removes the file from CVS repository" print "and archives the file in CVS Attic directory. In case" print "you need this file in future then contact your CVS administrator" print " " print "\nDone $cmdname. $cmdname successful" print "Run scommit on $homedir/$subdir/$fname to" print "make this change permanent" \mv -f "$subdir/$fname.$bkextn" "$subdir/$fname" )
NOTE : Get the Korn shell /bin/ksh by installing pdksh*.rpm from the Linux contrib cdrom
Save this file as a text file and chmod a+rx on it.
cmdname=`basename $0` Usage() { clear print "\nUsage: $cmdname symbolic_tag <directory name> " print "\nFor example :- " print " cd \$HOME" print " $cmdname REVISION_1 myprojectsource_directory" print "To see the list of revisons do -" print "slog <filename> and see the symbolic name and do -" print "cvs history -T" print "\nTo create a branch off-shoot from main trunk, use" print "the -b and -r options which makes the tag a branch tag. This is" print "useful for creating a patch to previously released software" print "For example :- " print " cd \$HOME" print " cvs rtag -b -r REVISION_1 REVISION_1_1 myprojectsource_directory" print " "
exit }
if [ $# -lt 2?; then Usage fi if [ ! -d $2?; then print "\nError: Second argument $2 is not a directory!" print " Aborting $cmdname...." print " " exit fi homedir=` echo $HOME | cut -f1 -d' ' ` if [ "$homedir" = ""?; then print "\nError: \$HOME is not set!!\n" exit fi cur_dir=`pwd` len=${#homedir} len=$(($len + 2)) subdir=` echo $cur_dir | cut -b $len-2000 `
if [ ! -d "$homedir/$subdir/CVS"?; then
tmpaa=` (cd "$CVSROOT/$subdir"; find * -maxdepth 0 -type f -print | head -1 ) ` tmpbb=`basename $tmpaa | cut -d',' -f1 ` if [ "$tmpaa" = "" -o ! -f "$CVSROOT/$subdir/$tmpbb,v"?; then print "\nThe directory $homedir/$subdir/CVS does not exist" print "You must do a sget on `basename $subdir` directory. Give -" print " cd $homedir/`dirname $subdir` " print " sget `basename $subdir` " exit else
( cd "$homedir" if [ "$subdir" = "."?; then # don't use dot, will mess up cvs cvs -r checkout -A $tmpbb else cvs -r checkout -A "$subdir/$tmpbb" fi ) fi fi if [ "$cur_dir" != "$homedir"?; then print "\nYou are not in home directory $homedir!!" print "You must give the sfreeze command " print "from home directory $homedir" exit fi
cvs rtag $1 $2 print "\nDone $cmdname. $cmdname successful"
No other page links to HowToCVSRCSHOWTO yet.