4 ARCH=$(dpkg-architecture -q DEB_BUILD_ARCH)
6 PKG_TEST="https://www.einval.com/debian/strace/package-test"
8 while getopts ":p:a:" opt; do
16 chk=`dpkg-architecture -a$ARCH > /dev/null 2>&1 ; echo $?`
18 if [ $chk != 0 ]; then
19 echo "Did not recognise ${ARCH} as a Debian architecture name. Exit."
25 echo "Invalid option: -$OPTARG" >&2
30 PATH=/usr/local/sbin:/usr/local/bin:$PATH
33 NUMCPUS=$(grep processor /proc/cpuinfo | wc -l)
34 if [ $NUMCPUS -gt 1 ]; then
35 PARALLEL="-j $NUMCPUS"
43 mysid=sid-93sam-strace-$RANDOM
51 BASE_CHROOT="sid_$ARCH-dchroot"
53 schroot -e -c $mysid || true
54 schroot -b -c $BASE_CHROOT -n $mysid
55 dd-schroot-cmd -y -c $mysid apt-get update
56 dd-schroot-cmd -y -c $mysid apt-get build-dep strace
57 dd-schroot-cmd -y -c $mysid apt-get install git autotools-dev gawk dh-autoreconf wget
58 dd-schroot-cmd -y -c $mysid apt-get install gcc-multilib || true
60 DATETIME=$(date -u '+%Y-%m-%d-%H%M%S')
61 BDIR=~/build/strace/build-test-${DATETIME}
66 cat > ~/build/strace/inside-schroot-test.sh << EOF
70 git clone -q http://git.code.sf.net/p/strace/code strace.git || rm -rf strace.git && git clone -q https://github.com/strace/strace strace.git
71 echo "BUILD ENVIRONMENT INFORMATION"
72 echo "============================="
73 echo "Debian architecture"
74 echo "-------------------"
75 dpkg-architecture -q DEB_BUILD_ARCH
82 echo "Version of kernel headers (linux-libc-dev)"
83 echo "------------------------------------------"
84 dpkg -s linux-libc-dev
85 echo "Version of libc"
86 echo "---------------"
96 make $PARALLEL && make check VERBOSE=1 && echo SUCCESS > ${BDIR}/RESULT
99 chmod +x ~/build/strace/inside-schroot-test.sh
103 # Run the command, outout to typescript
104 script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
106 if [ ! -f ${BDIR}/RESULT ] ; then
107 echo "BUILD FAILED - not doing cleanup"
108 echo "Results in ${BDIR}"
112 rm -f ~/build/strace/inside-schroot-test.sh
113 mv typescript typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
114 gzip -9 typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
115 FILE="typescript-$ARCH-$HOSTNAME-${DATETIME}.txt.gz"
116 (echo "START $FILE" ; \
118 echo "END $FILE") | \
119 mailx -s "strace-build-test $ARCH-$HOSTNAME-${DATETIME} log" \
120 steve-strace@einval.com
123 # Check to see if we have a package build to test too, run it in a
124 # separate log file but using the same chroot for speed
125 rm -rf ~/build/strace/package-test
127 WGET="wget --ca-certificate=/home/93sam/.CA/ca-certificates.crt"
128 $WGET -O /dev/null $PKG_TEST/MANIFEST
129 if [ $? -eq 0 ]; then
130 # Time to grab sources
131 mkdir ~/build/strace/package-test
132 cd ~/build/strace/package-test
133 $WGET $PKG_TEST/MANIFEST
134 for file in $(cat MANIFEST); do
135 $WGET $PKG_TEST/$file
139 cat > ~/build/strace/inside-schroot-test.sh << EOF
141 cd ~/build/strace/package-test
144 debuild -i -us -uc -b
146 chmod +x ~/build/strace/inside-schroot-test.sh
149 # Run the command, outout to typescript
150 script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
152 rm -rf ~/build/strace/package-test
153 rm -f ~/build/strace/inside-schroot-test.sh
156 (echo "START $FILE" ; \
158 echo "END $FILE") | \
159 mailx -s "$DSC package build log: $ARCH on $HOSTNAME " \