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
52 dd-schroot-cmd -y -c $mysid apt-get install gcc-multilib || true
54 DATETIME=$(date -u '+%Y-%m-%d-%H%M%S')
55 BDIR=~/build/strace/build-test-${DATETIME}
60 cat > ~/build/strace/inside-schroot-test.sh << EOF
63 git clone -q http://git.code.sf.net/p/strace/code strace.git
64 echo "BUILD ENVIRONMENT INFORMATION"
65 echo "============================="
66 echo "Debian architecture"
67 echo "-------------------"
68 dpkg-architecture -q DEB_BUILD_ARCH
75 echo "Version of kernel headers (linux-libc-dev)"
76 echo "------------------------------------------"
77 dpkg -s linux-libc-dev
78 echo "Version of libc"
79 echo "---------------"
89 make $PARALLEL && make check VERBOSE=1 && echo SUCCESS > ${BDIR}/RESULT
92 chmod +x ~/build/strace/inside-schroot-test.sh
96 # Run the command, outout to typescript
97 script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
99 if [ ! -f ${BDIR}/RESULT ] ; then
100 echo "BUILD FAILED - not doing cleanup"
101 echo "Results in ${BDIR}"
105 rm -f ~/build/strace/inside-schroot-test.sh
106 mv typescript typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
107 gzip -9 typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
108 FILE="typescript-$ARCH-$HOSTNAME-${DATETIME}.txt.gz"
109 (echo "START $FILE" ; \
111 echo "END $FILE") | \
112 mailx -s "strace-build-test $ARCH-$HOSTNAME-${DATETIME} log" \
113 steve-strace@einval.com
116 # Check to see if we have a package build to test too, run it in a
117 # separate log file but using the same chroot for speed
118 rm -rf ~/build/strace/package-test
120 wget --ca-certificate=/etc/ssl/ca-global/ca-certificates.crt -O /dev/null $PKG_TEST
121 if [ $? -eq 0 ]; then
122 # Time to grab sources
123 mkdir ~/build/strace/package-test
124 cd ~/build/strace/package-test
125 wget --ca-certificate=/home/93sam/.CA/ca-certificates.crt -r -nd -np $PKG_TEST
128 cat > ~/build/strace/inside-schroot-test.sh << EOF
130 cd ~/build/strace/package-test
135 chmod +x ~/build/strace/inside-schroot-test.sh
138 # Run the command, outout to typescript
139 script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
141 rm -rf ~/build/strace/package-test
142 rm -f ~/build/strace/inside-schroot-test.sh
144 mailx -s "$DSC package build log: $ARCH on $HOSTNAME " \