summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-09-11 10:12:50 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-09-11 10:12:50 -0400
commitc7c0133178c0902a3086716a131f8da3e1570eb8 (patch)
tree02a1a74ad64b1da301f2bf28d8955dcc0e8fc4b4
parent7e0b46a95d77074d62002e8e632530794858db3e (diff)
downloadbuild_tools-c7c0133178c0902a3086716a131f8da3e1570eb8.zip
build_tools-c7c0133178c0902a3086716a131f8da3e1570eb8.tar.gz
build_tools-c7c0133178c0902a3086716a131f8da3e1570eb8.tar.xz
Add finish() function to mail the logfile
-rwxr-xr-xsssd-nightly.sh29
1 files changed, 22 insertions, 7 deletions
diff --git a/sssd-nightly.sh b/sssd-nightly.sh
index 9441aa5..dd17b71 100755
--- a/sssd-nightly.sh
+++ b/sssd-nightly.sh
@@ -1,3 +1,16 @@
+function finish { #(exit code)
+ recipients="sgallagh@redhat.com jgalipea@redhat.com"
+
+ if [ $1 -eq 0 ]; then
+ successful="successfully"
+ else
+ successful="unsuccessfully"
+ fi
+
+ echo "Build completed $successful" | /bin/mailx -a $LOGFILE -s "SSSD automated build report for $datestamp" $recipients
+ exit $1
+}
+
mkdir -p /local/sgallagh/logs
cd /local/sgallagh
datestamp=`date +%Y%m%d%H`
@@ -11,15 +24,15 @@ echo $datestamp > VERSION
mv contrib/sssd.spec.in contrib/sssd.spec.in.orig && \
sed -e "s/make %/make CFLAGS=\"-ggdb3 -O0\" %/" < contrib/sssd.spec.in.orig > contrib/sssd.spec.in
echo "===== CONFIGURING CODE =====" >> $LOGFILE
-autoreconf -i -f >> $LOGFILE 2>&1 || exit 1
-./configure >> $LOGFILE 2>&1 || exit 2
-make srpms >> $LOGFILE 2>&1 || exit 3
+autoreconf -i -f >> $LOGFILE 2>&1 || finish 1
+./configure >> $LOGFILE 2>&1 || finish 2
+make srpms >> $LOGFILE 2>&1 || finish 3
cd rpmbuild/SRPMS
echo "===== BUILDING FEDORA 11 i586 =====" >> $LOGFILE
-mock -r fedora-11-i386 sssd-$datestamp-0.fc11.src.rpm >> $LOGFILE 2>&1 || exit 4
+mock -r fedora-11-i386 sssd-$datestamp-0.fc11.src.rpm >> $LOGFILE 2>&1 || finish 4
echo "===== BUILDING FEDORA 11 x86_64 =====" >> $LOGFILE
-mock -r fedora-11-x86_64 sssd-$datestamp-0.fc11.src.rpm >> $LOGFILE 2>&1 || exit 5
+mock -r fedora-11-x86_64 sssd-$datestamp-0.fc11.src.rpm >> $LOGFILE 2>&1 || finish 5
echo "===== CREATING FEDORA 11 i586 YUM REPOSITORY ====" >> $LOGFILE
mkdir -p /local/sgallagh/repos/f11/SRPMS
@@ -46,10 +59,10 @@ echo "===== BUILDING RHEL 5 i386 =====" >> $LOGFILE
cd /local/sgallagh/sssd-$datestamp/rpmbuild/SRPMS
mv sssd-$datestamp-0.fc11.src.rpm \
sssd-$datestamp-0.el5.src.rpm
-mock -r epel-5-i386 sssd-$datestamp-0.el5.src.rpm >> $LOGFILE 2>&1 || exit 6
+mock -r epel-5-i386 sssd-$datestamp-0.el5.src.rpm >> $LOGFILE 2>&1 || finish 6
echo "===== BUILDING RHEL 5 x86_64 =====" >> $LOGFILE
-mock -r epel-5-x86_64 sssd-$datestamp-0.el5.src.rpm >> $LOGFILE 2>&1 || exit 7
+mock -r epel-5-x86_64 sssd-$datestamp-0.el5.src.rpm >> $LOGFILE 2>&1 || finish 7
echo "===== CREATING RHEL 5 i586 YUM REPOSITORY ====" >> $LOGFILE
@@ -78,3 +91,5 @@ echo "===== Removing Source Tree =====" >> $LOGFILE
cd /local/sgallagh && rm -Rf sssd-$datestamp
echo "===== BUILD CONCLUDED AT `date` =====" >> $LOGFILE
+
+finish 0