#!/bin/bash # Set defaults if test x"${debug}" = x"true"; then export CONFIG_SHELL="/bin/bash -x" else export CONFIG_SHELL="/bin/bash" fi target="" tarsrc="" tarbin="" check="" ref="snapshots-ref" nocheck="no" fileserver="148.251.136.42" user_workspace="${WORKSPACE:-/home/${USER:-buildslave}/workspace}" OPTS="`getopt -o r:t:f:d:bs:w:nh -l target:,ref:,date:,fileserver:,tarbin:,tarsrc:,workspace:,help`" while test $# -gt 0; do echo 1 = "$1" case $1 in -w|--workspace) user_workspace=$2 ;; -s|--tarsrc) tarsrc=yes ;; -b|--tarbin) tarbin=yes ;; -t|--target) target=$2 ;; -d|--date) date=$2 ;; -r|--ref) ref=$2 ;; -f|--fileserver) fileserver=$2 ;; -n|--nocheck) nocheck=yes ;; -h|--help) usage ;; --) break ;; esac shift done if test x"${target}" != x"native" -a x"${target}" != x; then platform="--target ${target}" fi shared="/home/buildslave/workspace/shared/" abe_dir="$(dirname $0)/.." user_snapshots="${user_workspace}/snapshots" if test -e ${user_workspace}; then cat << EOF > ${user_workspace}/BUILD-INFO.txt Format-Version: 0.5 Files-Pattern: * License-Type: open EOF fi # Create a build directory if test ! -d ${user_workspace}/_build; then mkdir -p ${user_workspace}/_build else rm -fr ${user_workspace}/_build/* ${user_workspace}/_build/sysroots/* fi # By default, always update all sources update="" if test x"${runtests}" = xtrue; then chroot="--enable-schroot-test" fi # Use the newly created build directory cd ${user_workspace}/_build if ! test -e host.conf; then $CONFIG_SHELL ${abe_dir}/configure ${chroot} --with-local-snapshots=${user_snapshots} \ --with-git-reference-dir=${shared}/snapshots --with-fileserver=${fileserver} --with-remote-snapshots=${ref} fi if test x"${runtests}" = xtrue; then chroot="--enable-schroot-test" check="--check all" else check="" fi if test x"${date}" != x; then release="${date}" fi if test "`echo ${target} | grep -c linux`" -gt 0; then if test "`echo ${gcc_src} | grep -c -- '-[56][[:digit:]\.]*'`" -gt 0; then libc="--set libc=glibc" else libc="--set libc=eglibc" fi else # ELF and EABI based targets are bare metal only libc="--set libc=newlib" fi binutils=${binutils_src:+binutils=${binutils_src}} gcc=${gcc_src:+gcc=${gcc_src}} # Build a toolchain, run the tests, and the create a source release as a tarball if test x"${tarsrc}" = x"yes"; then $CONFIG_SHELL ${abe_dir}/abe.sh --release ${release} \ --tarsrc ${check} ${gcc} ${binutils} ${platform} -build all ${libc} fi # Build a binary release tarball, then run the tests on the installed binaries if test x"${tarbin}" = x"yes"; then # Canadian cross builds require a Linux hosted cross compiler first if test x"${canadian}" = x"true"; then $CONFIG_SHELL ${abe_dir}/abe.sh ${update} --release ${release} ${check} ${gcc} ${binutils} ${platform} --build all ${libc} host="--host i686-w64-mingw32" rm -fr ${local_builds}/${host}/${target}/ # update="--disable update" else host="" fi $CONFIG_SHELL ${abe_dir}/abe.sh ${update} --release ${release} --tarbin ${check} ${gcc} ${binutils} ${platform} ${host} --build all ${libc} fi # force a failure if abe has build problems. if test $? -gt 0; then exit 1 fi # If not running the testsuites, just exit. if test x"${nocheck}" = xyes; then exit 0 fi # Copy the source build test results and tarballs to the fileserver bases="/work/abe/baselines/${release}/${target}" snaps="/home/abe/var/snapshots/" if test x"${tarsrc}" = x"yes"; then manifest="`find ${user_workspace} -name \*manifest.txt`" scp ${manifest} ${fileserver}:${bases}/ if test x"${check}" != x; then sums="`find ${user_workspace} -name \*.sum`" logs="`find ${user_workspace} -name \*.log`" if test x"${sums}" != x; then ssh ${fileserver} "mkdir -p ${bases}" xz ${sums} ${logs} sums="`echo ${sums} | sed -e 's/\.sum/\.sum.xz/g'`" logs="`echo ${logs} | sed -e 's/\.log/\.log.xz/g'`" scp ${sums} ${logs} ${fileserver}:${bases}/ else echo "ERROR: No test results were found!" fi fi tarballs="`find ${user_snapshots} -name \*${release}\*.xz -o -name \*${release}\*.asc`" if test x"${tarballs}" != x; then scp ${tarballs} ${fileserver}:${snaps}/ if test $? -gt 0; then echo "ERROR: Couldn't copy files to ${fileserver}!" exit 1 else rm -f ${tarballs} fi else echo "ERROR: No source tarballs were found!" fi fi # Copy the binary test results to the fileserver binaries="/work/space/binaries/${release}/${target}" if test x"${tarbin}" = xyes; then manifest="`find ${user_workspace} -name \*manifest.txt`" ssh ${fileserver} "if test ! -d ${binaries}; then mkdir -p ${binaries}; fi" scp ${manifest} ${fileserver}:${binaries}/ tarballs="`find ${user_snapshots} -name \*${release}\*.xz -o -name \*${release}\*.asc`" scp ${tarballs} ${fileserver}:${binaries}/ rm -f ${tarballs} if test x"${check}" != x; then sums="`find ${user_workspace} -name \*.sum`" logs="`find ${user_workspace} -name \*.log`" if test x"${sums}" != x; then xz ${sums} ${logs} sums="`echo ${sums} | sed -e 's/\.sum/\.sum.xz/g'`" logs="`echo ${logs} | sed -e 's/\.log/\.log.xz/g'`" ssh ${fileserver} "mkdir -p ${binaries}/" scp ${sums} ${logs} ${fileserver}:${binaries}/ else echo "ERROR: No test results were found!" fi # Diff the two directories scp ${abe_dir}/tcwgweb.sh ${fileserver}:/tmp/tcwgweb$$.sh out="`ssh ${fileserver} "if test -e ${bases}; then echo YES; else echo NO; fi"`" if test x"${out}" = x"YES"; then out="`ssh ${fileserver} /tmp/tcwgweb$$.sh --email --tdir ${bases} ${binaries}`" if test "`echo ${out} | grep -c REGRESSIONS`"; then exit 1 fi fi fi fi exit 0