Your SlideShare is downloading. ×
Coffee                             Affiliate Revenue              AdvertisingCooking Tips                       Blogging, ...
Configuration Management with CVSand Open Source Tools                           Derek Clifford
Configuration Management with CVS and Open Source ToolsBy Derek CliffordVersion 0.90Copyright © 2002,2003Derek Clifford.Pe...
Contents                                                                                                      ContentsCont...
Configuration Management with CVS       Checkout –p..........................................................................
Contents  Data Formats ......................................................................................................
Configuration Management with CVS                                                                                         ...
ContentsTable 43 Other Date Formats .........................................................................................
Introduction                                                                                    0                         ...
Configuration Management with CVSThe original version of CVS was a set of shell scripts which relied on RCS, written byDic...
Introduction            committed files, and each revision is denoted by a number such as 1.2,            or for more comp...
Planning for Installation                                                                                      1          ...
Configuration Management with CVS        Multiple Windows users accessing a network share on a Unix system serviced       ...
Planning for Installation         A protocol allowing the use of Kerberos 4 (which does not support GSSAPI)         for au...
Configuration Management with CVSis possible to obtain false results. Consideration should be given to having the hostssyn...
Planning for Installation            Single Windows User with Local Repository          Single or Multiple Unix Users with...
Configuration Management with CVS                                          NFS Shared Network                             ...
Installation                                                                                  2                           ...
Configuration Management with CVS#cd /usr/src/cvs#tar –xvzf cvs-1.11.1p1.tar.gzMoving into the cvs directory the system is...
Installationcase it is possible to cause inetd to invoke a script containing the desired command. 2401is the default port ...
Configuration Management with CVSokM Checking in ChangeLog;M /usr/local/cvs/cvssources/doc/ChangeLog,v <-- ChangeLogM new ...
Installation:ntserver:<user>@<hostname>:/cvswill connect using this protocol. CVSNT also supports pserver and GSSAPIconnec...
Connection and Authentication                                                                                   3         ...
Configuration Management with CVSRemote ShellCVS allows the remote shell to be selected to run the CVS program remotely on...
Connection and AuthenticationThe key fingerprint is:fc:24:23:dc:06:3f:5c:f4:0b:6d:9b:c5:1e:52:74:b2 cvsuser@bohrThe public...
Configuration Management with CVSGSSAPIGSSAPI (Generic Security Services Application Programming Interface) is a commonAPI...
The Repository                                                                                  4                         ...
Configuration Management with CVSThe preamble to the file shows the revision number of the head of the main trunk, in this...
The Repository2001-03-30      Larry Jones       <larry.jones@@sdrc.com>@For each earlier version the deltas are recorded. ...
Configuration Management with CVSThe init command creates an empty repository at the location specified, which containsonl...
The RepositoryconfigSeveral parameters controlling the behaviour of CVS can be specified in the config file.SystemAuth=[ye...
Configuration Management with CVScvswrappersThis file allows default options for CVS file operations to be specified. The ...
The RepositoryThis is the simplest form of command and simply refers to the set of files defined by thedirectory by a symb...
Configuration Management with CVS(although it is commented out).rcsinfoWhen a commit or import is actioned, CVS uses this ...
The RepositoryUnix password file, each entry specifying the username and password separated bycolons. A further argument a...
Configuration Management with CVSeditinfoThis file may exist in the repository, but is now obsolete.Modifying the Reposito...
The Repositorystarting with D which specify subdirectories. A single entry starting with D andcontaining no information in...
Configuration Management with CVSRepositoryContains the directory within the repository from which the current directory w...
The User Environment                                                                                    5                 ...
Configuration Management with CVSEnvironment VariablesThe environment in which the CVS client runs can be set up to simpli...
The User EnvironmentCVS_PASSFILEAfter a successful verification of the user by the server, the username, connected host,re...
Format of CVS Commands                                                                                     6              ...
Configuration Management with CVSTagsSets of files which form a release are tagged with a symbolic label, and can be retri...
Setting up the Repository                                                                                    7            ...
Configuration Management with CVSthe revision number 1.1.1.1. When the modified file is written back to the repository itw...
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Configuration management with cvs and open source tools
Upcoming SlideShare
Loading in...5
×

Configuration management with cvs and open source tools

984

Published on

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
984
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
21
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Configuration management with cvs and open source tools"

  1. 1. Coffee Affiliate Revenue AdvertisingCooking Tips Blogging, RSS & Feeds BrandingRecipes & Food and Drink Domain Name Business ManagementWine & Spirits E-Book Business EthicsElder Care E-commerce Careers, Jobs & EmploymentBabies & Toddler Email Marketing Customer ServicePregnancy Ezine Marketing MarketingAcne Ezine Publishing NetworkingAerobics & Cardio Forums & Boards Network MarketingAlternative Medicine Internet Marketing Pay-Per-Click AdvertisingBeauty Tips Online Auction PresentationDepression Search Engine Optimization Public RelationsDiabetes Spam Blocking SalesExercise & Fitness Streaming Audio & Online Sales ManagementHair Loss Music Sales TelemarketingMedicine Traffic Building Sales TrainingMeditation Video Streaming Small BusinessMuscle Building & Bodybuilding Web Design Strategic PlanningNutrition Web Development EntrepreneurNutritional Supplements Web Hosting Negotiation TipsWeight Loss Web Site Promotion Team BuildingYoga Broadband Internet Top Quick TipsMartial Arts VOIP Book MarketingFinding Happiness Computer Hardware LeadershipInspirational Data Recovery & Backup Positive Attitude TipsBreast Cancer Internet Security Goal SettingMesothelioma & Cancer Software InnovationFitness Equipment SuccessNutritional Supplements Time ManagementWeight Loss Public Speaking Get Organized - Organization Mobile & Cell Phone Book ReviewsCredit Video Conferencing College & UniversityCurrency Trading Satellite TV PsychologyDebt Consolidation Dating Science ArticlesDebt Relief Relationships ReligionLoan Game Personal TechnologyInsurance Casino & Gambling HumanitiesInvesting Humor & Entertainment LanguageMortgage Refinance Music & MP3 PhilosophyPersonal Finance Photography PoetryReal Estate Golf Book ReviewsTaxes Attraction MedicineStocks & Mutual Fund Motorcycle CoachingStructured Settlements Fashion & Style CreativityLeases & Leasing Crafts & Hobbies Dealing with Grief & LossWealth Building Home Improvement MotivationHome Security Interior Design & Decorating Spirituality Landscaping & Gardening Stress Management Pets Article Writing Marriage & Wedding Writing Holiday Political Fishing Copywriting Aviation & Flying Parenting Cruising & Sailing Divorce Outdoors Vacation Rental
  2. 2. Configuration Management with CVSand Open Source Tools Derek Clifford
  3. 3. Configuration Management with CVS and Open Source ToolsBy Derek CliffordVersion 0.90Copyright © 2002,2003Derek Clifford.Permission is granted to copy, distribute and/or modify thisdocument under the terms of the GNU Free DocumentationLicense, Version 1.2 or any later version published by the FreeSoftware Foundation; with no Invariant Sections, no Front-CoverTexts, and no Back-Cover Texts.A copy of the license is included in the appendix entitled "GNUFree Documentation License".The AuthorDerek Clifford is a director of Micro Logic Consultants, aconsultancy specialising in configuration management, design androllout of standard configurations, and general Windows and unixsupport.Contact email: derek@mlc-consultants.co.uk
  4. 4. Contents ContentsContents........................................................................................................................iiiTables ...........................................................................................................................viFigures.........................................................................................................................viiScreenshots..................................................................................................................viiIntroduction ................................................................................................................... 1 Typographical Conventions....................................................................................... 2 Glossary..................................................................................................................... 2Planning for Installation ................................................................................................ 5 Configuration ............................................................................................................ 5 Sizing......................................................................................................................... 7 Code Organisation..................................................................................................... 7 Times and Timezones................................................................................................ 7Installation................................................................................................................... 11 Unix Systems........................................................................................................... 11 Common Steps ........................................................................................................ 11 Client/Server Mode ................................................................................................. 12 Troubleshooting ...................................................................................................... 13 Windows Systems ................................................................................................... 14 CVSNT Differences ................................................................................................ 15Connection and Authentication ................................................................................... 17 Password Server ...................................................................................................... 17 Remote Shell ........................................................................................................... 18 Secure Shell............................................................................................................. 18 GSSAPI ................................................................................................................... 20 Kerberos 4 ............................................................................................................... 20The Repository ............................................................................................................ 21 Modifying the Repository Files............................................................................... 30 How CVS Uses the CVSROOT Files...................................................................... 30 Hanging Locks ........................................................................................................ 32The User Environment ................................................................................................ 33 Environment Variables............................................................................................ 34Format of CVS Commands ......................................................................................... 37 Revisions ................................................................................................................. 37 Tags ......................................................................................................................... 38Setting up the Repository ............................................................................................ 39 Importing From Other Repositories ........................................................................ 41 Adding a Directory Structure .................................................................................. 41 Adding and Removing Files.................................................................................... 41Development ............................................................................................................... 43 Obtaining a Working Copy ..................................................................................... 43 Making Changes...................................................................................................... 45 The annotate Command........................................................................................... 51 Customised Logging................................................................................................ 51 The Diff Command ................................................................................................. 52 iii
  5. 5. Configuration Management with CVS Checkout –p............................................................................................................. 52 Abandoning Changes .............................................................................................. 52 Keyword Substitution.............................................................................................. 53 Binary Files ............................................................................................................. 53 Sticky Options ......................................................................................................... 54 Exclusive Locks ...................................................................................................... 54 Strange Files ............................................................................................................ 55 Revisions, Releases and Branches............................................................................... 57 Working on a Branch .............................................................................................. 59 Merging a branch..................................................................................................... 60 Backing Out a Change............................................................................................. 61 The Vendor Branch ................................................................................................. 61 Source Distribution and Mirror Sites .......................................................................... 63 Windows Problems...................................................................................................... 65 Front Ends ................................................................................................................... 67 WinCVS .................................................................................................................. 67 gcvs ......................................................................................................................... 68 Cervisia ................................................................................................................... 69 CVSIn...................................................................................................................... 70 Lincvs ...................................................................................................................... 70 EMACS ................................................................................................................... 71 VIM ......................................................................................................................... 71 Build Systems.............................................................................................................. 73 Make........................................................................................................................ 75 Jam .......................................................................................................................... 75 Cook ........................................................................................................................ 75 Odin......................................................................................................................... 75 Visualising the Source Tree......................................................................................... 77 Diff and Merge Programs............................................................................................ 79 Windows Programs ................................................................................................. 79 Unix Programs......................................................................................................... 81 Anonymous CVS......................................................................................................... 83 Problem Tracking ........................................................................................................ 85 CVStrac ................................................................................................................... 85 Bugzilla/CVSZilla ................................................................................................... 87 Administrative Tasks................................................................................................... 89 Backup..................................................................................................................... 89 Tidying up the Repository ....................................................................................... 89 CVS Defaults........................................................................................................... 90 Reset the Default Branch......................................................................................... 90 Other Utilities .............................................................................................................. 91 Appendix A Environment Variables ........................................................................... 93 Appendix B CVS Command Reference ...................................................................... 95 Global Options ........................................................................................................ 95 Admin Commands................................................................................................. 108iv
  6. 6. Contents Data Formats ......................................................................................................... 110 Other Date Formats ............................................................................................... 111 Alternate Command Names .................................................................................. 111Appendix C - Customisation ..................................................................................... 113 modules ................................................................................................................. 113 commitinfo ............................................................................................................ 114 loginfo ................................................................................................................... 114 verifymsg............................................................................................................... 114Appendix D - Common Tasks................................................................................... 115 Add a directory to a module .................................................................................. 115 Add a file to a module ........................................................................................... 115 Back out a change.................................................................................................. 115 Checkout a branch ................................................................................................. 115 Checkout a module................................................................................................ 116 Commit a module .................................................................................................. 116 Create a branch...................................................................................................... 116 Exclusive lock ....................................................................................................... 116 Merge a branch...................................................................................................... 116 Remove a file ........................................................................................................ 116 Remove a directory ............................................................................................... 116 Return the working directory to the current revision............................................. 117 Tag a Release ........................................................................................................ 117 Update a working directory ................................................................................... 117Appendix E – Resources ........................................................................................... 119Appendix F – GNU Free Documentation Licence .................................................... 121Index.......................................................................................................................... 129 v
  7. 7. Configuration Management with CVS TablesTable 1 CVS Supported Platforms .................................................................................. 11Table 2 CVSNT passwd options ..................................................................................... 15Table 3 Connection Methods .......................................................................................... 34Table 4 History Logging Options.................................................................................... 50Table 5 Keywords ........................................................................................................... 53Table 6 Environment Variables....................................................................................... 94Table 7 Common Global Options.................................................................................... 95Table 8 Client Global Options......................................................................................... 96Table 9 Server Global Options ........................................................................................ 96Table 10 add command options....................................................................................... 97Table 11 annotate command options ............................................................................... 97Table 12 checkout command options .............................................................................. 98Table 13 commit command options ................................................................................ 98Table 14 diff common command options........................................................................ 98Table 15 diff formatting options...................................................................................... 99Table 16 edit command options ...................................................................................... 99Table 17 edit actions ..................................................................................................... 100Table 18 editors command options................................................................................ 100Table 19 export command options ................................................................................ 100Table 20 history commandoptions ................................................................................ 101Table 21 history output.................................................................................................. 102Table 22 import command options................................................................................ 102Table 23 import output .................................................................................................. 102Table 24 log command options ..................................................................................... 103Table 25 log command date specification ..................................................................... 103Table 26 log command revision specification ............................................................... 103Table 27 rdiff command options ................................................................................... 104Table 28 relese command option................................................................................... 104Table 29 release command output................................................................................. 105Table 30 remove command options .............................................................................. 105Table 31 rtag command options .................................................................................... 105Table 32 status command options ................................................................................. 105Table 33 tag command options...................................................................................... 106Table 34 unedit command options ................................................................................ 106Table 35 update command options................................................................................ 107Table 36 update command output ................................................................................. 107Table 37 watch command options................................................................................. 107Table 38 watch command actions ................................................................................. 108Table 39 watchers command options ............................................................................ 108Table 40 keyword substitution flags.............................................................................. 108Table 41 admin command options ................................................................................ 109Table 42 Data Formats .................................................................................................. 110vi
  8. 8. ContentsTable 43 Other Date Formats ........................................................................................ 111Table 44 Alternate Command Names ........................................................................... 111Table 45 modules file options ....................................................................................... 113Table 46 commitinfo file options .................................................................................. 114Table 47 loginfo file options ......................................................................................... 114Table 48 verifymsg file options..................................................................................... 114 FiguresFigure 1 Some Possible CVS Configurations.................................................................... 9Figure 2 Some Possible CVS Configurations.................................................................. 10Figure 3 Creating a Branch ............................................................................................. 59 ScreenshotsScreenshot 1 The newly initialised repository................................................................. 23Screenshot 2 Checking out a module .............................................................................. 44Screenshot 3 Checking out a subdirectory with a regular module................................... 45Screenshot 4 Checking out a subdirectory with an alias module .................................... 45Screenshot 5 The CVSup GUI ........................................................................................ 64Screenshot 6 The WinCVS GUI...................................................................................... 68Screenshot 7 The gcvs GUI............................................................................................. 68Screenshot 8 The cervisia GUI........................................................................................ 69Screenshot 9 The TortoiseCVS GUI ............................................................................... 70Screenshot 10 the CVSIn add-in toolbar for Visual Studio............................................. 70Screenshot 11 The LinCVS GUI..................................................................................... 71Screenshot 12 Cvsmenu adds CVS functions to vim ...................................................... 71Screenshot 13 The gvim plugin Displays the CVS menu................................................ 72Screenshot 14 The Display from CVSgraph ................................................................... 78Screenshot 15 The WinCVS Graphical Display.............................................................. 78Screenshot 16 The CSDiff Diff Format Display ............................................................. 80Screenshot 17 CSDiff Handles MS Word Files .............................................................. 80Screenshot 18 The WinMerge Display............................................................................ 81Screenshot 19 xxdiff shows the differences reported by a standard diff program........... 81Screenshot 20 The CVStrac Problem Ticket ................................................................... 86Screenshot 21 CVStrac displays the changes made to a file ........................................... 86Screenshot 22 Part of Bugzillas Problem Report............................................................ 87Screenshot 23 Bugzillas Query Form ............................................................................. 88 vii
  9. 9. Introduction 0 IntroductionVarious organisations have very different ideas about configuration management, andthe tools used to ensure a reliable and reproducible development process. Sophisticatedconfiguration management tools can cost upwards of £50,000, require ongoing support,and are probably only accessible to the largest organisations. Although the capabilities ofthese tools ease the job of a configuration manager and the developers, there is still alevel of organisation necessary to support the CM process. Undoubtedly, in adevelopment environment, the disciplines of CM can lead to increased efficiency andreduced costs. With CVS, an open source product, these disciplines can be implementedby any size of organisation.Source code control systems have been common as part of a Unix system from veryearly days, starting with SCCS (Source Code Control System), and later RCS (RevisionControl System).SCCS, was initially developed in 1972 by Marc Rochkind at Bell TelephoneLaboratories, and RCS by Walter F. Tichy at Purdue University in the 1980s. Thesesystems are still in use in various guises. Both of these are very conservative in theirbehaviour, avoiding the problems of concurrent update of files by explicitly locking afile for the exclusive use of a single developer. CVS on the other hand provides forsimultaneous update of a file by many users, and relies on being able to merge thechanges back into a single file. Although this is not always possible, because of thenormal ways of organising the writing and debugging of code where it is unlikely formore than one developer to be working on the same section of code, the occasions whenmanual intervention is required to merge changes is relatively rare, and generally doesnot prove a problem. 1
  10. 10. Configuration Management with CVSThe original version of CVS was a set of shell scripts which relied on RCS, written byDick Grune in 1985. Later these scripts were converted into C by Brian Berliner. Sincethen the C version has been taken over by GNU, and the system no longer relies on RCS,although the RCS file format is still used.Since the program became open source, many contributors have provided additionalsoftware to enhance CVS.Typographical Conventions<entityname> is used to indicate a generic term such as a filename[] is used to indicate optional arguments| is used where alternative arguments are possibleFixed pitch is used in examples of computer outputFixed Bold is used for commands typed by the user denotes the command is continued on the next line# is the Unix prompt characterGlossarybranch A parallel development code stream, originating in a certain revision of the trunk or another branch.checkin The process of returning changes made by a developer in his local work area to the repository.commitcheckout The process of obtaining a working copy of one or more files and directories from the repository and placing it in the user’s work area.conflict A situation found during a merge, where two or more changes to a file cannot be resolved automatically, and manual intervention to resolve the conflict is required.headtip The highest revision in the trunk or on a branch. By default this revision will be returned on checkout.merge The process of integrating changes to the code made by an individual developer back into the repository. This can lead to the detection of conflicts which must be dealt with manually.repository The central store of the project code which holds all the information required to recreate all the revisions which have existed. This may be used to refer to the complete repository, the repository for a single project, or the archive file of a single file.revision CVS uses the word revision, rather than version (which is often used to denote a release of a software product. It refers to individual2
  11. 11. Introduction committed files, and each revision is denoted by a number such as 1.2, or for more complex situations, where branching has been performed 1.2.2.5.sandbox,work area The local directory structure where a developer modifies copies of the code held in the repository.trunk The main development code stream. 3
  12. 12. Planning for Installation 1 Planning for InstallationConfigurationCVS can be configured on many machine architectures and systems, and is suitable forall sizes of project, from the single developer to a development requiring hundreds ofcontributors. The machine architectures in use will determine to some extent how CVS isconfigured, but there are always several alternatives to consider. CVS is available inboth client/server and local forms for both Unix and Windows. Thus it is possible to runthe system using a local client, allowing only one user under Windows, but many onUnix, using a local client accessing a networked shared filesystem, or in full client-server mode with several protocols available for communication. There is no restrictionon mixing Unix and Windows systems, so a popular configuration would be to useWindows workstations accessing data on a Unix server over the network. Traditionallythe CVS client was a command-line interface, and at least the configuration managerwill still need to use this from time to time, but now graphical client software is availablefor both Unix and Windows, and it is likely that this will be a better choice fordevelopers.There are many possibilities for configuring CVS, here are some examples: Single user on a Windows System running CVS in local mode Single/Multiple users on a Unix system running CVS in local mode Multiple Windows systems accessing a network share on a Windows NT/200 server in local mode 5
  13. 13. Configuration Management with CVS Multiple Windows users accessing a network share on a Unix system serviced by SAMBA in local mode Multiple Unix systems accessing an NFS share on a Unix Server in local mode Multiple Unix systems accessing a Unix server through one of CVS’s remote protocols in client/server mode Multiple Windows systems accessing a Unix system through one of CVS’s remote protocols in client server mode Multiple Windows systems accessing a Windows NT/200 system using a remote communications protocol in client/server modeAdditionally, in many of these configurations, workstations could be a mixture ofWindows and Unix clients.Because there is a defined protocol for CVS client/server communication, it should bepossible to mix any client with any server, although the Windows NT server requires itsown client, as commands have been added to allow users to be set up.There are two main considerations in choosing the method of using CVS, theorganisation of the developers, and of course their number and locations, and therequirements for security. Where more than a few developers are involved, or developersuse windows workstations supporting a single user, the organisation is much more likelyto favour a client/server setup than a local one. Where development (or evendistribution) occurs across multiple sites, or over a large multipurpose network, someattention must be given to the communication protocols used between clients and server.The alternatives available are: Remote Shell Command Although this may be the simplest system to set up, it offers little security, and almost certainly will be blocked by a firewall. No explicit login verification is required. Secure Shell Command Offers public/private key pair validation, and encryption, and can easily be used through firewalls. Password Server Where some level of security validation is required, the CVS system can run with a password server, but the passwords are not effectively encoded therefore the security offered is weak. For this reason many installations encourage the use of a different set of passwords from the developers’ main login passwords. GSSAPI A generic security protocol interfacing to network security systems such as Kerberos 5 Kerberos6
  14. 14. Planning for Installation A protocol allowing the use of Kerberos 4 (which does not support GSSAPI) for authentication.The diagrams give some idea of the configurations possible with local and client/serverCVS.SizingEstimating the amount of disk space required for a development is never an easy task. Ifyou are converting an existing project to CVS, then the initial code size is known.Depending on the amount of further development envisaged, it is probably wise to allowup to three times the existing code size for future expansion of text files, as onlyincremental changes are added to the files. Binary files, however can consume largeamounts of space, as each revision must be stored in its entirety, so its size and thenumber of revisions it will go through must be estimated. With, say, a word processingformat design document it may be evident how many versions will be required over thelife of the project, but in many cases one can only guess, and obviously it is best tooverestimate the disk space required.For configurations where CVS runs locally, each developer using the server will alsoneed a working directory, sufficiently large to hold the section of code on which he iscurrently working, plus any other components of the project required to compile and test.On a Unix system space can be conserved by using links to parts of the code or librariesnot immediately being worked on, but this is not possible on Windows systems. WhereCVS is operating in client/server mode no space is required on the server for the clientsystems.As far as the memory (physical+swap space) is concerned, CVS requires up to 2MB foreach concurrent checkout, and up to ten times the size of a file for checkin. Multiplyingthese figures by thenumber of concurrent activities expected should give an indication of the memoryrequirement, although this is usually quite modest.Code OrganisationSome thought needs to be given to how the code will be arranged in the repository.When a developer checks out a set of files, it should be easy for him to retrieve acomplete set of files for compilation and test, but if the code is organised so that heneeds to check out more than the minimum amount required this will give rise to extranetwork traffic, further requirements for client-side disk space, and increase thelikelihood of conflicts being reported on checkin.Times and TimezonesSince CVS determines whether a file has been updated by comparing its modificationtime with the time at which it was checked out, if the clocks on client and server differ it 7
  15. 15. Configuration Management with CVSis possible to obtain false results. Consideration should be given to having the hostssynchronise their clocks by access to a time server. Projects distributed across timezonesare correctly catered for by Unix systems, but there are some issues with Windowsclients.8
  16. 16. Planning for Installation Single Windows User with Local Repository Single or Multiple Unix Users with Local Repository Shared Network Drive Windows NT Server or Unix Server Running SAMBAMultiple Windows Users in Local Mode using a Network Shared Drive Figure 1 Some Possible CVS Configurations 9
  17. 17. Configuration Management with CVS NFS Shared Network Drive Unix File Server Multiple Unix Systems in Local Mode Using a Network Shared Drive Pserver or SSH Communication Pserver Communication Internet SSH or Pserver over VPN Communication Remote repository with mixed clients distributed locally and remotely Figure 2 Some Possible CVS Configurations10
  18. 18. Installation 2 InstallationUnix SystemsCVS is available in several flavours, and as source for compilation where no binaryexists for the required architecture. The program is available fromhttp://www.cvshome.org/downloads.html, and the main selection of machines supportedis shown in Table 1, although there are various other ports of CVS, and the souce code isavailable for compilation on other architectures. Platform ArchitectureWin32 x86Linux x86Unix: IBM AIX 4.3 RS/6000Unix: BSDI BSD/OS 4.0.1 x86Unix: HP HP-UX B.10.20 A HP 9000/820Unix: Sun SunOS 5.6 (aka Solaris 2.6) SPARCUnix: SGI IRIX 6.5 MIPS R12000 Table 1 CVS Supported PlatformsCommon StepsThe files are downloaded as tar or gnu-zipped tarfiles and should be expanded in adirectory under the source tree: 11
  19. 19. Configuration Management with CVS#cd /usr/src/cvs#tar –xvzf cvs-1.11.1p1.tar.gzMoving into the cvs directory the system is built with the commands:#cd cvs-1.11.1p1#./configure#make#make installThis will install the CVS binaries in the default location for the architecture of themachine used, and to use CVS in local mode, the only additional step is to make sure theCVS binary location is in the path.Client/Server ModeDepending on the type of communication chosen between client and server, variousswitches may be needed to configure the makefiles for compilation. To enable GSSAPIit is necessary to run configure with:#./configure –with-gssapi –enable-encryptionand to enable Kerberos 4:#./configure –with-krb4 –enable-encryptionIn both these cases, the generation of the encrypting code is optional. CVS inclient/server mode is usually started up with inetd, and the following changes arerequired in /etc/services and /etc/inetd.conf:/etc/services cvspserver 2401/tcp/etc/inetd.confcvspserver stream tcp nowait root /usr/bin/cvs cvs –f –allow-root=/usr/cvsroot pserveror, with tcpwrappers in use:cvspserver stream tcp nowait root /usr/sbin/tcpd /usr/bin/cvs –allow-root=/usr/cvsroot pserver(Note that the command may have to be typed on a single line, without the continuationcharacter)The –f switch disables the interpretation of ~/.cvsrc, which may contain optionsinappropriate for the CVS program running as a daemon, and the allow-root switchrestrict access to clients requesting this base directory for the repository. Multipleinstances of the allow-root switch are allowed, but some implementations of inetdrestrict the length of the command which can be entered on the command line. In this12
  20. 20. Installationcase it is possible to cause inetd to invoke a script containing the desired command. 2401is the default port for CVS operating in pserver mode.Where xinetd is used to start up network services the following must be entered into thefile /etc/xinetd.d/cvspserver:service cvspserver{ port = 2401 socket_type = stream protocol = tcp wait = no user = root passenv = PATH server = /usr/bin/cvs server_args = -f –allow-root=/usr/cvsroot pserver}For the kserver connection method pserver should be replaced in the above with kserverfor Kerberos 4, and the port number for kserver is by default 1999. In order to test the installation the location of the CVS repository needs to be set in theenvironment variable CVSROOT, and this may be done in the shell’s initialisationscript. For systems running CVS on the local host, only the location of the repositoryneed be specified:For csh: setenv CVSROOT /usr/cvsFor bash: export CVSROOT=/usr/cvsIn client/server mode a connection string is specified of the form::<connection method>:<username>@<hostname>:<repository path>For example::pserver:cvsuser@cvshost:/usr/local/cvsTroubleshootingMost problems in setting up CVS will be found with client/server systems, and may becaused by a failure to start up the server, incorrect environment settings, or a failure toauthenticate the user. To determine the cause it is possible to log the communicationbetween client and server. By setting the environment variable CVS_CLIENT_LOG onthe client machine all messages sent by the client will be logged in$CVS_CLIENT_LOG.in, and messages received from the server in the corresponding.out file. An example of a log file is shown below. 13
  21. 21. Configuration Management with CVSokM Checking in ChangeLog;M /usr/local/cvs/cvssources/doc/ChangeLog,v <-- ChangeLogM new revision: 1.7; previous revision: 1.6M doneMode u=rw,g=r,o=rChecked-in .//usr/local/cvs/cvssources/doc/ChangeLog/ChangeLog/1.7///M Checking in cvs.texinfo;M /usr/local/cvs/cvssources/doc/cvs.texinfo,v <-- cvs.texinfoM new revision: 1.4; previous revision: 1.3M doneMode u=rw,g=r,o=rChecked-in ./Windows Systemswww.cvshome.org provides a Windows CVS system which can run as a client or locally.A windows server system (CVSNT) is available from www.cvsnt.org. A CVSclient/local system also forms part of the Cygwin distribution of Unix tools for Windows(www.cygwin.com).Installation of the client and local systems is simply a matter of extracting the CVSbinary from the zip file and putting it in a suitable directory in the path.The Windows NT CVS server runs on both Windows NT and Windows 2000 as aservice. After unzipping the file, executing the binary starts the installation program,which runs through the setup.There are a few differences between the organisation of programs and files from theUnix setup, and it is useful to avoid spaces in path and filenames.The directory to be used for temporary file by CVS must be accessible with full controlto all users. Because of the way Windows handles users’ personal files, the files must belocated in an area where all users can see them, and not in any special folders personal toa user. It is suggested that the repository and temporary directory are created within thedisk root directory, and that the program is not installed in the Program Files directory,as it contains a space in the path.The installation of CVSNT often cannot set the path correctly to include the CVSNTprogram, so this may have to be added manually in the system section of theenvironment variables settings.CVSNT is controlled by a control panel applet, and this must be used to specify thelocation of the repository and temporary directories, to start and stop the service and toselect options. The admin files of the repository may also be created through the applet.CVSNT and the CVS client installed with it support a further system of client/servercommunication, known as ntserver. By default a CVSROOT string such as:14
  22. 22. Installation:ntserver:<user>@<hostname>:/cvswill connect using this protocol. CVSNT also supports pserver and GSSAPIconnections, using the connect strings::pserver:<user>@<hostname>:/cvs:sspi:<user>@<hostname>:/cvsThe ntserver and SSPI connection methods both use the system authentication to validateusers, while pserver works in the normal way using the passwd file. A further commandhas been added to CVSNT to manage users and passwords, which can only be used byusers with administrative rights:cvs passwd [options] <username> Option Description-a Add user-D <domain> Use the domain password-R Remove alias to user-r <username> Alias the username to this real account-x Disable User-X Delete User Table 2 CVSNT passwd optionsCVSNT DifferencesCVSNT supports unicode in the UCS-2 and UTF-8 forms. UCS-2 files should be markedwith the option –ku, as they are translated to UTF-8 on commit.The admin –l command for exclusive locks is not supported, but some support for suchlocks is provided by the edit –c and commit –c options.Users of other domains may login by specifying the domain in the connect string::<connection method>:<domain><username>@<hostname>:<repository path> 15
  23. 23. Connection and Authentication 3 Connection and AuthenticationWhere a central repository is used from remote client machines, some thought must begiven to security in order to maintain both confidentiality and the integrity of the codebase. This has always been a relatively poorly supported aspect of CVS, the originalpserver communication system transmitting passwords in almost clear text, and offeringno encryption of data during transmission.Password ServerThe CVS password server, although only offering weak security and no encryption ofdata, can be useful because of it’s ability to provide aliases for usernames, which can beused to control access to various parts of the repository. Connection is made using aconnect string such as:cvs –d :pserver:[<username>|<alias>]@<hostname>: <repository path> <command>Passwords or aliases are searched for in the passwd file in the CVSROOT directory, andare held as standard Unix encoded strings. If the user is not found in this file, then anattempt is made to authenticate the user using the system passwords if SystemAuth is setto yes in the config file.Passwords are stored on the client machine in a very simply encoded form andtransmitted in the same manner. 17
  24. 24. Configuration Management with CVSRemote ShellCVS allows the remote shell to be selected to run the CVS program remotely on therepository host. Connection by this method can be achieved with:export CVS_RSH=/usr/bin/rshexport CVS_SERVER=/usr/bin/cvscvs –d :ext:<username>@<hostname>:/usr/local/cvs <command>Permission to run a remote shell must be set up in the .rhosts file of the user’s account onthe remote host, and it may be necessary to set up /etc/hosts.allow and /etc hosts.deny.This method offers only weak authentication, and no encryption of data duringtransmission. The remote shell requires actual usernames registered on the remote hostto be used, and cannot support the aliases available with pserver.Secure ShellThe pserver connection method is almost always set up to use aliases as passwords, toavoid compromising the main login password of the users, but this offers very littlesecurity, and all data is transmitted in plain text. An improvement in security can beobtained by using the secure shell for communication. In this case the ext method ofcommunication is used, specifying the client program to use for communication as thesecure shell client. A typical connection string would be:export CVS_RSH=/usr/bin/sshexport CVS_SERVER=/usr/bin/cvscvs –d :ext:cvsuser@oppenheimer:/usr/local/cvs <command>To set up the secure shell (this example assumes openssh is used), the host machine forthe CVS repository must be running the secure shell daemon, and port 22 must be open.Since SSH uses a public/private key pair, and all data passed is encrypted, it is safe toopen this port on the firewall. To set up the communication between the client and servera key pair is generated using ssh-keygen on the client machine:ssh-keygen –t rsathe only argument required is the type of keypair to be generated, which here is specifiedas a key pair generated using the RSA algorithm, although the length of the key can bevaried between 512 and 2048 bits using the –b switch.The ssh-keygen dialogue asks for a passphrase which is used in generating the key pair:ssh-keygen –t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/home/cvsuser/.ssh/id_rsa):Enter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in/home/cvsuser/.ssh/id_rsa.pub.18
  25. 25. Connection and AuthenticationThe key fingerprint is:fc:24:23:dc:06:3f:5c:f4:0b:6d:9b:c5:1e:52:74:b2 cvsuser@bohrThe public key generated here (/home/cvsuser/.ssh/id_rsa.pub) must now be transmittedto the CVS host, and added to the ~/.ssh/authorized_keys file of the user which will beused to access CVS. This does not have to be the same user which is used on the clientmachine.At the first attempt to connect with ssh the system will report that the identity of theremote host cannot be confirmed, and will display the key fingerprint of the host. Thisshould be verified, and if confirmed the system will add the remote hosts key to the listof known hosts, and the message will not occur again.If the environment variable CVS_RSH is set to point to the SSH client, then CVS willinvoke the remote CVS program through an ssh shell. This will normally ask the usereach time for a password, which may become tedious. To overcome this, the clientuser’s private key is added to the environment using ssh-agent:ssh-agent $SHELLcauses a shell to be spawned by ssh-agent, and adding keys with:ssh-add ~/.ssh/id_rsaadds the user’s private key to the environment. To confirm the identity of the user, SSHrequests the passphrase used to generate the key. Once the private key is available in theuser’s environment no further requests for passwords will be made when typing cvscommands.There are two configuration variables for SSH which may need setting for CVS use. Theconfiguration file for the SSH client is usually found in /etc/ssh_config, and that for theserver daemon in /etc/shd_config. On the client side the parameter:FallBackToRsh=nowill prevent the system reverting to the insecure rsh remote shell if the SSH daemoncannot be contacted.SSH by default uses low numbered ports for its communication, which may giveproblems with some firewalls. Setting:UsePrivilegedPort=noin the shd_config file will allow SSH to use high numbered ports, which shouldovercome these problems.Unlike the pserver method of connection, using SSH or rsh the CVS system on therepositoty host does not have to be set up to run as a server as the program to run on theremote machine, specified in the CVS_SERVER environment variable, is started by theremote shell. 19
  26. 26. Configuration Management with CVSGSSAPIGSSAPI (Generic Security Services Application Programming Interface) is a commonAPI for client/server authentication. It is supported by version 5 and above of Kerberos,a network authentication protocol designed by MIT, which provides strongauthentication for client/server applications by using secret-key cryptography.The GSSAPI is handled by the same mechanism as the password server, provided thesystem has been built to support the protocol.Connecting via GSSAPI is achieved by obtaining a ticket with the principal namespecified as cvs/<hostname>, and connecting with the connect string::gserver:<username>@<hostname>:<repository path>Having set up strong authentication, other forms of authentication should be prevented.This can be achieved by setting SystemAuth=no in the config file, and by creating anempty passwd file in the CVSROOT directory.Note that, although the user will be authenticated at login, the message streams areneither authenticated nor encrypted by default, and it is necessary to specify the globaloptions –a (authentication) and –x (encryption) if this is required. The .cvsrc file can beused to set these options as default for each user.Kerberos 4The earlier version 4 of Kerberos, which does not support GSSAPI is also supported byCVS. For this setup the CVS server must be started up by the command:cvs kserverand will listen by default on port 1999. The mechanism for authentication is to obtain aticket for access to the host machine and to connect with a string of the form::kserver:<username>@<hostname>:<repository path>Again authentication of the message streams and encryption are not enabled by default.20
  27. 27. The Repository 4 The RepositoryThe repository comprises a file for each file in the code tree, containing the completehistory of changes made to a file, and allowing any version to be retrieved. These filesbear the same name as the file in the source, but have the suffix ‘,v’ added to the name.The format of these files follows the syntax used in the earlier code management systemRCS. Although it should never be necessary to edit one of these files directly, it isinteresting to look at the format of the files. Some sections of a typical RCS file areshown here.Starting with some general information on the file, the current revision (head) isrecorded, and linked to previous versions with the next command, also recording anybranches. The system works on negative deltas – that is the full text of the currentrevision is recorded, together with the actions required to revert to earlier revisions.Changes are recorded as additions and deletions of lines, a modification to a line alwaysbeing recorded as a deletion follwed by an addition.head 1.6;access;symbols cvssrc-1-0patch:1.4.0.2 cvssrc-1-0:1.4 Import:1.1.1.1 mlc:1.1.1;locks; strict;comment @# @; 21
  28. 28. Configuration Management with CVSThe preamble to the file shows the revision number of the head of the main trunk, in thiscase 1.6, and lists the symbolic tags associated with particular revisions of the file. Theaccess field was used in RCS to specify an access list of users who may update the file,but this feature is obsolete in CVS and should not be used even though the commandsstill exist to update this field. The specification of strict locks (the default) is normal inCVS, and this requires even the owner of the file to follow the normal checkout/commitsequence for updating the file. A comment may be added to the file.1.6date 2002.11.24.11.20.31; author cvsuser; state Exp;branches;next 1.5;1.5date 2002.11.23.12.12.50; author cvsuser; state Exp;branches;next 1.4;A section exists for each revision of the file, specifying the revision number, date of lastupdate and the user updating the file. The state of the file is shown here as experimental.These records are chained together through the branches and next fields, the next fieldgiving the previous revision on the current branch or trunk.1.6log@This is a log message@text@2001-04-28 Derek Price <dprice@@collab.net> * Makefile.in: Regenerated using AM 1.4e as of today at18:10 -0400. * CVSvn.texi: Regenerated.2001-03-31 Larry Jones <larry.jones@@sdrc.com> * cvsclient.texi (Dates, Requests): Add rannotate andrlog.The text of the current revision at the head of the tree is held in full, making the systemmore efficient as the most likely text which a user will retrieve is this version.1.5log@Corrected spelling@text@d6 1a6 122
  29. 29. The Repository2001-03-30 Larry Jones <larry.jones@@sdrc.com>@For each earlier version the deltas are recorded. Here the log message is held, togetherwith the modifications made. in the text field the fact that 1 line was deleted at line 6(@d6 1) and that a line was added in the same place (a6 1) together with the text addedis recorded.The location of the repository is usually defined by the environment variableCVSROOT, but this may be overridden by the use of the –d switch to CVS, thusallowing several different repositories to reside on the same server. As developers needwrite access to the repository to create lock files, security is a problem. A new repositorycan be set up with the command:#cvs –d <repository root path> initor, if CVSROOT has been set up with:#cvs initInitialising a repository creates the directory tree shown in Screenshot 1. Screenshot 1 The newly initialised repository 23
  30. 30. Configuration Management with CVSThe init command creates an empty repository at the location specified, which containsonly the CVS administration files. Most of these files are created read-only, but thedirectory CVSROOT, and the files val-tags and history must be writeable by all cvsusers. In fact the CVSROOT directory contains both working copies of the admin files,and a repository of them CVS stores the changes made to all files in files with the suffix,v. Thus for almost all of the files there is an archive file such as taginfo,v together withthe working copy of the file named taginfo. Having created the repository, it is necessaryto change the ownership of the files so that users do not need root permissions. A usefulsecurity policy as a minimum should allow for a group of administrators, and one ormore groups of users. Where more than one group of developers are working ondifferent projects, it is advisable to grant write permissions in the repositories throughgroup membership, so that the different groups can only access the files they areworking on.An alternative to using groups when using the pserver authentication method is to set upusers with an alias, which is also useful to protect users’ logon passwords where weaksecurity is used to transfer passwords. An example is given in the section describing thepasswd file.Several of the admin files control how CVS works, and there are other files which maybe added to the directory to modify the behaviour of CVS.checkoutlistCVS treats the admin files in the same way as all other files in the repository. When anadmin file is edited it should be done by checking the file out, editing it, and committingit to the repository. CVS however needs a current working copy of the admin files, so itthen automatically extracts the latest version of the files. Where other files have beenadded, such as a password file, these files need to be listed in the checkoutlist file so thatCVS treats them as admin files. The format is the filename, followed by an errormessage to display if the file cannot be checked out.commitinfoWhen a file is committed (checked back into the repository) it is possible to check ormodify the file by running a script or program. For example a C “beautifier” could bemade to run on C source code files, or checks could be made that the file containedcertain information fields. The commitinfo file contains lines with value pairsrepresenting a normal expression to match the directory to which the change is beingcommitted, and the path to a program to run if the match is true. In addition the patternsALL and DEFAULT can be used to run a program for all files (in addition to actionsspecified by a pattern match), or any file for which a specific match is not found.The specified program is run with arguments specifying the repository directory and thelist of files being committed. If the program does not return a zero exit code the commitis aborted.24
  31. 31. The RepositoryconfigSeveral parameters controlling the behaviour of CVS can be specified in the config file.SystemAuth=[yes|no]Specifies whether CVS pserver should attempt to authorise a user using the system userdatabase if the user cannot be authorised by the CVSROOT/passwd file.LockDir=<path>For security reasons it may be desirable to cause lock files to be written to anotherdirectory so that users do not need to have write access to the repository.TopLevelAdmin=[yes|no]This causes an additional directory CVS to be created at the top level in a developer’swork area, recording the location in the repository of the checked out modules. It isuseful when more than one module is being worked on as it removes the need for theuser to specify the location in the repository.LogHistory=[all|option string]Selects the messages which are logged in the history file. The options are:T rtagO checkoutF releaseE exportW working copy deleted during updateG merge required and successfully completedC merge required, but conflicts detectedM file modifiedA file addedR file removedAn example of usage is:LogHistory=TMARReReadLogAfterVerify=[always|stat]This parameter causes the log entry to be reread after running the verifymsg script,which may be used to modify the log message. The parameters cause this to beperformed always, or only on status change.cvsignoreContains a list of files, specified by patterns, which CVS should ignore. The patterns areshell style patterns and not regular expressions, thus usually only the wild character “?”and wildcard “*” are used. No comments are allowed in this file. This file is useful andwill reduce the redundant information written to the log file. When compilations areperformed in the working directory, for example a large number of intermediate fileswill be generated which are not part of the code repository. On a commit CVS willreport the existence of each of these files, unless they are specified in cvsignore. 25
  32. 32. Configuration Management with CVScvswrappersThis file allows default options for CVS file operations to be specified. The lines in thisfile contain a shell style pattern defining a file type followed by the keyword substitutionswitch –k and the options required, or the update method switch –m. followed by thekeywords MERGE or COPY.An example of keyword substitution is:*.doc –k ‘b’which will cause all files ending with the extension doc to be treated as binary files,preventing keyword expansion and newline conversion. if –m COPY is given, then noattempt will be made to merge files where a conflict exists, rather the developer mustchoose one file or the other, or resolve the conflict manually.The switches –t and –f may be used to specify to and from filters respectively.historyThis file, if it exists, is used to record activity against the repository, which may bedisplayed with the CVS history command. the recording of activity may be turned off byremoving this file.loginfoThe loginfo file follows the format of the commitinfo file, including the special matchingstrings ALL and DEFAULT. This file is used to process commit log messages, anyprogram specified receiving the log message as an argument, and the special values s, Vand v representing the filename, pre-commit version and post-commit version ifspecified. These arguments are specified by using the % character, for example %s. Ifmultiple parameters are to be passed, they must be specified in curly brackets. Thus theloginfo line:ANY mail –s %{sVv} developers@hostnamewill present sendmail with arguments:/usr/local/cvs/project file1,1.6,1.7 file2,4.1,4.2 …the final three arguments being repeated for each file in the log message.modulesThe modules file allows parts of the code repository to be referred to by more simplenames. The file contains lines of the form:<module name> <options> <directory> <files> …Three types of command are available:Alias Modules26
  33. 33. The RepositoryThis is the simplest form of command and simply refers to the set of files defined by thedirectory by a symbolic name. The command:drivers –a serial floppywill cause a checkout or commit using the alias drivers to operate on the files in thedirectories serial and floppy. Any intermediate directories in the specified paths areprocessed. An alias module may exclude directories by preceding their names with the“!” character.Regular ModulesThe command:<module name> [options] <directory> [files]will cause all operations on <module name> to process the files and directoriesspecified, but any intermediate directories in the path specified will be ignored, and thefiles will be stored under the directory <module name>. If files are specified, only thosefiles listed will be operated on.Modules can refer to other modules by preceding the module name with an ampersand:<module name> [options] &<module1> &<module2> …will process CVS commands referring to <module name> and produce a tree of thespecified modules under the directory <module name>.Options available with the last two constructs are:-d <name> override the default working directory with name-e <program> run this program when files are exported from the module-i <program> > run this program when files are committed to the module-t <program> > run this program when files are tagged in the module with rtag (but nottag)-u <program> > run this program when files are updated in the module’s top-leveldirectory-s <status> Assign a status to the module-l causes the top level only of a directory to be acted on.The e, and i options pass the module name to the program as an argument, while the uand i options passes the full path to the module within the repository. The t option passesboth the module name and the symbolic tagnotifyCVS provides a facility to watch the actions performed on a file or set of files. When anoperation is taken on a watched file, the notify file is consulted to decide on the action totake. Each line in the notify file contains a regular expression to match a filenamefollowed by a command to execute. In the command the special variable %s specifies theuser watching the file. The system then looks up the value in the users file. The defaultfile contains the command:ALL mail %s –s “CVS notification” 27
  34. 34. Configuration Management with CVS(although it is commented out).rcsinfoWhen a commit or import is actioned, CVS uses this file to determine the log messageeditor template to use. Each line in the file is a regular expression to match the moduledirectory, followed by the file to use as a template. the patterns ALL and DEFAULT aresupported. The message editor template is a text prototype which is displayed initially inthe log message entry box.taginfoWhen tag or rtag commands are executed, CVS searches this file for a pattern match onthe module directory, and executes the selected program or script. The special patternALL is also recognised. The program is called with the tag, the operation beingperformed (add for tag, del for tag –d and mov for tag –f), the module directory, and thefilename and version number for each file being tagged. The operation is aborted if anon-zero return code is given.verifymsgThis file determines whether log messages should be validated. The special patternDEFAULT is supported, but ALL is not. The file determines the script or program whichchecks for the correct content of the log message. The program is called with a full pathto a file containing the full log message. An example is given in the CVS distribution, ofa script which checks that a Bug ID has been entered in the correct format. If the scriptexits with a non-zero return code the operation is aborted.#!/bin/sh## bugid.verify filename## Verify that the log message contains a valid bugid# on the first line.#if head -1 < $1 | grep ^BugId:[ ]*[0-9][0-9]*$ > /dev/null; then exit 0else echo "No BugId found." exit 1fipasswd (not created by default)The security offered by CVS, particularly when running the password server, is ratherweak, and to avoid compromising the users’ main login passwords it is common tospecify passwords solely for use with CVS. The format of the passwd fle is similar to a28
  35. 35. The RepositoryUnix password file, each entry specifying the username and password separated bycolons. A further argument allows an alias for the user to be specified for the pserverauthentication method, so many users in a group may run with a single CVS useridentity. An example file would be:anonymous:alice:12aswQHN5Fdedward:4ewHjf409jHt:cvsuserwilliam:7DFSe4l67G:cvsuserIn this example the user anonymous can access the repository without using a password(he should obviously be restricted to read-only access), while the users alice, edward andwilliam be allowed access via their passwords, but william and edward will both accessthe repository with the identity cvsuser. Passwords are encrypted in the standard Unixway, and may be pasted from a password file, or generated by a utility such as htpasswd.The pserver alias can also be used to allow groups of developers access only to theproject on which they are working. In the case below, two groups of developers wouldlogin to CVS by using the alias set up in the password file. Here bob and joe can accessproject1, as the repository is set up to allow access only to this alias, while wiliam andmary can only login as project2 for access to a separate project. The users project1 andproject2 must exist on the repository host. Although the alias is now used to login to cvs,actions are still recorded against the actual username, so the development can still betraced accurately.bob:2Q3c1Z:project1joe:A2cvER4:project1william:UYT65No:project2mary:5FRE3scD:project2readers (not created by default)This file can restrict certain users to read-only access of the repository. The format of thefile is a list of usernames, listed one per line.users (not created by default)The users file maps user names to their email addresses for notification messages, whentheir email location is not the server running CVS.writers (not created by default)Users listed in this file, if it exists will be granted read/write access to the repository. If,however a user is also listed in the readers file, the access will be restricted to read-only.If the writers file exists, any user not listed in it will be restricted to read access, eventhough they are not listed in the readers file. 29
  36. 36. Configuration Management with CVSeditinfoThis file may exist in the repository, but is now obsolete.Modifying the Repository FilesThe files in CVSROOT, with a few exceptions, should only be modified using CVSitself. The CVSROOT directory is different from other repository directories in that itcontains the archive files and also a working copy of the files. When a commit of theCVSROOT module is performed, CVS also checks out a new working copy of thechecked-in files. The message:cvs server Rebuilding administrative filesis displayed. The files passwd, users, readers and writers may be modified initiallydirectly, then added to the repository. They should be included in the administrative filelist by adding them to the checkoutlist file.How CVS Uses the CVSROOT FilesWhen running locally CVS will always have immediate access to the working copy ofthese files, but the most common use of CVS in all but the smallest developments will bein client/server mode. This means that various items of data stored in theseadministrative files need to be accessible on the client system. CVS achieves this bycreating a directory named CVS in each module that is checked out into the user’sworking area. It is important to understand this, as some of the information is simplycopied when a module is checked out, and if changed subsequently, will not change onthe client system until the module is checked out again. The CVS directory containsseveral files, the most important ones being:BaseIf a file is being watched the original copy of the file is stored in Base, so that an uneditcommand can restore the original file in the user’s working directory, even if the clientcannot communicate with the server.BaserevHolds the revision number for the files stored in base in the format:B<filename>/<revision>/<reserved field>The file Baserev,tmp may also appear during update of the Baserev file.EntriesThis file contains a list of the files and subdirectories in the working directory. there aretwo types of entry, those starting with the ‘/’ character which specify a file, and entries30
  37. 37. The Repositorystarting with D which specify subdirectories. A single entry starting with D andcontaining no information indicates that the working directory contains nosubdirectories.The format of a file entry is:/name/revision/timestamp[+conflict]/options/tagdateThe optional conflict field indicates the time when the file was written with a conflictmarker. The options field records any sticky options associated with the file, for examplethat the file is treated as a binary file, and the tagdate gives the sticky date or tag namepreceded by D or T.Although the file is maintained automatically by CVS the contents can be useful toidentify the last revisions of files, and whether a file has been updated since checkout.Entries.LogThis provides a method of modifying the information in the Entries file withoutmodifying it directly. The system, whenever it refers to the Entries file also takesaccount of any updates in the Entries.Log file. The format of commands in the file is thecharacter A (for add) or R (for remove) followed by a space and a line in the sameformat as the Entries file. By convention a program processing the Enries file shouldread the file, check for the existence of Entries.Log, apply the changes and deleteEntries.Log.Entries.BackupA temporary file used when updating the Entries file. The system writes the new Entriesfile to Entries.Backup, then deletes the Entries file and renames Entries.Backup.Entries.StaticIf this file exists it indicates that only parrt of a module or subdirectory was checked out.CVS cannot create files in this directory, as it cannot check for the existence of the file inthe repository. Updating the working directory to include all the files causes the file to bedeleted.NotifyNotify stores notifications required by watches which have not yet been sent to theserver. The file Notify.tmp may also appear during update of this file.RootContains the location of the root of the CVS repository. 31
  38. 38. Configuration Management with CVSRepositoryContains the directory within the repository from which the current directory waschecked out. The path may be absolute, or relative to the repository root.Checkin.prog Update.progA local copy of the names of the programs to run on checkin and update.TagContains any sticky tags or dates for the directory in question. Branch tags are markedwith a T, non-branch tags with an N, and dates with a D. where individual files havesticky tags these override the tags in the Tag file.TemplateThe template for log messages.Hanging LocksAlthough CVS normally does not lock files on checkout, allowing multiple users to workon a file simultaneously, it does lock the files in order to ensure the atomicity ofcommands. It does this by placing files with names starting with #cvs.rfl, #cvs.wfl and#cvs.lock (for read lock, write lock and a lock of the whole directory respectively) in thedirectories being operated on. When CVS has a lock, some operations may have to wait.CVS will retry the operation every 30 seconds, until it succeeds, but a power failure orother system crash may leave locks present in the repository, and these may have to beremoved by hand.32
  39. 39. The User Environment 5 The User EnvironmentWhether CVS is run locally or in one of the client/server modes, there are somerequirements for the user environment, and further enhancements which can make use ofCVS easier. Each user requires a working directory (frequently called a sandbox in CVSterms) to which the modules under development may be checked out. Although anydirectory could be used, there are some files which can be set up in the sandbox tocontrol the operation of CVS..cvsignoreThis files specifies files to be ignored by CVS, and is normally used to ignore the resultsof compilation such as object and any other intermediate files. Although these files maybe specified in the CVSROOT directory of the repository, they can also be specified inthe user’s home directory, and in individual directories in the working area. Thespecifications in .cvsignore in the home directory are global, but .cvsignore files inindividual directories are only valid for the directory containing the .cvsignore file.These definitions are added to definitions in the repository and the environment variableCVSIGNORE. Placing a ‘!’ character in a .cvsignore file resets the file list, and can beuseful for storing a file of a type which is normally ignored..cvswrappersMay contain sticky options for files which are not specified in the repositorycvswrappers file. 33
  40. 40. Configuration Management with CVSEnvironment VariablesThe environment in which the CVS client runs can be set up to simplify the interfacewith CVS. The following are the principal variables relevant to the client. A completelist of environment variables for both client and server is given in Appendix BCVSROOTThis defines the location of the root of the repository in the form of a connect string suchas::pserver:username@hostname:<repository root directory>The possible connection methods are shown in Table 3. Connection Method Descriptionlocal Use cvs in local modepserver Password server modegserver GSSAPIkserver Kerberos 4fork Emulate client/server in local modeserver Server accessed by internal rsh program (only available in some implementations)ext Server accessed by rsh or ssh Table 3 Connection MethodsAlthough setting up this variable saves typing, the CVS system records the location ofthe repository when a module is checked out, so the string normally is only needed once,after which it is supplied automatically if not overridden.CVSEDITORThis specifies the editor to be used for recording log messages during the commitoperation. It overrides the EDITOR variable, which is used if CVSEDITOR is not set.CVS_RSHThe program used to connect to CVS when using the ext connection mode is specifiedby this variable. Usually it will be rsh or ssh.CVS_SERVERWhen connecting with the ext, server or fork methods this specifies the remote programto run, together with any arguments. The default is cvs.34
  41. 41. The User EnvironmentCVS_PASSFILEAfter a successful verification of the user by the server, the username, connected host,repository and password are recorded for future transactions until logout, when theinformation is deleted. The passwords are weakly encrypted. This data is stored bydefault in $HOME/.cvspass, but this environment variable may be used to change thelocation.~/.cvsrcDefault options for CVS commands may be specified in the .cshrc file in the user’s homedirectory. The format of this file is a CVS command, followed by switches which areprepended to the list of switches supplied on the command line. Note that the full nameof the command is searched for, even if the command is invoked using an abbreviatedform. The file might contain lines such as:log –Nupdate –pDGlobal options to cvs may be specified using cvs as the command:cvs –qThe –f switch to cvs will prevent the file .cvsrc from being read, thus a command can beexecuted without the default options if required. 35
  42. 42. Format of CVS Commands 6 Format of CVS CommandsThe general format of a CVS command is:cvs [global options] command [command options] [arguments]The global options are valid for almost all commands, such as the –n switch whichcauses CVS to go through the motions of executing the command, but withoutmodifying any files. The command options vary in their action for each command, andthe commands take different types and numbers of arguments.The status of the action requested from CVS may be tested by examining the exit codereturned. A zero indicates success, while any other number indicates failure.RevisionsEach change to a file committed to the repository is identified by a revision number,which is in the form of an even number of numbers separated by dots. Valid examplesare 1.1, 4,6, 2.1.1.5. Generally a new file added to the repository starts off with revision1.1, but if higher revision numbers exist, the first number will be set at the highest firstdigit of a revision number in that directory. Branches are identified by having furtherpairs of digits appended to the trunk revision number. Revision number can be set by theuser on commit operations, and the CVS system updates revision numbers automaticallyby incrementing the rightmost digit. In general the revision number of a file is usuallyignored, tags being used to identify sets of files which form a release or other importantmilestone. 37
  43. 43. Configuration Management with CVSTagsSets of files which form a release are tagged with a symbolic label, and can be retrievedor exported by use of this label. In fact there are two tag types available, a vendor tagand a release tag. Multiple tags can be assigned to the same version of a file.Two tags are predefined, and have a special meaning, BASE and HEAD, and arereserved for CVS use.BASE refers to the revision on the current branch which was last checked out, updated,or committed. Until the file is modified BASE is the committed revision matching itHEAD refers to the latest revision on the current branch in the Repository38
  44. 44. Setting up the Repository 7 Setting up the RepositoryIn many cases there will be a significant code base to be stored under CVS, and itsstructure will already have been determined and build systems orientated around thisstructure. In this case it is sensible to import the code directly into a CVS repository.However it is worthwhile first examining the types of file involved to determine whetherspecial treatment of some files is required. The cvswrappers file should be set up to dealwith any binary files, or any files which cannot have keywords expanded or any line endtranslations made. For existing code the import command is used to load the repository:cvs import –m “Initial import” <module name> <vendor tag> <release tag>will load the current directory into the repository as <module name>. By default cvsworks recursively, so all subdirectories will also be imported. This behaviour can bemodified by the –R and –l switches, which turn recursion on and off respectively. In thecommand above the –m switch specifies the log message, which prevents the logmessage editor from being run, and the vendor and release tags are probably not neededin this case, but must be specified.An import is always made to the vendor branch, which by default is the branch 1.1.1,and the vendor tag specified is added to the branch, as is the release tag. If a subsequentimport command specifies a new vendor tag this will merely be added to the samedefault branch – a new branch will not be created. CVS is designed to support only asingle vendor branch, although there is a method of introducing multiple vendorbranches manually (see Revisions, Releases and Branches).When a file is retrieved from the repository after an import the system looks for the headrevision, which will at first be located in the vendor branch, and will be checked out with 39
  45. 45. Configuration Management with CVSthe revision number 1.1.1.1. When the modified file is written back to the repository itwill be stored in the main trunk and receive the revision number 1.1. Subsequentcheckouts will retrieve the latest revision of a file, from the trunk if it has been modified,or from the vendor branch if it is still in its imported state.To check what will happen when this command is run, but take no action on therepository the global flag –n can be used. This is useful to see whether CVS detects anyerrors, and to check what files are imported. A section of the output from the admincommand is shown below:cvsdmin@oppenheimer:/usr/src/cvs/cvs-1.11.1p1> cvs -n import -m "Import" cvssourcesmlc ImportN cvssources/FAQN cvssources/BUGSN cvssources/NEWSN cvssources/TODON cvssources/depcompI cvssources/MakefileN cvssources/TESTSN cvssources/aclocal.m4I cvssources/config.statusN cvssources/cvs.spec.inN cvssources/COPYING.LIBN cvssources/DEVEL-CVSN cvssources/READMEN cvssources/configureN cvssources/configure.inN cvssources/cvs-format.elN cvssources/cvsnt.dspN cvssources/cvsnt.dswN cvssources/cvsnt.makI cvssources/config.cacheN cvssources/PROJECTSN cvssources/install-shI cvssources/config.logHere the command is reporting the files imported (which are all marked N for new),together with the files ignored because their filename was matched in a .cvsignore file.Other possible status values are L for a symbolic link, which is ignored, U and C whichindicate files already in the repository which are unchanged (U), or changed from therepository version (C). If a file is marked as changed, a merge may be required.Having imported the code, some attention may be required to the modules file. If usersare likely to work on subdirectories within the imported code, and there is norequirement to check out all the code for the project, giving the subdirectories modulenames or aliases in the modules file may be useful.40

×