aboutsummaryrefslogtreecommitdiff
path: root/scripts/auto-build/mail-mingw-log-hack.sh
blob: 57c197649593119a4b558ecfe1949f7e9df2a740 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh


# the source dir where this script is
SCRIPT_DIR=$(echo $0 | sed 's|\(.*\)/.*$|\1|')
. $SCRIPT_DIR/auto-build-common

# the name of this script
SCRIPT=$(echo $0| sed 's|.*/\(.*\)|\1|g')

mailbody_on_failure () {
 ## this is a somewhat simplistic expression to detect error-lines
 cat "$1" | grep -i "error: " | tail -20
 echo ""
 echo "the full logfile can be viewed at"
 echo "http://autobuild.puredata.info/auto-build/${DATE}/logs/${LOGFILE##*/}"
}


for logfile in /home/apt/www/auto-build/${DATE}/logs/${DATE}_*_mingw*.txt; do
    if [ -r "${logfile}" ]; then
	 completion_test=$(tail -1 "${logfile}")
	 if [ "x${completion_test}" != "xSUCCESS" ]; then
		if [ "x${RECIPIENT}" != "x" ]; then
		  SUBJECT="autobuild: $distro $HOSTNAME $DATE $TIME"
		  mailbody_on_failure "${logfile}" | mail -s "autobuild: $logfile" ${RECIPIENT}
		fi
	 fi
     fi
done