Buildbot: Difference between revisions

From Spring
Jump to navigationJump to search
Abma (talk | contribs)
initial page for setting up buildbot
 
Abma (talk | contribs)
remove indents
Line 5: Line 5:


<code><pre>
<code><pre>
apt-get install python-dev python-virtualenv
apt-get install python-dev python-virtualenv
virtualenv --no-site-packages virtualenv
virtualenv --no-site-packages virtualenv
echo 'source $HOME/virtualenv/bin/activate' >> ~/.profile
echo 'source $HOME/virtualenv/bin/activate' >> ~/.profile
source virtualenv/bin/activate
source virtualenv/bin/activate
</pre></code>
</pre></code>


Line 14: Line 14:


<code><pre>
<code><pre>
git clone git://github.com/buildbot/buildbot.git
git clone git://github.com/buildbot/buildbot.git
cd buildbot/master
cd buildbot/master
git checkout v0.8.5
git checkout v0.8.5
python setup.py install
python setup.py install
</pre></code>
</pre></code>


Line 32: Line 32:


<code><pre>
<code><pre>
[buildbot-maverick]
[buildbot-maverick]
description=Ubuntu Maverick
description=Ubuntu Maverick
directory=$DIR
directory=$DIR
type=directory
type=directory
users=buildbot
users=buildbot
groups=buildbot
groups=buildbot
root-groups=root
root-groups=root
personality=linux32
personality=linux32
script-config=script-defaults
script-config=script-defaults
message-verbosity=verbose
message-verbosity=verbose
</pre></code>
</pre></code>


Line 51: Line 51:


<code><pre>
<code><pre>
debootstrap --variant=buildd --arch i386 maverick $DIR http://ftp.cvut.cz/ubuntu/
debootstrap --variant=buildd --arch i386 maverick $DIR http://ftp.cvut.cz/ubuntu/
mkdir -p $DIR/home/buildbot/www
mkdir -p $DIR/home/buildbot/www
chown buildbot:buildbot $DIR/home/buildbot
chown buildbot:buildbot $DIR/home/buildbot
schroot -c buildbot-maverick
schroot -c buildbot-maverick
</pre></code>
</pre></code>


Line 61: Line 61:
== Run (as root)==
== Run (as root)==
<code><pre>
<code><pre>
echo 'deb http://ftp.cvut.cz/ubuntu maverick universe' >> /etc/apt/sources.list
echo 'deb http://ftp.cvut.cz/ubuntu maverick universe' >> /etc/apt/sources.list
sed s/deb/deb-src/g /etc/apt/sources.list >> /etc/apt/sources.list
sed s/deb/deb-src/g /etc/apt/sources.list >> /etc/apt/sources.list
apt-get update
apt-get update
apt-get install nano git-core python-dev python-setuptools
apt-get install nano git-core python-dev python-setuptools


cd /root
cd /root
git clone git://github.com/buildbot/buildbot.git
git clone git://github.com/buildbot/buildbot.git
cd buildbot
cd buildbot
git checkout v0.8.3p1
git checkout v0.8.3p1
cd slave
cd slave
python setup.py install
python setup.py install
mkdir /slave
mkdir /slave
chown buildbot:buildbot /slave
chown buildbot:buildbot /slave
</pre></code>
</pre></code>


Build dependencies for Windows build (except MinGW, see below):
Build dependencies for Windows build (except MinGW, see below):
<code><pre>
<code><pre>
apt-get install cmake nsis p7zip-full unzip wget pandoc wine
apt-get install cmake nsis p7zip-full unzip wget pandoc wine
apt-get install openjdk-6-jdk  #to enable building of Java AIs
apt-get install openjdk-6-jdk  #to enable building of Java AIs
</pre></code>
</pre></code>


Build dependencies for Linux build:
Build dependencies for Linux build:
<code><pre>
<code><pre>
apt-get install libboost-all-dev libdevil-dev libfreetype6-dev libopenal-dev \
apt-get install libboost-all-dev libdevil-dev libfreetype6-dev libopenal-dev \
libogg-dev libvorbis-dev libglew-dev libsdl-dev libxcursor-dev \
libogg-dev libvorbis-dev libglew-dev libsdl-dev libxcursor-dev \
p7zip-full
p7zip-full
</pre></code>
</pre></code>


