Buildbot: Difference between revisions

From Spring
Jump to navigationJump to search
Abma (talk | contribs)
No edit summary
Gajop (talk | contribs)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Spring uses a [http://buildbot.springrts.com/waterfall buildbot] to automaticly compile commits to the git repository to test if the commit broke something and to create the official installers.
Spring uses a [https://buildbot.springrts.com/waterfall buildbot] to automaticly compile commits to the git repository to test if the commit broke something and to create the official installers.


There are currently three buildbot setups, based on [[Buildbot:Gentoo|Gentoo]], [[Buildbot:OSX|OSX]] and ubuntu (this page, but deprecated).
There are currently three buildbot setups, based on [[Buildbot:Gentoo|Gentoo]], [[Buildbot:OSX|OSX]] and ubuntu (this page, but deprecated).
{{deprecated}}


=Setting up buildmaster=
=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.
<pre>
So, first, set up the virtualenv (in the directory virtualenv in this example):
sudo apt-get install buildbot
 
cd spring/buildbot/master
<code><pre>
cp passwords.py.template passwords.py
apt-get install python-dev python-virtualenv
buildbot start
virtualenv --no-site-packages virtualenv
buildbot create-master
echo 'source $HOME/virtualenv/bin/activate' >> ~/.profile
</pre>
source virtualenv/bin/activate
</pre></code>
 
Then we check out buildbot sources, switch to the last stable release, and install into the virtual environment.
 
<code><pre>
git clone git://github.com/buildbot/buildbot.git
cd buildbot/master
git checkout v0.8.5
python setup.py install
</pre></code>


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.
After creating the master, the generated `public_html` can be erased and linked to the `buildbot/master/public_html` in the Spring repository.


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


<code><pre>
<pre>
[buildbot-maverick]
[buildbot-maverick]
description=Ubuntu Maverick
description=Ubuntu Maverick
Line 48: Line 34:
script-config=script-defaults
script-config=script-defaults
message-verbosity=verbose
message-verbosity=verbose
</pre></code>
</pre>


Then, remove or comment out the `/home` bind mount in `/etc/schroot/default/fstab`!
Then, remove or comment out the `/home` bind mount in `/etc/schroot/default/fstab`!
Line 56: Line 42:
==Building and entering the chroot==
==Building and entering the chroot==


<code><pre>
<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>


= Inside the chroot=
= Inside the chroot=


== Run (as root)==
== Run (as root)==
<code><pre>
<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
Line 80: Line 66:
mkdir /slave
mkdir /slave
chown buildbot:buildbot /slave
chown buildbot:buildbot /slave
</pre></code>
</pre>


Build dependencies for Windows build (except MinGW, see below):
Build dependencies for Windows build (except MinGW, see below):
<code><pre>
<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>


Build dependencies for Linux build:
Build dependencies for Linux build:
<code><pre>
<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>


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


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


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


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


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


First recompile the compiler itself:
First recompile the compiler itself:
<code><pre>
<pre>
mkdir mingw
mkdir mingw
cd mingw
cd mingw
Line 129: Line 115:
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>


Then recompile the runtime libraries against the new compiler:
Then recompile the runtime libraries against the new compiler:


<code><pre>
<pre>
apt-get build-dep mingw32-runtime
apt-get build-dep mingw32-runtime
apt-get source mingw32-runtime
apt-get source mingw32-runtime
Line 141: Line 127:
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>


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


<code><pre>
<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 \
Line 153: Line 139:
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>


== Patch a few things ==
== Patch a few things ==
Line 166: Line 152:
For Linux builds:
For Linux builds:


<code><pre>
<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>


For MinGW builds:
For MinGW builds:
<code><pre>
<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>


For makensis:
For makensis:
<code><pre>
<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>


== Run (as buildbot user)==
== Run (as buildbot user)==
Line 189: Line 175:
Substitute MASTER with host:port of the buildmaster and SLAVENAME and PASSWORD with the slave name and password as configured in the master.
Substitute MASTER with host:port of the buildmaster and SLAVENAME and PASSWORD with the slave name and password as configured in the master.


<code><pre>
<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>


== ccache==
== ccache==
Line 202: Line 188:


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>
<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>


Then you can use:
Then you can use:
<code><pre>
<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>


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!

Latest revision as of 09:23, 19 August 2018

Spring uses a buildbot to automaticly compile commits to the git repository to test if the commit broke something and to create the official installers.

There are currently three buildbot setups, based on Gentoo, OSX and ubuntu (this page, but deprecated).

Setting up buildmaster

sudo apt-get install buildbot
cd spring/buildbot/master
cp passwords.py.template passwords.py
buildbot start
buildbot create-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.)