#!/bin/bash if ! cbuildbot -h >& /dev/null ; then cd ~/chromiumos || exit 1 fi # cache the sudo timestamp sudo echo "" >/dev/null d=/usr/local/google/home/vapier if [[ ! -d ${d} ]] ; then exit 1 fi d+="/trybot" if mount | grep -qs $d ; then echo "mounts found in $d" exit 1 fi rd=$(readlink $d) if mount | grep -qs $rd ; then echo "mounts found in $rd" exit 1 fi if [[ $1 == "--noclean" ]] ; then shift else echo "Cleaning ${d}" pushd "${d}" >/dev/null clean=( built-sdk.tbz2 chroot new-sdk-chroot #sdks src/build test_results.tgz trybot_archive ) sudo rm -rf "${clean[@]}" sudo find "${d}"/sdks -mtime +3 -delete popd >/dev/null fi # find all the buildbot branches echo "Looking up repo branches" repos=$(r b | cut -b4- | awk '$1 == "bb" { # Single repo output: # bb | in src/third_party/portage-stable # Multi repo output: # bb | in: # src/third_party/portage-stable # src/third_party/chromiumos-overlay if ($3 == "in") print $NF while (getline) { if ($2 == "|") break; print $NF; } }') if [[ -n ${repos} ]] ; then echo "Auto pulling patches from 'bb' branch in repos:" printf '\t%s\n' ${repos} p_flag="" for r in ${repos} ; do r=$(r list | awk -v r="${r}" '$1 == r { print $NF }') p_flag+="${r}:bb " done set -- -p "${p_flag}" "$@" fi vexec() { echo "$@"; exec "$@"; } vexec cbuildbot --buildroot=${d} "$@"