Build dependencies for validation test:
Build dependencies for validation test:
<code><pre>
<code><pre>
apt-get install gdb libcurl4-gnutls-dev
apt-get install gdb libcurl4-gnutls-dev
</pre></code>
</pre></code>


Build dependencies for doxygen:
Build dependencies for doxygen:
<code><pre>
<code><pre>
apt-get install doxygen
apt-get install doxygen
</pre></code>
</pre></code>


Build dependencies for cppcheck:
Build dependencies for cppcheck:
<code><pre>
<code><pre>
apt-get install cppcheck
apt-get install cppcheck
</pre></code>
</pre></code>


Speed up linking:
Speed up linking:
<code><pre>
<code><pre>
apt-get install binutils-gold
apt-get install binutils-gold
</pre></code>
</pre></code>


Line 113: Line 113:
First recompile the compiler itself:
First recompile the compiler itself:
<code><pre>
<code><pre>
mkdir mingw
mkdir mingw
cd mingw
cd mingw
apt-get build-dep gcc-mingw32
apt-get build-dep gcc-mingw32
apt-get source gcc-mingw32
apt-get source gcc-mingw32
cd gcc-mingw32-4.4.4
cd gcc-mingw32-4.4.4
editor debian/rules  # remove --enable-sjlj-exceptions, add --disable-sjlj-exceptions --with-dwarf2
editor debian/rules  # remove --enable-sjlj-exceptions, add --disable-sjlj-exceptions --with-dwarf2
dpkg-buildpackage -rfakeroot -b
dpkg-buildpackage -rfakeroot -b
cd ..
cd ..
dpkg -i gcc-mingw32*.deb
dpkg -i gcc-mingw32*.deb
echo "gcc-mingw32 hold"|dpkg --set-selections
echo "gcc-mingw32 hold"|dpkg --set-selections
</pre></code>
</pre></code>


Line 128: Line 128:


<code><pre>
<code><pre>
apt-get build-dep mingw32-runtime
apt-get build-dep mingw32-runtime
apt-get source mingw32-runtime
apt-get source mingw32-runtime
cd mingw32-runtime-3.15.2
cd mingw32-runtime-3.15.2
dpkg-buildpackage -rfakeroot -b
dpkg-buildpackage -rfakeroot -b
cd ..
cd ..
dpkg -i mingw32-runtime*.deb
dpkg -i mingw32-runtime*.deb
echo "mingw32-runtime hold"|dpkg --set-selections
echo "mingw32-runtime hold"|dpkg --set-selections
</pre></code>
</pre></code>


Line 140: Line 140:


<code><pre>
<code><pre>
apt-get purge autoconf automake autotools-dev cdbs debhelper fdupes gettext \
apt-get purge autoconf automake autotools-dev cdbs debhelper fdupes gettext \
gettext-base groff-base html2text intltool intltool-debian libcroco3 \
gettext-base groff-base html2text intltool intltool-debian libcroco3 \
libfont-afm-perl libgmp3-dev libgmpxx4ldbl libhtml-format-perl \
libfont-afm-perl libgmp3-dev libgmpxx4ldbl libhtml-format-perl \
libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl \
libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl \
libmail-sendmail-perl libmailtools-perl libmpfr-dev \
libmail-sendmail-perl libmailtools-perl libmpfr-dev \
libsys-hostname-long-perl libunistring0 liburi-perl libwww-perl \
libsys-hostname-long-perl libunistring0 liburi-perl libwww-perl \
libxml-parser-perl lzma m4 man-db mingw-w64 po-debconf
libxml-parser-perl lzma m4 man-db mingw-w64 po-debconf
</pre></code>
</pre></code>


Line 161: Line 161:


<code><pre>
<code><pre>
mv /usr/bin/ld /usr/bin/ld.orig
mv /usr/bin/ld /usr/bin/ld.orig
cp ld /usr/bin/ld
cp ld /usr/bin/ld
</pre></code>
</pre></code>


For MinGW builds:
For MinGW builds:
<code><pre>
<code><pre>
mv /usr/bin/i586-mingw32msvc-ld /usr/bin/i586-mingw32msvc-ld.orig
mv /usr/bin/i586-mingw32msvc-ld /usr/bin/i586-mingw32msvc-ld.orig
cp ld /usr/bin/i586-mingw32msvc-ld
cp ld /usr/bin/i586-mingw32msvc-ld
mv /usr/i586-mingw32msvc/bin/ld /usr/i586-mingw32msvc/bin/ld.orig
mv /usr/i586-mingw32msvc/bin/ld /usr/i586-mingw32msvc/bin/ld.orig
cp ld /usr/i586-mingw32msvc/bin/ld
cp ld /usr/i586-mingw32msvc/bin/ld
</pre></code>
</pre></code>


