4 echo "Usage: $0 <from address>"
5 echo "Example: $0 superhacker@sxemacs.org"
10 if [ -z "$REPORT_DEST" ]; then
11 REPORT_DEST=sxemacs-builds@sxemacs.org
13 type sendmail >/dev/null 2>&1 && SENDMAIL=sendmail
14 type tla >/dev/null 2>&1 && TLA=tla
15 type egrep >/dev/null 2>&1 && GREP=egrep
16 type tail >/dev/null 2>&1 && TAIL=tail
17 type tar >/dev/null 2>&1 && TAR=tar
18 type cat >/dev/null 2>&1 && CAT=cat
19 type base64 >/dev/null 2>&1 && BASE64=base64
20 type sed >/dev/null 2>&1 && SED=sed
22 type gzip >/dev/null 2>&1 && COMPRESS=gzip
23 if [ -z "$COMPRESS" ]; then
24 type compress >/dev/null 2>&1 && COMPRESS=compress
29 attachment="build-failure-$FROM.tar.${EXT}"
30 if [ -z "${BASE64}" ]; then
31 type uuencode >/dev/null 2>&1 && BASE64=uuencode
32 if [ -n "${BASE64}" ]; then
33 if [ -z "${SED}" ]; then
34 echo "sed was not found and is required when base64 is replaced by uuencode"
37 # Test if this uuencode can actually base64 encode like
39 FILTER="${SED} -e s/^begin.*644.*\$// -e s/^end\$// -e s/^====\$// -e /^\$/d "
40 if [ -n "$(echo test | ${BASE64} -m test 2>/dev/null )" ]; then
41 BASE64="${BASE64} -m ${attachment}"
44 BASE64="${BASE64} ${attachment}"
51 if [ -z "${SENDMAIL}" ]; then
52 if [ -x /usr/lib/sendmail ]; then
53 SENDMAIL=/usr/lib/sendmail
54 elif [ -x /usr/sbin/sendmail ]; then
55 SENDMAIL=/usr/sbin/sendmail
56 elif [ -x /sw/sbin/sendmail ]; then
57 SENDMAIL=/sw/sbin/sendmail
59 echo "Cannot find sendmail."
63 if [ -z "${TLA}" ]; then
64 echo "Cannot find tla."
67 if [ -z "${BASE64}" -o -z "${TAR}" -o -z "${SENDMAIL}" -o -z "${GREP}" -o -z "${CAT}" -o -z "${COMPRESS}" ]; then
68 echo "Could not find one or more of grep (${GREP}), sendmail (${SENDMAIL}),"
69 echo "\t tar (${TAR}), base64 (${BASE64}), cat (${CAT})"
72 if [ ! -f ./config.log -o -z "$(${GREP} -i sxemacs ./config.log)" ]; then
73 echo "Please run this script from the top of the sxemacs build directory.\n"
76 VERSION=$(${GREP} "^#define SXEMACS_ARCH_VERSION" ./config.log | awk '{ print $3 }')
77 if [ -z "$VERSION" ]; then
78 VERSION="Unknown. Possible early configure failure"
80 attachment="build-failure-$VERSION-$FROM.tar.${EXT}"
82 MAIN_VERSION=$(${GREP} "^#define SXEMACS_MAIN_ARCH_VERSION" ./config.log | awk '{ print $3 }')
84 if [ -n "$MAIN_VERSION" -a "$MAIN_VERSION" != "$VERSION" ]; then
85 SYNC="(Last sync with main branch: $MAIN_VERSION)"
87 CONFGUESS=$(${GREP} "^host=" ./config.log | awk -F= '{ print $2 }' )
88 if [ -z "$CONFGUESS" ]; then
89 CONFGUESS="Unknown. Possible early configure failure"
91 SRCDIR=$(${GREP} "^sxe_srcdir=" ./config.log | awk -F= '{ print $2 }' | sed -e "s/^'//" -e "s/'$//" )
92 BLDDIR=$(${GREP} "^sxe_blddir=" ./config.log | awk -F= '{ print $2 }' | sed -e "s/^'//" -e "s/'$//" )
93 COMPILER=$(${GREP} "^CC=" ./config.log | awk -F= '{ print $2 }' )
94 CONFIG_OPTS=$(${GREP} "^#define EMACS_CONFIG_OPTIONS " ./config.log | sed -e 's/^#define EMACS_CONFIG_OPTIONS //g')
95 if [ -z "$MACHTYPE" ]; then
98 for f in config.log Installation sxemacs_version.m4 ,,beta.out ,,vars.out ,,make-check.out src/config.h ; do
104 if [ -z "${STATUS}" ]; then
105 STATUS="BUILD FAILURE"
107 SUBJECT="[${STATUS}] Version $VERSION on $CONFGUESS [$MACHTYPE] [@$(pwd)]"
108 MIME="application/x-gzip"
109 boundary="--sxemacs--failure--$$--"
111 [0]="^(cd|n?make)[:blank:]" \
114 [3]="pure.*(space|size)" \
118 [7]="^Compil(ing[:blank:]+in|ation)" \
120 [9]="not[:blank:]+found" \
121 [10]="^While[:blank:]+compiling.*(\n[:blank:]+.+)*" \
124 [13]="[Ff]ile(s) copied" \
125 [14]="^[A-Za-z_]+=" \
126 [15]="[:blank:]+tests[:blank:]+" \
127 [16]="^(real|user|sys)[:blank:]+[0-9]+m" \
130 [0]="confl.*with.*auto-inlining" \
132 [2]="\(100%\) tests successful" \
133 [3]="errors that should" \
137 for r in ${KEEP[*]}; do
138 if [ -z "$KREGEXP" ]; then
141 KREGEXP="${KREGEXP}|${r}"
145 for r in ${REMOVE[*]}; do
146 if [ -z "$RREGEXP" ]; then
149 RREGEXP="${RREGEXP}|${r}"
156 Date: $(date +"%a, %e %Y %T %z")
158 Content-Type: multipart/mixed; boundary="$boundary"
159 Content-Disposition: inline
162 Content-Type: text/plain; charset=us-ascii
163 Content-Disposition: inline
165 $STATUS while building $VERSION on $CONFGUESS ($MACHTYPE)
169 if [ -z "${MSRCDIR}" ]; then
172 if [ -n "${MSRCDIR}" -a -d "${MSRCDIR}/{arch}" -a -n "${TLA}" -a -n "${GREP}" -a -n "${TAIL}" ]; then
175 TREE="$(${TLA} tree-version)"
176 PATCH="$(${TLA} revisions | ${TAIL} -1)"
177 echo "Tree : ${TREE}"
178 echo "Patch: ${PATCH}"
180 LAST_MAIN="$(${TLA} log-versions | ${GREP} -- '--main--' | ${TAIL} -1)"
181 LAST_MAIN_PATCH="$(${TLA} revisions $LAST_MAIN | ${TAIL} -1)"
182 if [ "${TREE}" != "${LAST_MAIN}" -o "${PATCH}" != "${LAST_MAIN_PATCH}" ]; then
183 echo "Main : $LAST_MAIN"
184 echo "Patch: $LAST_MAIN_PATCH"
187 DIFF_NAME=/tmp/tla-changes-${USER}-$$-${attachment}.log
188 ${TLA} changes -q --diffs > $DIFF_NAME
189 if [ -s $DIFF_NAME ]; then
194 echo "End of Changes"
203 if [ -n "${SRCDIR}" ]; then
204 echo " Source in ${SRCDIR}"
206 if [ -n "${BLDDIR}" -a "${SRCDIR}" != "${BLDDIR}" ]; then
207 echo " Build in ${BLDDIR}"
210 if [ -f ./Installation ]; then
212 ${CAT} ./Installation
214 if [ -n "${COMPILER}" ]; then
215 echo " Using compiler ${COMPILER}"
217 if [ -n "${CONFIG_OPTS}" ]; then
218 echo " Configured with options: ${CONFIG_OPTS}"
223 for f in beta make-all make-check-temacs make-check make-install; do
224 if [ -f "./,,${f}.out" ]; then
225 echo "> Contents of $(pwd)/,,${f}.out"
227 ${GREP} "$KREGEXP" ./,,${f}.out | ${GREP} -v "$RREGEXP"
232 FIND_NAME=/tmp/find-ldd-${USER}-$$-${attachment}.log
233 find src -type f -a -perm +111 -a -name \*emacs\* -exec file {} \; -exec ldd {} \; > $FIND_NAME 2>&1
234 if [ -s $FIND_NAME ]; then
235 echo " Shared library dependencies "
246 Content-Type: $MIME;name="$attachment"
247 Content-Disposition: attachment;filename="$attachment"
248 Content-Transfer-Encoding: $ENCODING
251 ${TAR} cf - $FILES | ${COMPRESS} -c - | ${BASE64} | ${FILTER}
253 echo "--$boundary--" ) | $SENDMAIL -t