#!/bin/bash POINT=HEAD ARCH=$(dpkg-architecture -q DEB_BUILD_ARCH) HOSTNAME=$(hostname) PKG_TEST="https://www.einval.com/debian/strace/package-test" while getopts ":p:a:" opt; do case $opt in p) POINT=$OPTARG ;; a) ARCH=$OPTARG set +e chk=`dpkg-architecture -a$ARCH > /dev/null 2>&1 ; echo $?` set -e if [ $chk != 0 ]; then echo "Did not recognise ${ARCH} as a Debian architecture name. Exit." exit 1 fi ARCH=${ARCH} ;; \?) echo "Invalid option: -$OPTARG" >&2 ;; esac done PATH=/usr/local/sbin:/usr/local/bin:$PATH export PATH NUMCPUS=$(grep processor /proc/cpuinfo | wc -l) if [ $NUMCPUS -gt 1 ]; then PARALLEL="-j $NUMCPUS" else PARALLEL="" fi set -e set -x mysid=sid-93sam-strace-$RANDOM BASE_CHROOT="sid_$ARCH-dchroot" schroot -e -c $mysid || true schroot -b -c $BASE_CHROOT -n $mysid dd-schroot-cmd -y -c $mysid apt-get update dd-schroot-cmd -y -c $mysid apt-get build-dep strace dd-schroot-cmd -y -c $mysid apt-get install git autotools-dev gawk dh-autoreconf dd-schroot-cmd -y -c $mysid apt-get install gcc-multilib || true DATETIME=$(date -u '+%Y-%m-%d-%H%M%S') BDIR=~/build/strace/build-test-${DATETIME} mkdir -p ${BDIR} cd ${BDIR} cat > ~/build/strace/inside-schroot-test.sh << EOF #!/bin/sh cd ${BDIR} git clone -q http://git.code.sf.net/p/strace/code strace.git echo "BUILD ENVIRONMENT INFORMATION" echo "=============================" echo "Debian architecture" echo "-------------------" dpkg-architecture -q DEB_BUILD_ARCH echo "Hostname" echo "--------" hostname echo "uname -rm" echo "---------" uname -rm echo "Version of kernel headers (linux-libc-dev)" echo "------------------------------------------" dpkg -s linux-libc-dev echo "Version of libc" echo "---------------" dpkg -s libc6-dev echo "Version of gcc" echo "--------------" dpkg -s gcc cd strace.git git checkout $POINT git log | head -1 ./bootstrap ./configure make $PARALLEL && make check VERBOSE=1 && echo SUCCESS > ${BDIR}/RESULT EOF chmod +x ~/build/strace/inside-schroot-test.sh cd ~ # Run the command, outout to typescript script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh" if [ ! -f ${BDIR}/RESULT ] ; then echo "BUILD FAILED - not doing cleanup" echo "Results in ${BDIR}" fi rm -rf ${BDIR} rm -f ~/build/strace/inside-schroot-test.sh mv typescript typescript-$ARCH-$HOSTNAME-${DATETIME}.txt gzip -9 typescript-$ARCH-$HOSTNAME-${DATETIME}.txt FILE="typescript-$ARCH-$HOSTNAME-${DATETIME}.txt.gz" (echo "START $FILE" ; \ base64 < $FILE ; \ echo "END $FILE") | \ mailx -s "strace-build-test $ARCH-$HOSTNAME-${DATETIME} log" \ steve-strace@einval.com rm -f $FILE # Check to see if we have a package build to test too, run it in a # separate log file but using the same chroot for speed rm -rf ~/build/strace/package-test set +e wget --ca-certificate=/etc/ssl/ca-global/ca-certificates.crt -O /dev/null $PKG_TEST if [ $? -eq 0 ]; then # Time to grab sources mkdir ~/build/strace/package-test cd ~/build/strace/package-test wget --ca-certificate=/home/93sam/.CA/ca-certificates.crt -r -nd -np $PKG_TEST DSC=$(ls *.dsc) cat > ~/build/strace/inside-schroot-test.sh << EOF #!/bin/sh cd ~/build/strace/package-test dpkg-source -x *.dsc cd strace-* debuild EOF chmod +x ~/build/strace/inside-schroot-test.sh set -e cd ~ # Run the command, outout to typescript script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh" rm -rf ~/build/strace/package-test rm -f ~/build/strace/inside-schroot-test.sh cat typescript | \ mailx -s "$DSC package build log: $ARCH on $HOSTNAME " \ steve@einval.com rm -f typescript fi schroot -e -c $mysid