NERSCPowering Scientific Discovery Since 1974

CVS

Prerequisites

In order to create CVS repositories on the NERSC Global File System (NGF) a user must first have a project directory. After the project directory is setup then access to the directory can be controlled in the NERSC Information Management system (NIM) by the project's pricipal investigator (PI). Users who create repositories must have write access to the project directory. Once the user has a project directory, then the CVS repository can be created under that project directory. For example, a valid repository path would be something like: /project/projectdirs/MyProjectDirectory/MyCVSRepo.

Subversion and CVS repositories can be made available via the web using a software package called ViewVC. The recommended version of ViewVC can be found in the section below (Viewing Repositories Over the Web: Using ViewVC).

The following instructions assume you have setup a project directory on NGF and have write access. References to the project path are identified with the <project> tag and the repository type identified with the <cvs_repository_name>, <svn_repository_name>, or <git_repository_name> tag below.

Creating a CVS Repository on NGF

Create the repository in your project directory or subdirectory. Enter the entire path of your repository. You may find keeping your repos in a specific directory is a useful way to keep track of them.

cvs -d /<cvs_repository_path>/<cvs_repository_name> init

Add the CVSROOT variable to your environment. Unless there are any issues then it is best to make the setting persistent by adding it to your '.profile.ext' file in your home directory.

csh:

setenv CVSROOT /<cvs_repository_path>/<cvs_repository_name>

bash,sh,ksh:

export CVSROOT=/<cvs_repository_path>/<cvs_repository_name>

Any directories and files created in the repository should inherit the group membership of the directory. If you set the group "setgid" bit on the repository directory then new files and directories created subsequently in that directory will "inherit" that group membership, though not its permission bit settings. Perhaps your project directory already has this, in which case the command below is not necessary (though it is harmless, if so).

chmod -R g+srwx /<cvs_repository_path>/<cvs_repository_name>

Add your project directories and files to the repository. Directions for adding directories or files to CVS can be found below. Be sure to commit your changes after adding directories and files to your repository.

  • Adding files to CVS from NGF

    Any files added to CVS from NGF should be done using portal-auth.nersc.gov. After you login then you can follow the basic instructions below for adding files to your CVS repo. If you have an existing project then the simplest way to get started with CVS is to import your local project directory into the CVS repo you previously created. An example has been provided to you below.

    cd /project/projectdirs/<project>/<project_name>
    cvs import <project_directory> <vendor_tag> <release_tag> -m "initial import"

    Files and directories can be added to the CVS repo using the following set of commands and options provided in the following link:

  • Adding files to CVS remotely

    Setting the CVS_RSH and CVSROOT variable may be necessary if it's not already set to use ssh:

    bash:

    CVS_RSH=ssh; export CVS_RSH
    CVSROOT=/project/projectdirs/<project>/<cvs_repository_path>/<cvs_repository_name>; export CVSROOT

    csh:

      setenv CVS_RSH `ssh`
    setenv CVSROOT /project/projectdirs/<project>/<cvs_repository_path>/<cvs_repository_name>

    Importing your initial version can be done using authenticated access to CVS. A "vendor tag" and "release tag" are required when doing an import. The "vendor tag" is a text string for the software vendor and the "release tag" is the release of the software you're importing into CVS. Keep the names simple since they are a point of reference for the initial import. Also, remember to avoid importing any directories containing subdirectories that are a result of a CVS checkout. Doing so can lead to wasted time trying to clean up the repository down the line. An example has been provided below.

    cvs -d :ext:<nim_user_name>@portal-auth.nersc.gov:/project/projectdirs/<cvs_repository_path>/<cvs_repository_name> import ./<local_project_directory> <vendor_tag> <release_tag> -m "initial import"

    You will need to checkout a new copy for your revisions to be saved in your CVS repo. After you have a local copy of the repo then you can add/commit files as usual.

    cvs -d :ext:<nim_user_name>@portal-auth.nersc.gov:/project/projectdirs/<cvs_repository_path>/<cvs_repository_name> co <cvs_repository_directory>
    cd /<local_project_directory>/<local_name>
    cvs add myfile
    cvs commit myfile -m "initial version"

 

Receiving notifications when commits are made

If the "loginfo" file in your project's CVSROOT directory has not already been updated with the template then you will first have to copy the template to the CVSROOT directory.

