From 4333ff11e4f59cef001944d7ef42e135ce249db7 Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Sun, 28 Sep 2008 04:31:49 +0000 Subject: [PATCH] Add pre_build() and post_build() support svn path=/trunk/; revision=575 --- tools/ChangeLog | 3 +++ tools/catalyst-auto | 30 +++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/tools/ChangeLog b/tools/ChangeLog index b0ed0188..89c7bc7e 100644 --- a/tools/ChangeLog +++ b/tools/ChangeLog @@ -2,6 +2,9 @@ # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 # $Id$ + 28 Sep 2008; Andrew Gaffney catalyst-auto: + Add pre_build() and post_build() support + 05 Sep 2008; Andrew Gaffney catalyst-auto-amd64.conf: Change a few config values diff --git a/tools/catalyst-auto b/tools/catalyst-auto index 9d35f88c..27ec514c 100755 --- a/tools/catalyst-auto +++ b/tools/catalyst-auto @@ -43,6 +43,20 @@ run_cmd() { fi } +pre_build() { + # This is a skeleton function that you can override from the config file. + # It will be executed before the build is started. You can use this to + # update a svn checkout of spec files + local foo=bar +} + +post_build() { + # This is a skeleton function that you can override from the config file. + # It will be executed after the build is successfully completed. You can + # use this to rsync the builds to another box + local foo=bar +} + # Parse args params=${#} while [ ${#} -gt 0 ] @@ -80,6 +94,11 @@ source ${config_file} TMPDIR=/tmp/catalyst-auto.${PID} DATESTAMP=$(date +%Y%m%d) +if ! run_cmd "pre_build" "${TMPDIR}/log/pre_build.log"; then + send_email "Catalyst build error - pre_build" "$(echo -e "Your pre_build function sucks\n\n"; tail -n 200 "${TMPDIR}/log/pre_build.log")" + exit 1 +fi + if [ ${verbose} = 1 ]; then echo "TMPDIR = ${TMPDIR}" echo "DATESTAMP = ${DATESTAMP}" @@ -132,9 +151,9 @@ for i in $(find -name '*.spec'); do done # Create snapshot -if ! run_cmd "catalyst -c ${CATALYST_CONFIG} -s ${DATESTAMP}" "${TMPDIR}/log/snapshot-${DATESTAMP}.log"; then - send_email "Catalyst build error - snapshot" "$(tail -n 200 ${TMPDIR}/log/snapshot-${DATESTAMP}.log)" - exit 1 +if ! run_cmd "catalyst -c ${CATALYST_CONFIG} -s ${DATESTAMP}" "${TMPDIR}/log/snapshot.log"; then + send_email "Catalyst build error - snapshot" "$(tail -n 200 ${TMPDIR}/log/snapshot.log)" + exit 1 fi for i in ${SPECS}; do @@ -146,6 +165,11 @@ for i in ${SPECS}; do fi done +if ! run_cmd "post_build" "${TMPDIR}/log/post_build.log"; then + send_email "Catalyst build error - post_build" "$(echo -e "Your post_build function sucks\n\n"; tail -n 200 "${TMPDIR}/log/post_build.log")" + exit 1 +fi + send_email "Catalyst build success" "Everything finished successfully." if ! rm -rf "${TMPDIR}"; then