[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: central up-to-date files

From: David Dunbar
Subject: RE: central up-to-date files
Date: Thu, 27 Sep 2001 09:12:48 -0500

Josh Baudhuin wrote:

The documentation describes one way of doing this in the  loginfo
section in one of the appendices, I believe.

-----Original Message-----
Varia, Meghal wrote:

I was wondering if there was a way to automatically maintain a location
that always has the most up-to-date copy of a file checked into CVS.
Thus, any change that is made to this file is automatically reflected in
this central location.
We used to use the loginfo script to update a copy of the master source.
It worked but had a problem. When several commits were done in rapid
sequence we would get lock contentions that would hang the process and
require manual intervention.

Our current process uses the commitinfo script and a chron job. Our
cvsroot has two directories CVSROOT and src. The commitinfo file has one
noncomment line: 

src $CVSROOT/CVSROOT/testcvs

testcvs has one line: 

(cd $CVSROOT/CVSROOT; rm -f needupdate; touch needupdate; chmod 666

$CVSROOT is replaced by the actual path in the above. The rm and chmod
were needed for file permission issues. The needupdate file is just a
flag for the chron job.

The chron job is a Perl script: 

#!/bin/perl -w  
# check for updates to cvsroot/src and update the master 
# source

use strict; 

my ($lst, $flagfile, $cvsroot, $master); 

# leave the "s in the next two lines
$cvsroot = "actual path to cvsroot"; 
$master  = "actual path to master source"; 
$flagfile = $cvsroot . '/CVSROOT/needupdate'; 

# In the following $? is the return code from the previous
# `command`. 
# $! is the system error message. 

if (-e $flagfile) # if the file exists
  `rm $flagfile`; # clear the flag
  if ($? > 0) { die "Can't delete $flagfile. $! $?\n"; } 
  chdir "$master" or die "Can't cd to master source. $! $?\n"; 
  `/opt/local/bin/cvs -d $cvsroot -q -r update -d -A`; 
  if ($? > 0) { die "Update failed: $! $?\n"; } 

The chron job runs every 15 minutes as me so I get the infrequent error

With our old process I would have to clear the hangs anywhere from once
a week to three times an hour. With the current process we haven't had a

David M. Dunbar <address@hidden>
Very funny, Scottie. Now beam down my clothes.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]