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
69 git clone -q http://git.code.sf.net/p/strace/code strace.git
70 echo "BUILD ENVIRONMENT INFORMATION"
71 echo "============================="
72 echo "Debian architecture"
73 echo "-------------------"
74 dpkg-architecture -q DEB_BUILD_ARCH
81 echo "Version of kernel headers (linux-libc-dev)"
82 echo "------------------------------------------"
83 dpkg -s linux-libc-dev
84 echo "Version of libc"
85 echo "---------------"
95 make $PARALLEL && make check VERBOSE=1 && echo SUCCESS > ${BDIR}/RESULT
98 chmod +x ~/build/strace/inside-schroot-test.sh
102 # Run the command, outout to typescript
103 script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
105 if [ ! -f ${BDIR}/RESULT ] ; then
106 echo "BUILD FAILED - not doing cleanup"
107 echo "Results in ${BDIR}"
111 rm -f ~/build/strace/inside-schroot-test.sh
112 mv typescript typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
113 gzip -9 typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
114 FILE="typescript-$ARCH-$HOSTNAME-${DATETIME}.txt.gz"
115 (echo "START $FILE" ; \
117 echo "END $FILE") | \
118 mailx -s "strace-build-test $ARCH-$HOSTNAME-${DATETIME} log" \
119 steve-strace@einval.com
122 # Check to see if we have a package build to test too, run it in a
123 # separate log file but using the same chroot for speed
124 rm -rf ~/build/strace/package-test
126 WGET_OPTS="--ca-certificate=/home/93sam/.CA/ca-certificates.crt"
127 wget $WGET_OPTS -O /dev/null $PKG_TEST/MANIFEST
128 if [ $? -eq 0 ]; then
129 # Time to grab sources
130 mkdir ~/build/strace/package-test
131 cd ~/build/strace/package-test
132 wget $WGET_OPTS $PKG_TEST/MANIFEST
133 for file in $(cat MANIFEST); do
138 cat > ~/build/strace/inside-schroot-test.sh << EOF
140 cd ~/build/strace/package-test
145 chmod +x ~/build/strace/inside-schroot-test.sh
148 # Run the command, outout to typescript
149 script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
151 rm -rf ~/build/strace/package-test
152 rm -f ~/build/strace/inside-schroot-test.sh
155 (echo "START $FILE" ; \
157 echo "END $FILE") | \
158 mailx -s "$DSC package build log: $ARCH on $HOSTNAME " \