]> git.wh0rd.org - home.git/blame - .bin/cros-cbuildbot
setup more stuff
[home.git] / .bin / cros-cbuildbot
CommitLineData
3c347239
MF
1#!/bin/bash
2
c297fe22
MF
3vexec() { echo "$@"; exec "$@"; }
4
eab23be4 5cd ~/chromiumos || exit 1
0f71e16b 6
c297fe22
MF
7case " $* " in
8*" --remote "*)
9 export GIT_CONFIG=$PWD/.repo/manifests.git/config
10 vexec cbuildbot "$@"
11 ;;
12esac
13
0f71e16b
MF
14# cache the sudo timestamp
15sudo echo "" >/dev/null
16
3c347239 17d=/usr/local/google/home/vapier
70b466db
MF
18if [[ ! -d ${d} ]] ; then
19 exit 1
20fi
21
22d+="/trybot"
23if mount | grep -qs $d ; then
24 echo "mounts found in $d"
25 exit 1
26fi
420f8f8a
MF
27rd=$(readlink $d)
28if mount | grep -qs $rd ; then
29 echo "mounts found in $rd"
30 exit 1
31fi
3c347239 32
70b466db
MF
33if [[ $1 == "--noclean" ]] ; then
34 shift
35else
3c347239 36 echo "Cleaning ${d}"
0f71e16b
MF
37 pushd "${d}" >/dev/null
38 clean=(
39 built-sdk.tbz2
40 chroot
41 new-sdk-chroot
42 #sdks
43 src/build
44 test_results.tgz
45 trybot_archive
46 )
47 sudo rm -rf "${clean[@]}"
c297fe22
MF
48 if [[ -d ${d}/sdks ]] ; then
49 sudo find "${d}"/sdks -mtime +3 -delete
50 fi
0f71e16b 51 popd >/dev/null
3c347239
MF
52fi
53
54# find all the buildbot branches
0f71e16b 55echo "Looking up repo branches"
3c347239
MF
56repos=$(r b | cut -b4- | awk '$1 == "bb" {
57 # Single repo output:
58 # bb | in src/third_party/portage-stable
59 # Multi repo output:
60 # bb | in:
61 # src/third_party/portage-stable
62 # src/third_party/chromiumos-overlay
63 if ($3 == "in")
64 print $NF
65 while (getline) {
66 if ($2 == "|")
67 break;
68 print $NF;
69 }
70}')
71if [[ -n ${repos} ]] ; then
72 echo "Auto pulling patches from 'bb' branch in repos:"
73 printf '\t%s\n' ${repos}
74
75 p_flag=""
76 for r in ${repos} ; do
77 r=$(r list | awk -v r="${r}" '$1 == r { print $NF }')
78 p_flag+="${r}:bb "
79 done
80
81 set -- -p "${p_flag}" "$@"
82fi
83
3c347239 84vexec cbuildbot --buildroot=${d} "$@"