[Twisted-Python] Fresh CVS hooker

Kevin Turner acapnotic at twistedmatrix.com
Wed Oct 17 14:51:11 EDT 2001

So I was reading the CVS docs where it says 
> Doing so in the naive way will cause a problem with locks,
> so the `cvs update' must be run in the background.  Here is
> an example for unix (this should all be on one line):
> ^cyclic-pages              (date; cat; (sleep 2; cd /u/www/local-docs; cvs -q update -d) &) >> $CVSROOT/CVSROOT/updatelog 2>&1

and the kluge repulsion seized ahold of some delerium and possesed me to
write an, uh, non-naive CVS loginfo thingie.

The result is in 
http://twistedmatrix.com/users/acapnotic/mycvs/cvstoys/ , or
~acapnotic/co-me/cvstoys for those of you on the inside.

the primary advantage of this is that it doesn't anywhere say "sleep 2"
(it hides that behind a Delayed instead =), but whereas CVSROOT/loginfo
will only run the first matching command it finds, my cvs fresher can
unleash an entire horde of actions.  And it can provide a PB service, if
you're into that sort of thing.

It hasn't undergone trial-by-fire yet, but it seems to be working so
far.  There is one bit left undone, though: the commit notification
e-mails don't get sent, and I can't figure why.  (Please cast your
eyeballs upon cvstoys/actions.py:MailCommand and see if you can
strighten me out.)

Potential uses:

*) can keep a checked-out directory up-to-date at all times.  i.e. have a
/twisted/cvsTwisted/ directory that would always contain the
bleeding-edge version.  Or have changes show up in /var/www as soon
as they're checked in.

*) could let a bleeding-edge Twisted server know when the source has
changed, in case it wants to trigger a twisted.python.rebuild.  

*) Could keep a tarball snapshot up to date (although you'd probably
want to be a little cautious about how often you decide to bz2 it, as
that takes some considerable resources).

*) could keep a mirror (i.e. coopweb) or off-site back-up up to date by
pushing over rsync.

*) could do the email-commit-notification thing (if we get that bug
ironed out), although admittedly I don't have any real complaints with
the syncmail script we're using now.

*) could run Teud to keep the docs fresh.

*) could notify perspectives signed into it when a check-in occours.
Using epb.el, one could potentially have your emacs run its
version-control-update thing to update your buffers whenever someone
else checks in a new revisions.  This sounds cracktackulous, but I'm not
sure it's really a good idea.

*) could run unit tests and send mail to you (and/or everyone else) if
you screwed something up.

and, um, stuff.  There you have it.  If you want to play with it, put a
'freshCfg' configuration file (like the one in actions.__doc__) in
CVSROOT, check in the freshCfg file and add it to CVSROOT/checkoutlist,
have CVSROOT/loginfo run loginfo.py %{sSv}, start the server by running
fresher.py, and there you go.  (Hmm.  will have to automate some of
that.)  I'll package it shortly after the mail notification starts
working.  oops, better go add the un-copyright notices now.

"and-that's-how-I-replaced-one-line-of-shell-code-with-a-thousand-in-Python"-ly yours,
  - Kevin

Kevin Turner <acapnotic at twistedmatrix.com> | OpenPGP encryption welcome here
The moon is waxing crescent, 0.6% illuminated, 0.8 days old.

More information about the Twisted-Python mailing list