CVS Auto-updating is a blog post on how to get CVS to manage auto updating when working with a web server or a local repository. Nothing fancy, but it works. Here is another option (releated to KDE management) for auto updating:
commit mails are sent, and in that user, set up .procmailrc like:0:kdecvs.lck
| $HOME/bin/kdecvslogwhere kdecvslog is a script like:========================
#!/usr/bin/perl -wmy $subj;
umask 022;
$ENV{“CVS_RSH”} = “ssh”;
# read the message to make procmail happy
while()
{
chop;
$subj = $1 if(/^Subject: (.*)/i and !defined($subj));
}
exit 0 if (!defined($subj));
exit 0 if ($subj =~ /\/\.\.\//);
$subj = $1 if ($subj =~ /^\S+: (.*)$/); # remove branches
$subj = $1 if ($subj =~ /^(\S+).*$/);
# Choose here which subjects to filter upon. Another solution is to filter
# in .procmailrc of course
if ( $subj =~ m#www/areas/koffice# || $subj =~ m#www/media# )
{
my $home = $ENV{“HOME”};
my $cvsroot = “$home/koffice.org”;
open LOG, “>>$home/cvslog”;
my $date = `date`; chop($date);
my $path = “$subj”;
if ( $subj =~ m#www/media# ) {
$path = “$cvsroot”;
} else {
$path = $subj;
$path =~ s#www/areas/koffice##;
$path = “$cvsroot/$path”;
}
print LOG “$date: subj is $subj\n”;
print LOG “$date: testing path $path\n”;
#print LOG “$date: mod is $mod\n”;
$path = “$cvsroot” if (! -d $path);
if (-d $path) {
print LOG “$date: updating $path\n”;
$SIG{ALRM} = sub { $SIG{TERM} = sub{}; kill TERM, 0; exit 0; };
alarm 600;
my $out = `cd $path; svn up 2>&1`; ## use cvs up here instead of svn up if you use CVS
print LOG “$date: output–\n” . $out . “\n”;
}
close(LOG);
}
Thanks to David Faure for the script.