11.2. CVSROOT FilesThe CVSROOT directory in the CVS repository contains several administrative files. Most of these files are editable by the user and are stored in both RCS format (with a ,v suffix) and plain text to be used by CVS. With three exceptions, these files can be checked out, edited, and committed like any other CVS file. The history and val-tags files should not be edited. The passwd file should never be checked out; it should be edited in place.
11.2.1. Scripting File SyntaxAs of CVS 1.12.6, the syntax for scripting files changed. If you're using an older version of CVS, please see Chapter 7 for information on the file syntax. If you have different versions of CVS in the repository and the clients, see Chapter 9 for advice on cross-version issues. In versions later than 1.12.6, whether you use the new or old format for the scripting files is controlled by the configuration option UseNewInfoFmtStrings. The valid options are yes (to use the new format) and no (to use the format prior to 1.12.6). These options are set in the config file, normally stored in the CVSROOT directory. The file syntax is as follows: name-pattern action The name-pattern is a regular expression that must match a relative path within the repository, or one of the special words DEFAULT and ALL. It is separated from the action by one or more spaces or tabs. Regular expressions are explained later in this chapter. The action is a command-line template, or the filename (and path) of a script plus any parameters required for that script. It is good practice to use the full pathname of the script, with the $CVSROOT variable standing in for the repository path. You may embed one or more format strings in the template or among the script's parameters; you may also use the variables listed later in this chapter, in the section "CVSROOT Variables." The character # at the start of a line signals a comment. Blank lines are ignored. There is no way to break a long line in current versions of CVS. CVS processes the file by matching the current repository directory to the regular expression. It looks for the first matching line, runs the action provided on that line, and also runs the actions on any line with a name-pattern of ALL. Note that DEFAULT as a name-pattern is deemed to match everything, so ensure that it is the last name-pattern other than ALL.
The format strings are processed by CVS before being passed to the action's script or command. Before processing, the format string consists of a %, followed by a single variable, optionally enclosed in braces ({ }), or by a set of variables enclosed in braces. Some of the variables represent individual values, and others represent list values. Each variable in a set of variables enclosed in braces must represent a list value. Each value represented by a format string variable is passed to its script as a single argument, irrespective of white space within the value. A list on its own is passed as a single argument for each element of the list. A set of list values is also passed as a single argument for each element of each list, but the values are collated. For instance, %{sVv} in the taginfo file will produce a list of arguments in the format file1 oldversion1 newversion1 file2 oldversion2 newversion2 file3 oldversion3 newversion3. The format string variables which are valid in all files represent single values, and are:
11.2.2. The checkoutlist FileThe checkoutlist file is used to designate files to be stored in the CVSROOT directory in both RCS and clear-text formats. Most of the CVS administrative files are stored this way automatically, and the checkoutlist file allows you to store user-created files in the same way. The most common files to be stored like this are scripts executed by the scripting files (commitinfo, loginfo, rcsinfo, taginfo, and verifymsg; and after CVS 1.12.10, postadmin, postproxy, posttag, postwatch, and preproxy). The file format is to list the names of the files, one file per line. All files must be in the CVSROOT directory. To display an error message if the file cannot be checked out into CVSROOT, add whitespace, followed by the message, to the line the file is listed on. See Example 11-1. Example 11-1. Adding whitespace to the message
11.2.3. The commitinfo FileThe commitinfo file defines programs to run before a file is committed. If any of the programs exit with a nonzero exit status, the commit does not proceed. These programs run on the repository computer. This file uses the standard scripting file syntax, and supports DEFAULT but not ALL. In addition to the usual format string variables, it allows s, a list variable containing the names of the files to be committed. For backwards compatibility, the format string %r/%p %{s} is appended to the action if there is no format string in the action. This behavior should not be relied on, as it will probably be removed in a later version of CVS. The commitinfo file is usually used to enforce project standards. 11.2.4. The config FileThe config file contains CVS configuration options. It is normally found in the CVSROOT, but from CVS 1.12.13, you can use the -c option to pserver or server to specify a different config path. Lines that start with a # are comments. All other lines are in the form: keyword=value There is one keyword/value pair per line. Each keyword/value pair represents a configuration option. Whitespace is significant, including carriage returns, tabs, and extra spaces. From CVS 1.12.13, as well as specifying which config path the repository should use, you can also define which repository (or repositories) specific configurations apply to. The first section of the file contains default configurations. Later sections are defined by a string of the form [repository-path] on a line of its own. Each section applies to the repository path that precedes it. Multiple repository paths with no intervening configurations cause the configurations that follow them to apply to all the relevant paths. Example 11-2 shows a configuration file. The comments explain which repositories are affected by which configurations. Example 11-2. Multirepository configuration file
These are the available configuration options:
11.2.5. The cvsignore FileThe cvsignore file contains a list of filenames or filename patterns that CVS should not process. The syntax for this file is a space-separated or line-ending-separated list of filenames or name patterns. cvsignore uses wildcard pattern matching. The special ! filename causes CVS to clear its ignore list. The special * filename causes CVS to ignore everything. See Chapter 6 for additional information. 11.2.6. The cvswrappers FileThe cvswrappers file contains a line-ending-separated list of wrappers that control the merge method or keyword-substitution mode of files, based on a filename pattern. The syntax of a wrapper is as follows: wildcard option 'value' [option 'value'...] The wildcards are matched to filenames when files are added to the repository. See Chapter 3 for more information. These are the options and values:
11.2.7. The editinfo FileThe editinfo file is obsolete; it has been replaced by verifymsg and rcsinfo, and removed as of CVS 1.12.2. In CVS versions that use editinfo, this file enforces the use of a specific editor when entering log messages. If CVS is called from a remote client, or if the -m or -F command options are used with cvs commit, the editinfo file is not used. If the editor exits with a nonzero exit status, the commit does not proceed. 11.2.8. The history FileThe history file contains the information displayed by the cvs history command. It must be writable by all CVS users and is created by cvs init to be owner-, group-, and world-writable. This file should not be edited manually; all changes should occur through CVS. If you wish to turn history logging off, a simple way to do so is to rename the history file. The file can also be removed or rotated like any logfile, with no effect on any CVS command other than cvs history. (If you do rotate the file, consider whether to lock the repository during the process of moving the file.)
11.2.9. The loginfo FileThe loginfo file defines programs to run when information is recorded in the repository. It runs once per directory in a commit, after the files in the directory have been successfully recorded. It also runs after a successful import, and after a directory has been successfully added to the repository. These programs run on the repository computer. This file uses the standard scripting file syntax, and supports both DEFAULT and ALL. In addition to the usual format string variables, it allows:
For backwards compatibility, if there is no UseNewFormatStrings setting in the configuration file, loginfo is processed the old way. This behavior should not be relied on, as it will probably be removed in a later version of CVS. See Chapter 7 for information on the old format. 11.2.10. The modules FileThe modules file is used to group arbitrary files or directories into a single module. Once a module is defined, the project files and directories it defines can be checked out into a sandbox by either the module name or the name of the repository directory it represents. The modules file can also specify programs to run when files in the module are committed, exported, updated, checked out, or tagged with rtag. Each module definition needs to be on a line of its own. When adding directories to module definitions, use paths relative to the repository root directory. An alias module can be used to group files and directories into a single module, regardless of where they are stored in the repository tree. The syntax for an alias module definition is as follows: module_name -a path [path...] A path may be a pathname to a file or directory or it may be another module name, and there may be any number of paths. If a path leads to a directory, all subdirectories and files are included in the module. If you wish to exclude subdirectories from an alias module, use an exclamation mark (!) in front of the directory name. A regular module is used to define options for a project. It can also be used to define subsets of a project or group modules together. The syntax of a regular module is as follows: module_name [options] [directory [files|subdirectories...]] [&modules...] The directory should be a path relative to the repository root directory. If filenames or subdirectory names are included, they should be in the directory, and the module definition then applies only to those files or subdirectories. You can include a predefined module in a regular module by prefixing the module name with an ampersand (&) and specifying the resulting name in place of directory in the syntax. The module can be a regular module or an alias module. Most of the options for a regular module define scripts to run immediately after a CVS command on the files in the module. Here is the full list of options for regular modules:
Each script designated in the modules file runs immediately after its associated CVS command completes. For example, the -o script runs after a checkout command for the module completes. If the repository is not on the same computer as the client, the scripts for the -i and -u options are copied from their original location in the repository to the client computer and stored in the Checkin.prog and Update.prog files in the CVS subdirectories in the sandbox. These scripts are later copied back to the server computer, where they run. For security reasons, this behavior is changed in CVS 1.11.6 and later. All other scripts called from the modules file run on the repository server computer. The sandbox copies of the Checkin.prog and Update.prog files are not changed when the modules file or the repository computer's copies of the scripts are changed. To change Checkin.prog and Update.prog, commit and release the sandbox and check out a new sandbox. (This step is not relevant if you're using 1.11.6 or later.) 11.2.11. The notify FileThe notify file contains the commands to run when conditions exist for cvs watch to notify a user of a change to a watched file. The syntax of the notify file is a series of lines, each line in the following format: filename_pattern command The filename_pattern can be ALL or any wildcard pattern. The command can be any sh shell command, but it must contain %s, which is replaced by the name of the user to notify. The rest of the notification information is provided to the command through standard input (stdin).
11.2.12. The passwd FileThe passwd file contains the usernames and passwords for the pserver repository method. This file is usually edited in place, not checked out like the other administrative files. If you wish to check it out, add it to the commitinfo file, but be aware of the security risks explained in Chapter 8. The format for entries in the passwd file is: CVS_username:password:system_username The CVS_username is the name the user sends to CVS. The system_username is the name the CVS programs run under. If these names are the same, you don't need to include the system_username. The system_username must be a valid username on the server; if the system_username does not exist on the server, CVS commands will fail even if the user authenticates with CVS. The passwords need to be encrypted with the standard Unix crypt( ) function. CVS does not provide a tool to encrypt passwords, so they need to be encrypted elsewhere and then pasted into the file. If the password field is empty, the user automatically authenticates. You can use the Unix and Linux program mkpasswd to encrypt a string for use as a password. A single system username can be shared by multiple users with different CVS usernames. This feature allows several people to work on a project, while recording the changes across multiple users. 11.2.13. The postadmin FileThe postadmin file defines programs to run after any cvs admin command that modifies a file is run. These programs run on the repository computer. This file uses the standard scripting file syntax, and supports both DEFAULT and ALL. 11.2.14. The postproxy FileThe postproxy file defines programs to run after a secondary server has completed a connection to a primary server, and before the secondary server releases the connection to the client. These programs run on the secondary server, and are called once per directory. It is recommended that the postproxy include a command to update the secondary server's copy of the repository. This file uses the standard scripting file syntax, and supports both DEFAULT and ALL. It has the additional format variable P, the repository path of the primary server. 11.2.15. The posttag FileThe posttag file defines programs to run after any cvs tag or rtag command that modifies a file is run. These programs run on the repository computer. This file uses the standard scripting file syntax, and supports both DEFAULT and ALL. It permits the same format string attributes as the taginfo file: see the section on the taginfo file for more information. 11.2.16. The postwatch FileThe postwatch file defines programs to run after any cvs watch, edit, or unedit command that modifies the repository's watch administrative file, fileattr. See Chapter 6 (specifically, information on fileattr) for more information on which commands are affected. These programs run on the repository computer. This file uses the standard scripting file syntax, and supports both DEFAULT and ALL. Note that edit and unedit do not always contact the server, and sometimes cache their notification to be run later. 11.2.17. The preproxy FileThe preproxy file defines programs to run before a secondary server connects to a primary server, and after the client has contacted the secondary server. These programs run on the secondary server, and are called once, from the top directory specified by the client's request. This file uses the standard scripting file syntax, and supports both DEFAULT and ALL. It has the additional format variable P, the repository path of the primary server. 11.2.18. The rcsinfo FileThe rcsinfo file defines forms to display as the templates for commit log messages. The rcsinfo file is processed before a file is committed. This file uses the standard scripting file syntax, and supports both DEFAULT and ALL. The action in the case of the rcsinfo file must be a pathname to a template file.
If the repository is not on the same computer as the client, CVS stores a copy of the template (or templates) that matches each sandbox directory in the appropriate CVS subdirectory of each sandbox. In versions prior to 1.12.1, this file is not updated with other sandbox files, so if the rcsinfo file or the main template changes, your users should release and recreate their sandboxes. (In 1.12.1 and later, the file is updated with the other sandbox files.) 11.2.19. The readers FileThe readers file contains the usernames of people who have read-only access to the repository via the pserver remote-access method. The readers and writers files use the CVS_username, not the system_username, to determine whether a user has access. The file should contain one name per line. The newline character after the last username is significant. If a user is listed in the readers file, he has read-only access to the repository, even if he is also listed in the writers file. 11.2.20. The taginfo FileThe taginfo file defines programs to run before a file is tagged. If any of the programs exit with a nonzero exit status, the tag does not proceed. This file uses the standard scripting file syntax, and supports both DEFAULT and ALL. In addition to the usual format string variables, it allows these:
For backwards compatibility, the format string %t %o %p %{sv} is appended to the action if there is no format string in the action. This behavior should not be relied on, as it will probably be removed in a later version of CVS. 11.2.21. The users FileThe users file provides a list of email addresses for users whose mailboxes are not on the same machine as the CVS repository. This file is used by the command given in the notify file, and it becomes the input represented by the %s string. The format of this file is a separate line for each user, consisting of the username and the email address to send notifications to, in the following format: username:email
11.2.22. The val-tags FileThe val-tags file contains a list of valid tag names, acting as an internal cache for CVS. It must be writable by all CVS users, and is created by cvs init to be owner- and group-writable. This file should not be edited manually; all changes should occur through CVS. 11.2.23. The verifymsg FileThe verifymsg file defines programs to run after a log message has been entered, but before the commit takes place. The programs are passed the log message, which they can modify or parse to ensure that all essential fields have been filled in. The verifymsg file is usually used with the rcsinfo file to manage log messages. If a program called from verifymsg exits with a nonzero error status, the commit is aborted. The file syntax for verifymsg is as follows: name_pattern action The name_pattern is a regular expression that must match a relative path within the repository. The action is a command-line template or the address of a script, plus any parameters required for that script or template. The log message is passed to the script or template on the standard input (stdin), as is the path to a temporary file containing the log message. Lines starting with the hash symbol (#) are comments and are ignored. The special DEFAULT pattern matches directories that do not match any other pattern. CVS uses the script on the first line with a directory-name pattern that matches the directory tree a file is in. A script invoked through verifymsg can modify the log message, and the config file in the CVSROOT directory then determines whether CVS reads and uses the modified log message or the original one for the rest of the commit process. 11.2.24. The writers FileThe writers file contains the usernames of people who have read-write access to the repository via the pserver remote-access method. The readers and writers files use the CVS username, not the system username, to determine whether a user has access. The file should contain one username per line. The newline character after the last user is significant. If a user is listed in the writers file but not the readers file, she has read-write access to the repository.
|