chiark / gitweb /
buildserver: fix jenkins build to support QEMU/KVM
[fdroidserver.git] / jenkins-build-makebuildserver
1
2 #!/bin/bash
3
4 if [ `dirname $0` != "." ]; then
5     echo "only run this script like ./`basename $0`"
6     exit
7 fi
8
9 if [ -z $WORKSPACE ]; then
10     WORKSPACE=`pwd`
11 fi
12
13 # make sure that no VirtualBox processes are left running
14 cleanup_all() {
15     set +e
16     echo "$(date -u) - cleanup in progress..."
17     ps auxww | grep -e VBox -e qemu
18     cd $WORKSPACE/buildserver
19     vagrant halt
20     sleep 5
21     killall VBoxHeadless
22     sleep 5
23     killall -9 VBoxHeadless
24     echo "$(date -u) - cleanup done."
25 }
26 trap cleanup_all INT TERM EXIT
27
28 set -e
29 set -x
30
31 # make sure we have the vagrant box image cached
32 test -e ~/.cache/fdroidserver || mkdir -p ~/.cache/fdroidserver
33 cd ~/.cache/fdroidserver
34 wget --tries=1 --timeout=5 --continue https://f-droid.org/jessie64.box || true
35 echo "de3e3c4a9c13e8c015e30edeea0f583b195d1ee8ff9ad4814e933bbfb560200f  jessie64.box" > jessie64.box.sha256
36 sha256sum -c jessie64.box.sha256
37
38 # redirect homes to be in the git repo, so they'll get cleaned and reset
39 export XDG_CONFIG_HOME=$WORKSPACE
40 export VBOX_USER_HOME=$WORKSPACE/VirtualBox
41 mkdir $VBOX_USER_HOME
42 if which VBoxManage; then
43     VBoxManage setproperty machinefolder $WORKSPACE/virtualbox.d
44     VBoxManage setproperty logginglevel debug
45 fi
46 export VAGRANT_HOME=$WORKSPACE/vagrant.d
47 mkdir $VAGRANT_HOME
48
49 cd $WORKSPACE
50 echo "debian_mirror = 'http://ftp.uk.debian.org/debian/'" > $WORKSPACE/makebuildserver.config.py
51 echo "boot_timeout = 1200" >> $WORKSPACE/makebuildserver.config.py
52 echo "apt_package_cache = True" >> $WORKSPACE/makebuildserver.config.py
53 ./makebuildserver --verbose --clean
54
55 # this can be handled in the jenkins job, or here:
56 if [ -e fdroiddata ]; then
57     cd fdroiddata
58     git checkout master
59     git pull
60     cd ..
61 else
62     git clone --depth 1 https://gitlab.com/fdroid/fdroiddata.git fdroiddata
63 fi
64
65 cd fdroiddata
66 echo "build_server_always = True" > config.py
67 # if it can't build fdroid, then its really broken
68 ../fdroid build --verbose --stop --latest org.fdroid.fdroid
69 # Gradle, JNI, preassemble
70 ../fdroid build --verbose --stop org.adaway:55
71 # Uses verification
72 ../fdroid build --verbose --stop info.guardianproject.checkey:101
73 # building old versions should still work
74 ../fdroid build --verbose --stop org.fdroid.fdroid:96150