3 # Send email to sxemacs-builds list about build failure.
4 # NOTE: At the time of last change, you HAVE to be a subscriber for
5 # your email to actually be delivered to the list
7 # (C) 2008 Nelson Ferreira
9 # This program is free software; you can redistribute it and/or modify it
10 # under a BSD-like licence.
12 # Redistribution and use in source and binary forms, with or without
13 # modification, are permitted provided that the following conditions are met:
14 # Redistributions of source code must retain the above copyright notice, this
15 # list of conditions and the following disclaimer.
16 # Redistributions in binary form must reproduce the above copyright notice,
17 # this list of conditions and the following disclaimer in the documentation
18 # and/or other materials provided with the distribution.
19 # Neither the name of the Technical University of Berlin nor the names of its
20 # contributors may be used to endorse or promote products derived from this
21 # software without specific prior written permission.
23 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 # POSSIBILITY OF SUCH DAMAGE.
35 echo "Complain bitterly to njsf@sxemacs.org that he has still NOT updated this script to use git"
38 echo "Usage: $0 <from address>"
39 echo "Example: $0 superhacker@sxemacs.org"
44 if [ -z "$REPORT_DEST" ]; then
45 REPORT_DEST=sxemacs-builds@sxemacs.org
47 type sendmail >/dev/null 2>&1 && SENDMAIL=sendmail
48 type tla >/dev/null 2>&1 && TLA=tla
49 type egrep >/dev/null 2>&1 && GREP=egrep
50 type tail >/dev/null 2>&1 && TAIL=tail
51 type tar >/dev/null 2>&1 && TAR=tar
52 type cat >/dev/null 2>&1 && CAT=cat
53 type base64 >/dev/null 2>&1 && BASE64=base64
54 type sed >/dev/null 2>&1 && SED=sed
56 type gzip >/dev/null 2>&1 && COMPRESS=gzip
57 if [ -z "$COMPRESS" ]; then
58 type compress >/dev/null 2>&1 && COMPRESS=compress
63 attachment="build-failure-$FROM.tar.${EXT}"
64 if [ -z "${BASE64}" ]; then
65 type uuencode >/dev/null 2>&1 && BASE64=uuencode
66 if [ -n "${BASE64}" ]; then
67 if [ -z "${SED}" ]; then
68 echo "sed was not found and is required when base64 is replaced by uuencode"
71 # Test if this uuencode can actually base64 encode like
73 FILTER="${SED} -e s/^begin.*644.*\$// -e s/^end\$// -e s/^====\$// -e /^\$/d "
74 if [ -n "$(echo test | ${BASE64} -m test 2>/dev/null )" ]; then
75 BASE64="${BASE64} -m ${attachment}"
78 BASE64="${BASE64} ${attachment}"
85 if [ -z "${SENDMAIL}" ]; then
86 if [ -x /usr/lib/sendmail ]; then
87 SENDMAIL=/usr/lib/sendmail
88 elif [ -x /usr/sbin/sendmail ]; then
89 SENDMAIL=/usr/sbin/sendmail
90 elif [ -x /sw/sbin/sendmail ]; then
91 SENDMAIL=/sw/sbin/sendmail
93 echo "Cannot find sendmail."
97 if [ -z "${TLA}" ]; then
98 echo "Cannot find tla."
101 if [ -z "${BASE64}" -o -z "${TAR}" -o -z "${SENDMAIL}" -o -z "${GREP}" -o -z "${CAT}" -o -z "${COMPRESS}" ]; then
102 echo "Could not find one or more of grep (${GREP}), sendmail (${SENDMAIL}),"
103 echo "\t tar (${TAR}), base64 (${BASE64}), cat (${CAT})"
106 if [ ! -f ./config.log -o -z "$(${GREP} -i sxemacs ./config.log)" ]; then
107 echo "Please run this script from the top of the sxemacs build directory.\n"
110 VERSION=$(${GREP} "^#define SXEMACS_ARCH_VERSION" ./config.log | awk '{ print $3 }')
111 if [ -z "$VERSION" ]; then
112 VERSION="Unknown. Possible early configure failure"
114 attachment="build-failure-$VERSION-$FROM.tar.${EXT}"
116 MAIN_VERSION=$(${GREP} "^#define SXEMACS_MAIN_ARCH_VERSION" ./config.log | awk '{ print $3 }')
118 if [ -n "$MAIN_VERSION" -a "$MAIN_VERSION" != "$VERSION" ]; then
119 SYNC="(Last sync with main branch: $MAIN_VERSION)"
121 CONFGUESS=$(${GREP} "^host=" ./config.log | awk -F= '{ print $2 }' )
122 if [ -z "$CONFGUESS" ]; then
123 CONFGUESS="Unknown. Possible early configure failure"
125 SRCDIR=$(${GREP} "^sxe_srcdir=" ./config.log | awk -F= '{ print $2 }' | sed -e "s/^'//" -e "s/'$//" )
126 BLDDIR=$(${GREP} "^sxe_blddir=" ./config.log | awk -F= '{ print $2 }' | sed -e "s/^'//" -e "s/'$//" )
127 COMPILER=$(${GREP} "^CC=" ./config.log | awk -F= '{ print $2 }' )
128 CONFIG_OPTS=$(${GREP} "^#define EMACS_CONFIG_OPTIONS " ./config.log | sed -e 's/^#define EMACS_CONFIG_OPTIONS //g')
129 if [ -z "$MACHTYPE" ]; then
132 for f in config.log Installation sxemacs_version.m4 ,,beta.out ,,vars.out ,,make-check.out src/config.h ; do
138 if [ -z "${STATUS}" ]; then
139 STATUS="BUILD FAILURE"
141 SUBJECT="[${STATUS}] Version $VERSION on $CONFGUESS [$MACHTYPE] [@$(pwd)]"
142 MIME="application/x-gzip"
143 boundary="--sxemacs--failure--$$--"
145 [0]="^(cd|n?make)[:blank:]" \
148 [3]="pure.*(space|size)" \
152 [7]="^Compil(ing[:blank:]+in|ation)" \
154 [9]="not[:blank:]+found" \
155 [10]="^While[:blank:]+compiling.*(\n[:blank:]+.+)*" \
158 [13]="[Ff]ile(s) copied" \
159 [14]="^[A-Za-z_]+=" \
160 [15]="[:blank:]+tests[:blank:]+" \
161 [16]="^(real|user|sys)[:blank:]+[0-9]+m" \
164 [0]="confl.*with.*auto-inlining" \
166 [2]="\(100%\) tests successful" \
167 [3]="errors that should" \
171 for r in ${KEEP[*]}; do
172 if [ -z "$KREGEXP" ]; then
175 KREGEXP="${KREGEXP}|${r}"
179 for r in ${REMOVE[*]}; do
180 if [ -z "$RREGEXP" ]; then
183 RREGEXP="${RREGEXP}|${r}"
190 Date: $(date +"%a, %e %Y %T %z")
192 Content-Type: multipart/mixed; boundary="$boundary"
193 Content-Disposition: inline
196 Content-Type: text/plain; charset=us-ascii
197 Content-Disposition: inline
199 $STATUS while building $VERSION on $CONFGUESS ($MACHTYPE)
203 if [ -z "${MSRCDIR}" ]; then
206 if [ -n "${MSRCDIR}" -a -d "${MSRCDIR}/{arch}" -a -n "${TLA}" -a -n "${GREP}" -a -n "${TAIL}" ]; then
209 TREE="$(${TLA} tree-version)"
210 PATCH="$(${TLA} revisions | ${TAIL} -1)"
211 echo "Tree : ${TREE}"
212 echo "Patch: ${PATCH}"
214 LAST_MAIN="$(${TLA} log-versions | ${GREP} -- '--main--' | ${TAIL} -1)"
215 LAST_MAIN_PATCH="$(${TLA} revisions $LAST_MAIN | ${TAIL} -1)"
216 if [ "${TREE}" != "${LAST_MAIN}" -o "${PATCH}" != "${LAST_MAIN_PATCH}" ]; then
217 echo "Main : $LAST_MAIN"
218 echo "Patch: $LAST_MAIN_PATCH"
221 DIFF_NAME=/tmp/tla-changes-${USER}-$$-${attachment}.log
222 ${TLA} changes -q --diffs > $DIFF_NAME
223 if [ -s $DIFF_NAME ]; then
228 echo "End of Changes"
237 if [ -n "${SRCDIR}" ]; then
238 echo " Source in ${SRCDIR}"
240 if [ -n "${BLDDIR}" -a "${SRCDIR}" != "${BLDDIR}" ]; then
241 echo " Build in ${BLDDIR}"
244 if [ -f ./Installation ]; then
246 ${CAT} ./Installation
248 if [ -n "${COMPILER}" ]; then
249 echo " Using compiler ${COMPILER}"
251 if [ -n "${CONFIG_OPTS}" ]; then
252 echo " Configured with options: ${CONFIG_OPTS}"
257 for f in beta make-all make-check-temacs make-check make-install; do
258 if [ -f "./,,${f}.out" ]; then
259 echo "> Contents of $(pwd)/,,${f}.out"
261 ${GREP} "$KREGEXP" ./,,${f}.out | ${GREP} -v "$RREGEXP"
266 FIND_NAME=/tmp/find-ldd-${USER}-$$-${attachment}.log
267 find src -type f -a -perm +111 -a -name \*emacs\* -exec file {} \; -exec ldd {} \; > $FIND_NAME 2>&1
268 if [ -s $FIND_NAME ]; then
269 echo " Shared library dependencies "
280 Content-Type: $MIME;name="$attachment"
281 Content-Disposition: attachment;filename="$attachment"
282 Content-Transfer-Encoding: $ENCODING
285 ${TAR} cf - $FILES | ${COMPRESS} -c - | ${BASE64} | ${FILTER}
287 echo "--$boundary--" ) | $SENDMAIL -t