Add pre_build() and post_build() support

svn path=/trunk/; revision=575
This commit is contained in:
Andrew Gaffney 2008-09-28 04:31:49 +00:00
parent 8b587404e2
commit 4333ff11e4
2 changed files with 30 additions and 3 deletions

View file

@ -2,6 +2,9 @@
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
# $Id$
28 Sep 2008; Andrew Gaffney <agaffney@gentoo.org> catalyst-auto:
Add pre_build() and post_build() support
05 Sep 2008; Andrew Gaffney <agaffney@gentoo.org>
catalyst-auto-amd64.conf:
Change a few config values

View file

@ -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