2010-07-29 22:00:59 -06:00
|
|
|
#!/usr/bin/env bash
|
2010-01-27 16:42:37 -07:00
|
|
|
# Copyright 2010 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
# This script can be run to create a new builder and then
|
|
|
|
# to keep it running via cron. First, run it by hand until it
|
|
|
|
# starts up without errors and can run the loop. Then, once
|
|
|
|
# you're confident that it works, add this to your crontab:
|
|
|
|
#
|
|
|
|
# */5 * * * * cd $HOME; path/to/buildcron.sh darwin 386 >/dev/null 2>/dev/null
|
|
|
|
|
|
|
|
if [ $# != 2 ]; then
|
|
|
|
echo 'usage: buildcron.sh goos goarch' 1>&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
export GOOS=$1
|
|
|
|
export GOARCH=$2
|
|
|
|
|
|
|
|
# Check if we are already running.
|
|
|
|
# First command must not be pipeline, to avoid seeing extra processes in ps.
|
|
|
|
all=$(ps axwwu)
|
2010-02-01 12:36:44 -07:00
|
|
|
pid=$(echo "$all" | grep "buildcron.sh $1 $2" | grep -v "sh -c" | grep -v $$ | awk '{print $2}')
|
2010-01-27 16:42:37 -07:00
|
|
|
if [ "$pid" != "" ]; then
|
2010-02-01 12:36:44 -07:00
|
|
|
#echo already running buildcron.sh $1 $2
|
|
|
|
#echo "$all" | grep "buildcron.sh $1 $2" | grep -v "sh -c" | grep -v $$
|
2010-01-27 16:42:37 -07:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
export BUILDHOST=godashboard.appspot.com
|
|
|
|
export BUILDER=${GOOS}-${GOARCH}
|
|
|
|
export GOROOT=$HOME/go-$BUILDER/go
|
|
|
|
export GOBIN=$HOME/go-$BUILDER/bin
|
|
|
|
|
|
|
|
if [ ! -f ~/.gobuildkey-$BUILDER ]; then
|
|
|
|
echo "need gobuildkey for $BUILDER in ~/.gobuildkey-$BUILDER" 1>&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d $GOROOT ]; then
|
|
|
|
mkdir -p $GOROOT
|
|
|
|
hg clone https://go.googlecode.com/hg/ $GOROOT
|
2010-02-09 14:45:38 -07:00
|
|
|
else
|
|
|
|
cd $GOROOT
|
|
|
|
hg pull -u || exit 1
|
2010-01-27 16:42:37 -07:00
|
|
|
fi
|
|
|
|
mkdir -p $GOROOT/bin
|
|
|
|
|
|
|
|
cd $GOROOT/..
|
2010-07-29 22:00:59 -06:00
|
|
|
cp go/misc/dashboard/{builder.sh,buildcontrol.py,googlecode_upload.py} .
|
2010-01-27 16:42:37 -07:00
|
|
|
chmod a+x builder.sh buildcontrol.py
|
|
|
|
cd go
|
|
|
|
../buildcontrol.py next $BUILDER
|
|
|
|
cd ..
|
|
|
|
./builder.sh
|
|
|
|
|
|
|
|
|