# How to run a buildslave for the Python project.

# Requirements: 24/7 Internet connection and availability.

# The buildslave will only execute code that has been committed by Python
# core committers. Nevertheless, it is recommended to run the slave in a
# virtual machine or on a dedicated machine.
#
# If you run qemu with a guest that is not well supported, consider using
# a raw image instead of qcow (See http://bugs.python.org/issue11962).
#
# If strict firewall rules are in place, perhaps ask the network
# admin if it is possible to run a dedicated buildbot machine in
# the DMZ.

# As root: add user/group 'buildbot':
groupadd buildbot
useradd -g buildbot buildbot

# Become user 'buildbot':
su - buildbot

# Create package install directories:
mkdir usr

# The easiest way to run a buildslave is to install Python-2.7
# from source and the rest via pip:
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
wget http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz#md5=47ec6ff3f6d962696fe08d4c8264ad49

# Install Python-2.7 into /home/buildbot/usr/bin:
tar xvzf Python-2.7.2.tgz
cd Python-2.7.2
./configure --prefix=/home/buildbot/usr
make
make test
make install
cd ..

# Install setuptools:
tar xvzf setuptools-0.6c11.tar.gz 
cd setuptools-0.6c11
/home/buildbot/usr/bin/python setup.py install
cd ..

# Install pip:
tar xvzf pip-1.0.2.tar.gz
cd pip-1.0.2
/home/buildbot/usr/bin/python setup.py install
cd ..

# Cleanup:
rm -rf pip-1.0.2*
rm -rf Python-2.7.2*
rm -rf setuptools-0.6c11*

# Install buildbot-slave:
/home/buildbot/usr/bin/pip install buildbot-slave

# Create build area:
mkdir buildarea

# Change PATH so that /home/buildbot/usr gets precedence:
# vi ~/.bashrc
# Insert:
# PATH=/home/buildbot/usr/bin

# Reload .bashrc:
. ~/.bashrc

# Ask for a slavename and password on python-dev, then:
buildslave create-slave `pwd`/buildarea dinsdale.python.org:9020 slavename slavepasswd

# Edit buildarea/info/admin and buildarea/info/host

# Start the buildslave:
buildslave start ~/buildarea