For makensis:
For makensis:
<code><pre>
<code><pre>
gcc -shared -m32 no-msync.c -o no-msync.so
gcc -shared -m32 no-msync.c -o no-msync.so
cp makensis no-msync.so /usr/local/bin/
cp makensis no-msync.so /usr/local/bin/
</pre></code>
</pre></code>


Line 184: Line 184:


<code><pre>
<code><pre>
buildslave create-slave /slave MASTER SLAVENAME PASSWORD
buildslave create-slave /slave MASTER SLAVENAME PASSWORD
cd /slave
cd /slave
git clone git://github.com/spring/mingwlibs.git
git clone git://github.com/spring/mingwlibs.git
</pre></code>
</pre></code>


Line 197: Line 197:
Get the Makefile from the Spring repository that can be used to start/stop the slave easily:
Get the Makefile from the Spring repository that can be used to start/stop the slave easily:
<code><pre>
<code><pre>
wget https://raw.github.com/spring/spring/master/buildbot/master/buildbot.mk -O Makefile
wget https://raw.github.com/spring/spring/master/buildbot/master/buildbot.mk -O Makefile
</pre></code>
</pre></code>


Then you can use:
Then you can use:
<code><pre>
<code><pre>
make start-slave    # creates schroot session and starts buildslave in it
make start-slave    # creates schroot session and starts buildslave in it
make stop-slave    # stops buildslave and remove schroot session
make stop-slave    # stops buildslave and remove schroot session
make enter-chroot  # enter the schroot as buildbot user
make enter-chroot  # enter the schroot as buildbot user
</pre></code>
</pre></code>


Make sure you review the Makefile and fix the chroot name, paths, etc. before using it!
Make sure you review the Makefile and fix the chroot name, paths, etc. before using it!
(That applies to anything in this readme really.)
(That applies to anything in this readme really.)

Revision as of 14:45, 27 November 2012

Setting up buildmaster

The build master is set up using virtualenv, so that buildbot needs not to be installed as root, and so that buildbot can't conflict with other installed python packages. So, first, set up the virtualenv (in the directory virtualenv in this example):

apt-get install python-dev python-virtualenv
virtualenv --no-site-packages virtualenv
echo 'source $HOME/virtualenv/bin/activate' >> ~/.profile
source virtualenv/bin/activate

Then we check out buildbot sources, switch to the last stable release, and install into the virtual environment.

git clone git://github.com/buildbot/buildbot.git
cd buildbot/master
git checkout v0.8.5
python setup.py install

After this commands like `buildbot create-master` and `buildbot start` can be used to create/control the master. After creating the master, the generated `public_html` can be erased and linked to the `buildbot/master/public_html` in the Spring repository.

Setting up buildslave (Making the chroot)

At least debootstrap and schroot are required. I didn't compile an exhaustive list of other dependencies on the host system, so YMMV.

Configuring schroot

Add a file (name does not matter) to `/etc/schroot/chroot.d` with the following contents, after substituting an absolute path for `$DIR`:

[buildbot-maverick]
description=Ubuntu Maverick
directory=$DIR
type=directory
users=buildbot
groups=buildbot
root-groups=root
personality=linux32
script-config=script-defaults
message-verbosity=verbose

Then, remove or comment out the `/home` bind mount in `/etc/schroot/default/fstab`!

This configuration has been tested with schroot 1.4.23. With any other version YMMV.

Building and entering the chroot

debootstrap --variant=buildd --arch i386 maverick $DIR http://ftp.cvut.cz/ubuntu/
mkdir -p $DIR/home/buildbot/www
chown buildbot:buildbot $DIR/home/buildbot
schroot -c buildbot-maverick

Inside the chroot

Run (as root)

echo 'deb http://ftp.cvut.cz/ubuntu maverick universe' >> /etc/apt/sources.list
sed s/deb/deb-src/g /etc/apt/sources.list >> /etc/apt/sources.list
apt-get update
apt-get install nano git-core python-dev python-setuptools

