3 echo "Complain bitterly to njsf@sxemacs.org that he has still NOT updated this script to use git"
6 echo "Usage: $0 <from address>"
7 echo "Example: $0 superhacker@sxemacs.org"
12 if [ -z "$REPORT_DEST" ]; then
13 REPORT_DEST=sxemacs-builds@sxemacs.org
15 type sendmail >/dev/null 2>&1 && SENDMAIL=sendmail
16 type tla >/dev/null 2>&1 && TLA=tla
17 type egrep >/dev/null 2>&1 && GREP=egrep
18 type tail >/dev/null 2>&1 && TAIL=tail
19 type tar >/dev/null 2>&1 && TAR=tar
20 type cat >/dev/null 2>&1 && CAT=cat
21 type base64 >/dev/null 2>&1 && BASE64=base64
22 type sed >/dev/null 2>&1 && SED=sed
24 type gzip >/dev/null 2>&1 && COMPRESS=gzip
25 if [ -z "$COMPRESS" ]; then
26 type compress >/dev/null 2>&1 && COMPRESS=compress
31 attachment="build-failure-$FROM.tar.${EXT}"
32 if [ -z "${BASE64}" ]; then
33 type uuencode >/dev/null 2>&1 && BASE64=uuencode
34 if [ -n "${BASE64}" ]; then
35 if [ -z "${SED}" ]; then
36 echo "sed was not found and is required when base64 is replaced by uuencode"
39 # Test if this uuencode can actually base64 encode like
41 FILTER="${SED} -e s/^begin.*644.*\$// -e s/^end\$// -e s/^====\$// -e /^\$/d "
42 if [ -n "$(echo test | ${BASE64} -m test 2>/dev/null )" ]; then
43 BASE64="${BASE64} -m ${attachment}"
46 BASE64="${BASE64} ${attachment}"
53 if [ -z "${SENDMAIL}" ]; then
54 if [ -x /usr/lib/sendmail ]; then
55 SENDMAIL=/usr/lib/sendmail
56 elif [ -x /usr/sbin/sendmail ]; then
57 SENDMAIL=/usr/sbin/sendmail
58 elif [ -x /sw/sbin/sendmail ]; then
59 SENDMAIL=/sw/sbin/sendmail
61 echo "Cannot find sendmail."
65 if [ -z "${TLA}" ]; then
66 echo "Cannot find tla."
69 if [ -z "${BASE64}" -o -z "${TAR}" -o -z "${SENDMAIL}" -o -z "${GREP}" -o -z "${CAT}" -o -z "${COMPRESS}" ]; then
70 echo "Could not find one or more of grep (${GREP}), sendmail (${SENDMAIL}),"
71 echo "\t tar (${TAR}), base64 (${BASE64}), cat (${CAT})"
74 if [ ! -f ./config.log -o -z "$(${GREP} -i sxemacs ./config.log)" ]; then
75 echo "Please run this script from the top of the sxemacs build directory.\n"
78 VERSION=$(${GREP} "^#define SXEMACS_ARCH_VERSION" ./config.log | awk '{ print $3 }')
79 if [ -z "$VERSION" ]; then
80 VERSION="Unknown. Possible early configure failure"
82 attachment="build-failure-$VERSION-$FROM.tar.${EXT}"
84 MAIN_VERSION=$(${GREP} "^#define SXEMACS_MAIN_ARCH_VERSION" ./config.log | awk '{ print $3 }')
86 if [ -n "$MAIN_VERSION" -a "$MAIN_VERSION" != "$VERSION" ]; then
87 SYNC="(Last sync with main branch: $MAIN_VERSION)"
89 CONFGUESS=$(${GREP} "^host=" ./config.log | awk -F= '{ print $2 }' )
90 if [ -z "$CONFGUESS" ]; then
91 CONFGUESS="Unknown. Possible early configure failure"
93 SRCDIR=$(${GREP} "^sxe_srcdir=" ./config.log | awk -F= '{ print $2 }' | sed -e "s/^'//" -e "s/'$//" )
94 BLDDIR=$(${GREP} "^sxe_blddir=" ./config.log | awk -F= '{ print $2 }' | sed -e "s/^'//" -e "s/'$//" )
95 COMPILER=$(${GREP} "^CC=" ./config.log | awk -F= '{ print $2 }' )
96 CONFIG_OPTS=$(${GREP} "^#define EMACS_CONFIG_OPTIONS " ./config.log | sed -e 's/^#define EMACS_CONFIG_OPTIONS //g')
97 if [ -z "$MACHTYPE" ]; then
100 for f in config.log Installation sxemacs_version.m4 ,,beta.out ,,vars.out ,,make-check.out src/config.h ; do
106 if [ -z "${STATUS}" ]; then
107 STATUS="BUILD FAILURE"
109 SUBJECT="[${STATUS}] Version $VERSION on $CONFGUESS [$MACHTYPE] [@$(pwd)]"
110 MIME="application/x-gzip"
111 boundary="--sxemacs--failure--$$--"
113 [0]="^(cd|n?make)[:blank:]" \
116 [3]="pure.*(space|size)" \
120 [7]="^Compil(ing[:blank:]+in|ation)" \
122 [9]="not[:blank:]+found" \
123 [10]="^While[:blank:]+compiling.*(\n[:blank:]+.+)*" \
126 [13]="[Ff]ile(s) copied" \
127 [14]="^[A-Za-z_]+=" \
128 [15]="[:blank:]+tests[:blank:]+" \
129 [16]="^(real|user|sys)[:blank:]+[0-9]+m" \
132 [0]="confl.*with.*auto-inlining" \
134 [2]="\(100%\) tests successful" \
135 [3]="errors that should" \
139 for r in ${KEEP[*]}; do
140 if [ -z "$KREGEXP" ]; then
143 KREGEXP="${KREGEXP}|${r}"
147 for r in ${REMOVE[*]}; do
148 if [ -z "$RREGEXP" ]; then
151 RREGEXP="${RREGEXP}|${r}"
158 Date: $(date +"%a, %e %Y %T %z")
160 Content-Type: multipart/mixed; boundary="$boundary"
161 Content-Disposition: inline
164 Content-Type: text/plain; charset=us-ascii
165 Content-Disposition: inline
167 $STATUS while building $VERSION on $CONFGUESS ($MACHTYPE)
171 if [ -z "${MSRCDIR}" ]; then
174 if [ -n "${MSRCDIR}" -a -d "${MSRCDIR}/{arch}" -a -n "${TLA}" -a -n "${GREP}" -a -n "${TAIL}" ]; then
177 TREE="$(${TLA} tree-version)"
178 PATCH="$(${TLA} revisions | ${TAIL} -1)"
179 echo "Tree : ${TREE}"
180 echo "Patch: ${PATCH}"
182 LAST_MAIN="$(${TLA} log-versions | ${GREP} -- '--main--' | ${TAIL} -1)"
183 LAST_MAIN_PATCH="$(${TLA} revisions $LAST_MAIN | ${TAIL} -1)"
184 if [ "${TREE}" != "${LAST_MAIN}" -o "${PATCH}" != "${LAST_MAIN_PATCH}" ]; then
185 echo "Main : $LAST_MAIN"
186 echo "Patch: $LAST_MAIN_PATCH"
189 DIFF_NAME=/tmp/tla-changes-${USER}-$$-${attachment}.log
190 ${TLA} changes -q --diffs > $DIFF_NAME
191 if [ -s $DIFF_NAME ]; then
196 echo "End of Changes"
205 if [ -n "${SRCDIR}" ]; then
206 echo " Source in ${SRCDIR}"
208 if [ -n "${BLDDIR}" -a "${SRCDIR}" != "${BLDDIR}" ]; then
209 echo " Build in ${BLDDIR}"
212 if [ -f ./Installation ]; then
214 ${CAT} ./Installation
216 if [ -n "${COMPILER}" ]; then
217 echo " Using compiler ${COMPILER}"
219 if [ -n "${CONFIG_OPTS}" ]; then
220 echo " Configured with options: ${CONFIG_OPTS}"
225 for f in beta make-all make-check-temacs make-check make-install; do
226 if [ -f "./,,${f}.out" ]; then
227 echo "> Contents of $(pwd)/,,${f}.out"
229 ${GREP} "$KREGEXP" ./,,${f}.out | ${GREP} -v "$RREGEXP"
234 FIND_NAME=/tmp/find-ldd-${USER}-$$-${attachment}.log
235 find src -type f -a -perm +111 -a -name \*emacs\* -exec file {} \; -exec ldd {} \; > $FIND_NAME 2>&1
236 if [ -s $FIND_NAME ]; then
237 echo " Shared library dependencies "
248 Content-Type: $MIME;name="$attachment"
249 Content-Disposition: attachment;filename="$attachment"
250 Content-Transfer-Encoding: $ENCODING
253 ${TAR} cf - $FILES | ${COMPRESS} -c - | ${BASE64} | ${FILTER}
255 echo "--$boundary--" ) | $SENDMAIL -t