#!/bin/bash # ARCH_ARCHIVE: always # represents the archive on which the action is being performed # # ARCH_LOCATION: make-archive # gives the location of the archive being prepared by tla # # ARCH_REVISION: import, tag, commit # gives the exact revision being (import|tagg|commit)ed # # ARCH_CATEGORY: make-category # gives the category being prepared (format: category) # # ARCH_BRANCH: make-branch # gives the branch being prepared (format: category--branch) # # ARCH_VERSION: make-version # gives the version being prepared (format: category--branch--version) # # ARCH_TREE_ROOT: commit, import # gives the location of the working tree from which tla is performing # the action # # ARCH_TAGGED_ARCHIVE: tag # gives the archive of the revision from which tla will create the tag # # ARCH_TAGGED_REVISION # gives the revision from which tla will create the tagged version exec > ${HOME}/.arch-params/+last-hook exec 2>&1 ARCH_ACTION="$1" if [ "$ARCH_ACTION" = "commit" ]; then tla archive-mirror "$ARCH_ARCHIVE" tla library-add "$ARCH_ARCHIVE/$ARCH_REVISION" & fi doPrepLog() { tla cat-archive-log "${ARCH_ARCHIVE}/${ARCH_REVISION}" } doSendMail() { local recipients="${1}" local summary=$(grep "^Summary: " "${logfile}" | head -1 | sed 's/^Summary: //') mail -a "From: Michael Olson " -s "[${ARCH_ACTION}][${ARCH_VERSION}] ${summary}" ${recipients} < "${logfile}" echo "Mail sent: $summary" } case "${ARCH_ACTION}" in commit | import) ARCH_CATEGORY="`tla parse-package-name --category $ARCH_REVISION`" ARCH_BRANCH="`tla parse-package-name --branch $ARCH_REVISION`" ARCH_VERSION="`tla parse-package-name --package-version $ARCH_REVISION`" logfile="`tempfile`" doPrepLog > "${logfile}" case "${ARCH_ARCHIVE}" in "address@hidden") case "${ARCH_VERSION}" in "muse--main--1.0") doSendMail address@hidden ;; "planner-muse--mwolson--1.0") doSendMail address@hidden ;; "planner--duo--1.0") doSendMail address@hidden ;; "planner--mwolson--1.0") doSendMail address@hidden ;; "emacs-wiki--main--1.0") doSendMail address@hidden ;; esac ;; esac rm "${logfile}" ;; esac