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 ca-certificates
59 # Separate as we allow this to fail where it doesn't exist
60 dd-schroot-cmd -y -c $mysid apt-get install gcc-multilib || true
62 DATETIME=$(date -u '+%Y-%m-%d-%H%M%S')
63 BDIR=~/build/strace/build-test-${DATETIME}
67 GIT="git -c http.sslcainfo=/etc/ssl/certs/ca-certificates.crt"
69 cat > ~/build/strace/inside-schroot-test.sh << EOF
73 ${GIT} clone -q http://git.code.sf.net/p/strace/code strace.git || \
74 (rm -rf strace.git && \
75 ${GIT} clone -q https://github.com/strace/strace strace.git)
76 echo "BUILD ENVIRONMENT INFORMATION"
77 echo "============================="
78 echo "Debian architecture"
79 echo "-------------------"
80 dpkg-architecture -q DEB_BUILD_ARCH
87 echo "Version of kernel headers (linux-libc-dev)"
88 echo "------------------------------------------"
89 dpkg -s linux-libc-dev
90 echo "Version of libc"
91 echo "---------------"
97 ${GIT} checkout $POINT
101 make $PARALLEL && make check VERBOSE=1 && echo SUCCESS > ${BDIR}/RESULT
104 chmod +x ~/build/strace/inside-schroot-test.sh
108 # Run the command, outout to typescript
109 script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
111 if [ ! -f ${BDIR}/RESULT ] ; then
112 echo "BUILD FAILED - not doing cleanup"
113 echo "Results in ${BDIR}"
117 rm -f ~/build/strace/inside-schroot-test.sh
118 mv typescript typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
119 gzip -9 typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
120 FILE="typescript-$ARCH-$HOSTNAME-${DATETIME}.txt.gz"
121 (echo "START $FILE" ; \
123 echo "END $FILE") | \
124 mailx -s "strace-build-test $ARCH-$HOSTNAME-${DATETIME} log" \
125 steve-strace@einval.com
128 # Check to see if we have a package build to test too, run it in a
129 # separate log file but using the same chroot for speed
130 rm -rf ~/build/strace/package-test
132 WGET="wget --ca-certificate=/home/93sam/.CA/ca-certificates.crt"
133 $WGET -O /dev/null $PKG_TEST/MANIFEST
134 if [ $? -eq 0 ]; then
135 # Time to grab sources
136 mkdir ~/build/strace/package-test
137 cd ~/build/strace/package-test
138 $WGET $PKG_TEST/MANIFEST
139 for file in $(cat MANIFEST); do
140 $WGET $PKG_TEST/$file
144 cat > ~/build/strace/inside-schroot-test.sh << EOF
146 cd ~/build/strace/package-test
149 debuild -i -us -uc -b
151 chmod +x ~/build/strace/inside-schroot-test.sh
154 # Run the command, outout to typescript
155 script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
157 rm -rf ~/build/strace/package-test
158 rm -f ~/build/strace/inside-schroot-test.sh
161 (echo "START $FILE" ; \
163 echo "END $FILE") | \
164 mailx -s "$DSC package build log: $ARCH on $HOSTNAME " \