blob: d0bb33738b52a416f2a044ff4afa14bc0294b6eb (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/bin/sh
cd /
# On Mac OS X, there are some handy things in Fink, but don't override the
# built-in tools
PATH="${PATH}:/sw/bin:/sw/sbin"
export PATH
# 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 ${LOGFILE} | grep -i "error: " | tail -20
# tail -20 ${LOGFILE}
echo ""
echo "the full logfile can be viewed at"
echo "http://autobuild.puredata.info/auto-build/${DATE}/logs/${LOGFILE##*/}"
}
run_build_script ()
{
distro=$1
## LATER: make the uploaded ${LOGFILE} (name) be consistent with the uploaded package-file (name)
LOGFILE=${HOME}/logs/${DATE}_${TIME}_${SYSTEM}_${HOSTNAME}_${distro}_${SCRIPT}.txt
touch ${LOGFILE}
sh ${HOME}/auto-build/${distro}/scripts/auto-build/${distro}-auto-builder.sh >> $LOGFILE 2>&1
case $SYSTEM in
mingw*)
/c/cygwin/bin/sh -c \
"rsync -a ${LOGFILE} rsync://128.238.56.50/upload/${DATE}/logs/"
;;
*)
rsync -a ${LOGFILE} rsync://128.238.56.50/upload/${DATE}/logs/
;;
esac
# send status report if something failed
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 | mail -s "${SUBJECT}" ${RECIPIENT}
#tail -20 ${LOGFILE} | mail -s "${SUBJECT}" ${RECIPIENT}
fi
fi
}
for dir in ${HOME}/auto-build/*; do
dirname=$(echo $dir | sed 's|.*/\(.*\)|\1|')
test -e $dir/scripts/auto-build/${dirname}-auto-builder.sh && \
run_build_script $dirname
done
# since the above test can cause this script to exit with an error, force it
# to be happy to prevent getting automated error emails to root
true
|