CVS auto-update of my Web site

Replies:

  • None.

Parents:

  • None.

--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

My entire site is under CVS.

I used to do a CVS update in the main checked out space on every file
I would update, which was obviously tedious.

I have decided to write a script to do that automatically. Gerald does
it with a mail notification system. Since my CVS repository and my
server are on the same machine, I thought this solution was somewhat
heavy.

I therefore wrote a short Perl script to do that, which I am archiving
here because I couldn't find one online. I had to struggle a little
with locks, but now everything works.

You just have to copy the two attached files (loginfo and
auto-checkout) to your CVSROOT directory. You will need to edit
auto-checkout to customize it.

--
Hugo Haas <[email protected]> - http://larve.net/people/hugo/
I met a devil named Buena Buena.

--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=loginfo

# The "loginfo" file controls where "cvs commit" log information
# is sent.  The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT.  If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter.  The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators.  The format
# characters are:
#
#   s = file name
#   V = old version number (pre-checkin)
#   v = new version number (post-checkin)
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog

^htdocs/ (sleep 1 && $CVSROOT/CVSROOT/auto-checkout %s) &

--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=auto-checkout

#! /usr/bin/perl -w

my $CHECKOUT_SPACE = '/u/hugo/www.larve.net';
my $CVSROOT = '/u/hugo/larve.net';
my $CVS = '/usr/bin/cvs';

chdir($CHECKOUT_SPACE)
   || die "Could not change directory to $CHECKOUT_SPACE: $!";

my ($dir, @files) = split(/ /, $ARGV[0]);

if ($ARGV[0] =~ m/ - New directory/) {
   system("$CVS get $dir");
   exit(0);
}

if (! -d $dir) {
   system("$CVS get $dir");
}

my $f;
my $arguments;
foreach $f (@files) {
   $arguments .= " $dir/$f";
}

system("$CVS -d $CVSROOT get$arguments");

--/04w6evG8XlLl3ft--

HURL: fogo mailing list archives, maintained by Gerald Oskoboiny