AXP Examples - triggers
axp triggers is a complete commit notification system, optimized for minimal archive access. Here is an example shell session, and a real-life mailer screenshot (text-based). All commands are valid for axp-0.2.1 or later.
% axp triggers add lord@emf.net--2005/tla--devo * trigger for lord@emf.net--2005/tla--devo is added
% axp triggers list 1. migo@homemail.com--archway-micro 2. schizo@debian.org--2004-primary/axp-debian--debian--0 3. migo@homemail.com--archway-micro/archway--main-gui 4. lord@emf.net--2005/tla--devo
% axp triggers edit 4 ... tweak action for lord@emf.net--2005/tla--devo in $EDITOR, rarely needed ...
% axp triggers delete 3 * trigger for migo@homemail.com--archway-micro/archway--main-gui is deleted
% axp triggers list --show-state 1. migo@homemail.com--archway-micro archway--main-gui--0--patch-35 archway--merge-gui--0--patch-30 archway--regst-gui--0--patch-16 2. schizo@debian.org--2004-primary/axp-debian--debian--0 axp-debian--debian--0--patch-7 3. lord@emf.net--2005/tla--devo tla--devo--1.3.1--patch-21 tla--devo--1.3.2--patch-6
% axp triggers process --help axp triggers process - check registered limits for new revisions Usage: axp triggers process [options] [limit ...] -h, --help display this help message and exit -t, --test dry run without triggering actions and recording new state -o, --output FILE log/append to FILE rather than stdout -s, --skip just skip all new revisions without triggering -l, --limits interpret no arguments as empty list of limits -v, --verbose be more verbose -q, --quiet be quiet Check all registered (or chosen) limits for new revisions and run the associated command for every new revision. If the command succeeds (email is sent), the new state is recorded and subsequent calls to 'process' will not report the revision again. This command is supposed to be run periodically from cron (use --quiet or --output options).
% axp triggers process * processing migo@homemail.com--archway-micro * triggering new revision migo@homemail.com--archway-micro/archway--main-gui--0--patch-36 * triggering new revision migo@homemail.com--archway-micro/archway--merge-gui--0--patch-31 * triggering new revision migo@homemail.com--archway-micro/archway--merge-gui--0--patch-32 * triggering new revision migo@homemail.com--archway-micro/archway--merge-gui--0--patch-33 * triggering new revision migo@homemail.com--archway-micro/archway--merge-gui--0--patch-34 * processing schizo@debian.org--2004-primary/axp-debian--debian--0 * processing lord@emf.net--2005/tla--devo
% axp triggers list --show-action --no-comments 1. migo@homemail.com--archway-micro axp changelog --use-log $LOG_FILE >>/tmp/changelog 2. schizo@debian.org--2004-primary/axp-debian--debian--0 (echo "$LOG_DATE $FULL_REVISION"; \ axp cset show --diffs $FULL_REVISION) >>/tmp/patches.txt 3. lord@emf.net--2005/tla--devo $AXP changelog --use-log $LOG_FILE \ | mail -s "[COMMIT $LOG_USERNAME $ARCH_REVISION] $LOG_SUMMARY" migo@localhost
% axp triggers add --master 3 lord@emf.net--2005/rel * slave trigger for lord@emf.net--2005/rel is added (shared action)
% axp triggers add -e migo@cpan.org,a@me.org -v SEND_PATCH=1 atai@atai.org--public/tla--atai * trigger for atai@atai.org--public/tla--atai is added
% axp triggers list 1. migo@homemail.com--archway-micro 2. schizo@debian.org--2004-primary/axp-debian--debian--0 3. lord@emf.net--2005/tla--devo 4. lord@emf.net--2005/rel (slave) 5. atai@atai.org--public/tla--atai
% axp triggers list -A -N 5 atai@atai.org--public/tla--atai tla--atai--1.3--patch-15 SEND_PATCH=1 #!/bin/sh # # Run on every atai@atai.org--public/tla--atai commit. # # The following special variables are available in this script: # $ARCH_ARCHIVE, $ARCH_REVISION (full non-archive revision), # $FULL_REVISION, $CATEGORY, $BRANCH, $VERSION, $REVISION, # $LOG_SUMMARY, $LOG_CREATOR, $LOG_EMAIL, $LOG_USERNAME, # $LOG_DATE, $LOG_KIND, $LOG_BODY, $LOG_TEXT, $LOG_FILE, # $AXP (/home/migo/bin/axp), $ARCH_BACKEND (tla). # # Other variables used here may be defined using a simple interface: # axp triggers edit --var EMAIL=my@list.org --var SEND_PATCH=1 limit # axp triggers list --show-vars # send ChangeLog formatted output unless directed otherwise if [ "$SEND_PLAINLOG $SEND_CHANGES $SEND_PATCH" = " " ]; then SEND_CHANGELOG=1 fi # use defaults for some variables if not set yet; # one quick way to disable mail sending is to comment out the next line : ${MAIL_S=mail -s} : ${MAIL_S=true} : ${EMAIL=migo@cpan.org,a@me.org} # actually send the mail with one or another output in the body ( [ "$SEND_CHANGELOG" ] && $AXP changelog --use-log $LOG_FILE [ "$SEND_PLAINLOG" ] && cat $LOG_FILE [ "$SEND_CHANGES" ] && $AXP cset show $FULL_REVISION [ "$SEND_PATCH" ] && $AXP cset show --diffs $FULL_REVISION [ "$ARCHZOOM_URL" ] && echo "" [ "$ARCHZOOM_URL" ] && echo "$ARCHZOOM_URL/$FULL_REVISION?log?expand" ) | $MAIL_S "[COMMIT $LOG_USERNAME $ARCH_REVISION] $LOG_SUMMARY" $EMAIL
Mutt: =New-Commits [Msgs:12 Post:427 Inc:1 25K] (threads) (66%) T 4 Apr 15 Enno Cramer (0.3K) [COMMIT enno arch-perl--devel--0--patch-55] Arch::Run framework T 5 Apr 15 Enno Cramer (0.5K) [COMMIT enno archway--tree-gui--0--patch-65] implement progress bar T 6 Apr 19 Enno Cramer (0.4K) [COMMIT enno archway--tree-gui--0--patch-66] archway-ssh-askpass T 7 Apr 20 Enno Cramer (0.2K) [COMMIT enno arch-perl--devel--0--patch-56] no permanent IO::Poll object in Arch::Run T 8 Apr 20 Enno Cramer (0.5K) [COMMIT enno archway--tree-gui--0--patch-67] fix run_tla for nested calls - 6/12: Enno Cramer [COMMIT enno archway--tree-gui--0--patch-66] archway-ssh-askpass -- (all) Date: Tue, 19 Apr 2005 16:00:26 +0200 From: Enno Cramer <memfrob@mail.memfrob.de> To: memfrob@memfrob.de, migo@homemail.com Subject: [COMMIT enno archway--tree-gui--0--patch-66] archway-ssh-askpass 2005-04-19 Enno Cramer <uebergeek@web.de> patch-66 * perllib/ArchWay/Session.pm: + bin/.arch-ids/archway-ssh-askpass.id: + bin/archway-ssh-askpass: archway-ssh-askpass Implement archway-ssh-askpass and use it if no other askpass program could be found. http://archzoom.sourcecontrol.net/archzoom.cgi/uebergeek@web.de--2003/archway--tree-gui--0--patch-66?log?expand