POINT=HEAD
ARCH=$(dpkg-architecture -q DEB_BUILD_ARCH)
HOSTNAME=$(hostname)
+PKG_TEST="https://www.einval.com/debian/strace/package-test"
while getopts ":p:a:" opt; do
case $opt in
echo "BUILD FAILED - not doing cleanup"
echo "Results in ${BDIR}"
fi
-schroot -e -c $mysid
+
rm -rf ${BDIR}
rm -f ~/build/strace/inside-schroot-test.sh
mv typescript typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
-
gzip -9 typescript-$ARCH-$HOSTNAME-${DATETIME}.txt
FILE="typescript-$ARCH-$HOSTNAME-${DATETIME}.txt.gz"
-
(echo "START $FILE" ; \
base64 < $FILE ; \
echo "END $FILE") | \
mailx -s "strace-build-test $ARCH-$HOSTNAME-${DATETIME} log" \
steve-strace@einval.com
-
rm -f $FILE
+
+# Check to see if we have a package build to test too, run it in a
+# separate log file but using the same chroot for speed
+rm -rf ~/build/strace/package-test
+set +e
+wget -O /dev/null $PKG_TEST
+if [ $? -eq 0 ]; then
+ # Time to grab sources
+ mkdir ~/build/strace/package-test
+ cd ~/build/strace/package-test
+ wget -r -nd -np $PKG_TEST
+ DSC=$(ls *.dsc)
+
+ cat > ~/build/strace/inside-schroot-test.sh << EOF
+#!/bin/sh
+cd ~/build/strace/package-test
+dpkg-source -x *.dsc
+cd strace-*
+debuild
+EOF
+ chmod +x ~/build/strace/inside-schroot-test.sh
+ set -e
+ cd ~
+ # Run the command, outout to typescript
+ script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh"
+
+ rm -rf ~/build/strace/package-test
+ rm -f ~/build/strace/inside-schroot-test.sh
+ cat typescript | \
+ mailx -s "$DSC package build log: $ARCH on $HOSTNAME " \
+ steve@einval.com
+ rm -f typescript
+fi
+
+schroot -e -c $mysid
+