cd /root
git clone git://github.com/buildbot/buildbot.git
cd buildbot
git checkout v0.8.3p1
cd slave
python setup.py install
mkdir /slave
chown buildbot:buildbot /slave

Build dependencies for Windows build (except MinGW, see below):

apt-get install cmake nsis p7zip-full unzip wget pandoc wine
apt-get install openjdk-6-jdk   #to enable building of Java AIs

Build dependencies for Linux build:

apt-get install libboost-all-dev libdevil-dev libfreetype6-dev libopenal-dev \
	libogg-dev libvorbis-dev libglew-dev libsdl-dev libxcursor-dev \
	p7zip-full

Build dependencies for validation test:

apt-get install gdb libcurl4-gnutls-dev

Build dependencies for doxygen:

apt-get install doxygen

Build dependencies for cppcheck:

apt-get install cppcheck

Speed up linking:

apt-get install binutils-gold

Recompile MinGW package with dwarf2 exceptions instead of sjlj exceptions (as root)

First recompile the compiler itself:

mkdir mingw
cd mingw
apt-get build-dep gcc-mingw32
apt-get source gcc-mingw32
cd gcc-mingw32-4.4.4
editor debian/rules   # remove --enable-sjlj-exceptions, add --disable-sjlj-exceptions --with-dwarf2
dpkg-buildpackage -rfakeroot -b
cd ..
dpkg -i gcc-mingw32*.deb
echo "gcc-mingw32 hold"|dpkg --set-selections

Then recompile the runtime libraries against the new compiler:

apt-get build-dep mingw32-runtime
apt-get source mingw32-runtime
cd mingw32-runtime-3.15.2
dpkg-buildpackage -rfakeroot -b
cd ..
dpkg -i mingw32-runtime*.deb
echo "mingw32-runtime hold"|dpkg --set-selections

Optionally, remove build dependencies (check what apt-get build-dep installed!):

apt-get purge autoconf automake autotools-dev cdbs debhelper fdupes gettext \
	gettext-base groff-base html2text intltool intltool-debian libcroco3 \
	libfont-afm-perl libgmp3-dev libgmpxx4ldbl libhtml-format-perl \
	libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl \
	libmail-sendmail-perl libmailtools-perl libmpfr-dev \
	libsys-hostname-long-perl libunistring0 liburi-perl libwww-perl \
	libxml-parser-perl lzma m4 man-db mingw-w64 po-debconf

== Patch a few things

We set up ld to allow only one execution at the same time, to prevent thrashing the box due to multiple parallel linker jobs. We "patch" makensis to not sync the installer to disk after every tiny chunk of data it has written. This speeds installer building up by an order of magnitude.

First, copy over ld, makensis and no-msync.c from spring/buildbot/slave (Spring repository) to the chroot. Then switch to the directory (inside the chroot!) where you copied those files and do:

For Linux builds:

mv /usr/bin/ld /usr/bin/ld.orig
cp ld /usr/bin/ld

For MinGW builds:

mv /usr/bin/i586-mingw32msvc-ld /usr/bin/i586-mingw32msvc-ld.orig
cp ld /usr/bin/i586-mingw32msvc-ld
mv /usr/i586-mingw32msvc/bin/ld /usr/i586-mingw32msvc/bin/ld.orig
cp ld /usr/i586-mingw32msvc/bin/ld

For makensis:

gcc -shared -m32 no-msync.c -o no-msync.so
cp makensis no-msync.so /usr/local/bin/

Run (as buildbot user)

Substitute MASTER with host:port of the buildmaster and SLAVENAME and PASSWORD with the slave name and password as configured in the master.

buildslave create-slave /slave MASTER SLAVENAME PASSWORD
cd /slave
git clone git://github.com/spring/mingwlibs.git

ccache

To install ccache simply run `apt-get install ccache` (inside the chroot) and (optionally) tweak the settings (cache size etc.)

Outside the chroot again

Get the Makefile from the Spring repository that can be used to start/stop the slave easily:

wget https://raw.github.com/spring/spring/master/buildbot/master/buildbot.mk -O Makefile

Then you can use:

make start-slave    # creates schroot session and starts buildslave in it
make stop-slave     # stops buildslave and remove schroot session
make enter-chroot   # enter the schroot as buildbot user

Make sure you review the Makefile and fix the chroot name, paths, etc. before using it! (That applies to anything in this readme really.)