cp -f /project/projectdirs/sgn/software/usg/cvs/scripts/loginfo /project/projectdirs/<project>/<cvs_repository_path>/<cvs_repository_name>/CVSROOT/.
cd /project/projectdirs/<project>/<cvs_repository_path>/<cvs_repository_name>/CVSROOT

Grant read and execute for the cvs script to run when commits are made to the repo:

chmod o+rx loginfo

Edit the "loginfo" file in the project's CVSROOT directory and change the sample list of email addresses near the bottom of the page to those who should receive notifications. Make sure the email addresses are comma separated. None of the other information should be changed. Save the file and test it out by commiting changes to an existing file or adding a new file to the repo and committing the changes.

Read-only public access via HTTP

HTTP read-only access to CVS is not available from the command line. Read-only http access to CVS is only through ViewVC.

 

Authenticated access using ssh

Setting the CVS_RSH and CVSROOT variable may be necessary if it's not already set to use ssh:

bash:

CVS_RSH=ssh; export CVS_RSH
CVSROOT=/project/projectdirs/<project>/<cvs_repository_path>/<cvs_repository_name>

csh:

setenv CVS_RSH `ssh`
setenv CVSROOT /project/projectdirs/<project>/<cvs_repository_path>/<cvs_repository_name>

Doing a remote check-out from a CVS repository on NGF via SSH can be done using:

cvs -d  :ext:<username>@portal-auth.nersc.gov:/project/projectdirs/<cvs_repository_path>/<cvs_repository_name>  co <local_name>

Viewing Repositories Over the Web: Using ViewVC

Configuring ViewVC

  • Get the ViewVC 1.1.6 source release into your home directory. 

    cp /project/projectdirs/osp/viewvc/viewvc-1.1.6.tar.gz .
  • Extract ViewVC into your home directory.
    tar -xvf viewvc-1.1.6.tar.gz
  • Change to the ViewVC directory.
    cd viewvc-1.1.6
  • Run ViewVC installer (viewvc-install).
    ./viewvc-install

    When you are prompted for the installation path, enter the local path instead of the system-wide path.

    Installation path [/usr/local/viewvc-1.1.6]: <full-installation-path>
  • Edit ./viewvc-1.1.6/viewvc.conf and configure the following variables so your repos are recognized by ViewVC.

    • Set "cvs_roots" configuration variable to base of a cvs repo. A "name:path" value should be given for each root to resolve the name and path to the CVS root. Multiple roots can be specified by commas.

      Example:

      cvs_roots = myCVSRepoName: /project/projectdirs/<project_name>/<cvs_repository_path>/<cvs_repository_name>,
      anotherCVSRepoName: /project/projectdirs/<project_name>/<cvs_repository_path>/<cvs_repository_name> 

    • Set "svn_roots" configuration variable to base path of svn repo. A "name:path" value should be given for each root to resolve the name and path to the CVS root. Multiple roots can be specified by commas.

      Example:

      svn_roots = mySVNRepoName: /project/projectdirs/<project_name>/<svn_repository_path>/<svn_repository_name>,
      anotherSVNRepoName: /project/projectdirs/<project_name>/<svn_repository_path>/<svn_repository_name>

    • Set the "allowed_views" variable to allow the following features: allowed_views=annotate,diff,markup,roots,tar,co. The variable may have to be uncommented in the viewvc.conf file. 
    • Set "hide_cvsroot=1"
    • Set "use_rcsparse=1"
  • Setting ACL permissions is necessary for Apache to access your local ViewVC copy. 

    setfacl -R -m u:apache:rx <viewvc_installation_directory>
  • Both read and execute permissions have to be granted to others in order for the files to be read via http. Apply the permissions to the CVS or SVN repositories being read by ViewVC.

    CVS:
    chmod -R o+rx /project/projectdirs/<project_name>/<cvs_repository_path>/<cvs_repositorryry_name>
    SVN:
    chmod -R o+rx /project/projectdirs/<project_name>/<svn_repository_path>/<svn_repository_name>

Follow these steps to place the ViewVC CGI script for http access. 

  • Create web directory for the cgi (python) script to read the cvs and svn repos (e.g., /project/projectdirs/<project>/www/<viewvc>. Be sure the directory resides inside of the "www" directory in order to be accessed.
  • Copy the viewvc.cgi script from "<viewvc_installation_directory>/bin/cgi/." to "/project/projectdirs/<project>/www/<viewvc>"
  • Grant execute permission to the cgi files.

Set permissions again. 

setfacl -R -m u:apache:rx /project/projectdirs/<project>/www/<viewvc>