4 # https://jenkins.debian.net/job/reproducible_setup_fdroid_build_environment
6 if [ `dirname $0` != "." ]; then
7 echo "only run this script like ./`basename $0`"
11 if [ -z $WORKSPACE ]; then
15 # make sure that no VirtualBox processes are left running
18 echo "$(date -u) - cleanup in progress..."
19 ps auxww | grep -e VBox -e qemu
20 virsh --connect qemu:///system list --all
21 ls -hl /var/lib/libvirt/images
22 cd $WORKSPACE/buildserver
27 killall -9 VBoxHeadless
28 echo "$(date -u) - cleanup done."
30 trap cleanup_all INT TERM EXIT
35 # make sure we have the vagrant box image cached
36 test -e ~/.cache/fdroidserver || mkdir -p ~/.cache/fdroidserver
37 cd ~/.cache/fdroidserver
38 wget --tries=1 --timeout=5 --continue https://f-droid.org/jessie64.box || true
39 echo "de3e3c4a9c13e8c015e30edeea0f583b195d1ee8ff9ad4814e933bbfb560200f jessie64.box" > jessie64.box.sha256
40 sha256sum -c jessie64.box.sha256
42 # redirect homes to be in the git repo, so they'll get cleaned and reset
43 export XDG_CONFIG_HOME=$WORKSPACE
44 export VBOX_USER_HOME=$WORKSPACE/VirtualBox
46 if which VBoxManage; then
47 VBoxManage setproperty machinefolder $WORKSPACE/virtualbox.d
48 VBoxManage setproperty logginglevel debug
50 export VAGRANT_HOME=$WORKSPACE/vagrant.d
53 # delete leftovers from previous run
54 virsh -c qemu:///system undefine buildserver_default \
55 --nvram --managed-save --remove-all-storage --snapshots-metadata || true
56 virsh -c qemu:///system undefine builder_default \
57 --nvram --managed-save --remove-all-storage --snapshots-metadata || true
60 echo "debian_mirror = 'https://deb.debian.org/debian/'" > $WORKSPACE/makebuildserver.config.py
61 echo "boot_timeout = 1200" >> $WORKSPACE/makebuildserver.config.py
62 echo "apt_package_cache = True" >> $WORKSPACE/makebuildserver.config.py
63 echo "copy_caches_from_host = True" >> $WORKSPACE/makebuildserver.config.py
64 echo "memory = 6144" >> $WORKSPACE/makebuildserver.config.py
65 echo "cpus = 2" >> $WORKSPACE/makebuildserver.config.py
66 ./makebuildserver -vv --clean
68 if [ -z "`vagrant box list | egrep '^buildserver\s+\((libvirt|virtualbox), [0-9]+\)$'`" ]; then
70 echo "ERROR: buildserver box does not exist!"
74 # this can be handled in the jenkins job, or here:
75 if [ -e fdroiddata ]; then
77 while ! git fetch origin --tags --prune; do sleep 10; done
80 git reset --hard origin/master
84 git clone --depth 1 https://gitlab.com/fdroid/fdroiddata.git fdroiddata
88 echo "build_server_always = True" > config.py
90 if [ -z $ANDROID_HOME ]; then
91 if [ -e ~/.android/bashrc ]; then
94 echo "ANDROID_HOME must be set!"
99 # if it can't build fdroid, then its really broken
100 ../fdroid build --verbose --stop --latest org.fdroid.fdroid
101 # Gradle, JNI, preassemble
102 ../fdroid build --verbose --stop org.adaway:55
103 # building old versions should still work
104 ../fdroid build --verbose --stop org.fdroid.fdroid:96150
105 # test OTA update ZIP build and publish
106 ../fdroid build --verbose --stop org.fdroid.fdroid.privileged.ota:2070