gnu-arch-users
[Top][All Lists]
Advanced

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

[Gnu-arch-users] "Server"-side commit hooks


From: Andrew Suffield
Subject: [Gnu-arch-users] "Server"-side commit hooks
Date: Mon, 7 Jun 2004 22:58:06 +0100
User-agent: Mutt/1.5.6+20040523i

Something I cooked up in a spare hour:

address@hidden/arch-trigger--main--0

Config file is either ~/.arch-trigger/triggers or passed as the first
argument, and looks like this:

address@hidden/tla-bugs--asuffield--0    mail    tla cat-archive-log 
$ARCH_ARCHIVE/$ARCH_REVISION | mail asuffield -s "New commit in $ARCH_REVISION"

(also accepts cron-style environment variable definitions)

The first argument is the thing to watch, the second is a name for the
trigger, the third is the command to run. For each name, and for each
changeset which hasn't been triggered for that name, the command is
run with $ARCH_ARCHIVE and $ARCH_REVISION set like the tla hooks do.

For each invocation of arch-trigger, 'tla revisions' is run for every
unique version provided. The command is run once for every 'new'
revision in the list. If the command returns success, it will not be
run again for this (revision,name). If the command returns non-zero,
processing stops, and the command *will* be run again next time
arch-trigger is invoked.

I suggest running it from a user crontab, like this:

*/5 * * * * arch-trigger

For real time response, write a little daemon that works like cron,
but monitors files and directories with fam and runs a command when
they change (I don't believe such a thing exists yet). arch-trigger
should be safe against concurrent execution (locks the config file
while it's running).

The purpose of the "name" field is so that you can have multiple
commands, and change the commands without losing state. State is
stored in the directory ~/.arch-trigger/state, or in
$ARCH_TRIGGER_STATE.

Note that the archive doesn't have to be local, but you don't really
want to run it on things for which 'tla revisions' would take a long
time. It does have to be registered.

'tla archive-snapshot' proved to be completely useless for doing
this. This is the interface I find I want, and it was easier to
implement by hand, using only {valid,parse}-package-name and
revisions.

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature


reply via email to

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