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
45 BASE_CHROOT="sid_$ARCH-dchroot"
47 schroot -e -c $mysid || true
48 schroot -b -c $BASE_CHROOT -n $mysid
49 dd-schroot-cmd -y -c $mysid apt-get update
50 dd-schroot-cmd -y -c $mysid apt-get build-dep strace
51 dd-schroot-cmd -y -c $mysid apt-get install git autotools-dev gawk dh-autoreconf
53 DATETIME=$(date -u '+%Y-%m-%d-%H%M%S')
54 BDIR=~/build/strace/build-test-${DATETIME}
59 cat > ~/build/strace/inside-schroot-test.sh << EOF
62 git clone -q http://git.code.sf.net/p/strace/code strace.git
63 echo "BUILD ENVIRONMENT INFORMATION"
64 echo "============================="
65 echo "Debian architecture"
66 echo "-------------------"
67 dpkg-architecture -q DEB_BUILD_ARCH
74 echo "Version of kernel headers (linux-libc-dev)"
75 echo "------------------------------------------"
76 dpkg -s linux-libc-dev
77 echo "Version of libc"
78 echo "---------------"
88 make $PARALLEL && make check VERBOSE=1 && echo SUCCESS > ${BDIR}/RESULT
91 chmod +x ~/build/strace/inside-schroot-test.sh
95 # Run the command, outout to typescript
96 script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
98 if [ ! -f ${BDIR}/RESULT ] ; then
99 echo "BUILD FAILED - not doing cleanup"
100 echo "Results in ${BDIR}"
104 rm -f ~/build/strace/inside-schroot-test.sh
105 mv typescript typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
106 gzip -9 typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
107 FILE="typescript-$ARCH-$HOSTNAME-${DATETIME}.txt.gz"
108 (echo "START $FILE" ; \
110 echo "END $FILE") | \
111 mailx -s "strace-build-test $ARCH-$HOSTNAME-${DATETIME} log" \
112 steve-strace@einval.com
115 # Check to see if we have a package build to test too, run it in a
116 # separate log file but using the same chroot for speed
117 rm -rf ~/build/strace/package-test
119 wget --ca-certificate=/etc/ssl/ca-global/ca-certificates.crt -O /dev/null $PKG_TEST
120 if [ $? -eq 0 ]; then
121 # Time to grab sources
122 mkdir ~/build/strace/package-test
123 cd ~/build/strace/package-test
124 wget --ca-certificate=/etc/ssl/ca-global/ca-certificates.crt -r -nd -np $PKG_TEST
127 cat > ~/build/strace/inside-schroot-test.sh << EOF
129 cd ~/build/strace/package-test
134 chmod +x ~/build/strace/inside-schroot-test.sh
137 # Run the command, outout to typescript
138 script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
140 rm -rf ~/build/strace/package-test
141 rm -f ~/build/strace/inside-schroot-test.sh
143 mailx -s "$DSC package build log: $ARCH on $HOSTNAME " \