X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=.bin%2Fcros-cbuildbot;h=cdc6b43db2dce5bacd6e86053c6f25eece73ad06;hb=853a0c1f76ed7cb7e9bd6619b9e58b38cca1a1f0;hp=81aa94e365caba30f8dcbe4d8b42f67a6181c352;hpb=70b466db52736b52348219fae2005a01641f5a8e;p=home.git diff --git a/.bin/cros-cbuildbot b/.bin/cros-cbuildbot index 81aa94e..cdc6b43 100755 --- a/.bin/cros-cbuildbot +++ b/.bin/cros-cbuildbot @@ -1,38 +1,71 @@ #!/bin/bash -if ! cbuildbot -h >& /dev/null ; then - cd ~/chromiumos || exit 1 -fi +set -e + +vexec() { + local i fmt + for (( i = 1; i <= $#; ++i )) ; do + case ${!i} in + *" "*) fmt="'%s'";; + *) fmt="%s";; + esac + printf "${fmt}" "${!i}" + if [[ $i -lt $# ]] ; then + printf ' ' + else + echo + fi + done + exec "$@" +} -# cache the sudo timestamp -sudo echo "" >/dev/null +cd ~/chromiumos d=/usr/local/google/home/vapier if [[ ! -d ${d} ]] ; then exit 1 fi +if [[ -z ${UNSHARE} ]] ; then + if type -P unshare >&/dev/null ; then + exec sudo unshare -m -- sudo -u ${USER} \ + UNSHARE=true PATH="${PATH}" "$0" "$@" + fi + unset UNSHARE +fi + d+="/trybot" +mkdir -p "${d}" if mount | grep -qs $d ; then echo "mounts found in $d" exit 1 fi +if [[ -L $d ]] ; then + rd=$(readlink $d) + if mount | grep -qs $rd ; then + echo "mounts found in $rd" + exit 1 + fi +fi if [[ $1 == "--noclean" ]] ; then shift -else +elif [[ " $* " != *" --remote "* ]] ; then echo "Cleaning ${d}" pushd "${d}" >/dev/null clean=( built-sdk.tbz2 - chroot +# chroot new-sdk-chroot - #sdks + sdks src/build test_results.tgz trybot_archive ) sudo rm -rf "${clean[@]}" +# [[ -L .cache ]] && rm -f .cache || : +# mkdir -p .cache +# sudo mount --bind -n ~/chromiumos/.cache .cache popd >/dev/null fi @@ -65,6 +98,6 @@ if [[ -n ${repos} ]] ; then set -- -p "${p_flag}" "$@" fi +set -- --cache-dir=~/chromiumos/.cache "$@" -vexec() { echo "$@"; exec "$@"; } vexec cbuildbot --buildroot=${d} "$@"