2016-02-03 22:00:48 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ `dirname $0` != "." ]; then
|
|
|
|
echo "only run this script like ./`basename $0`"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $WORKSPACE ]; then
|
|
|
|
WORKSPACE=`pwd`
|
|
|
|
fi
|
|
|
|
|
|
|
|
# make sure that no VirtualBox processes are left running
|
|
|
|
cleanup_all() {
|
2016-09-15 14:38:36 +02:00
|
|
|
set +e
|
2016-02-03 22:00:48 +01:00
|
|
|
echo "$(date -u) - cleanup in progress..."
|
2016-09-15 14:38:36 +02:00
|
|
|
ps auxww | grep -e VBox -e qemu
|
2016-02-03 22:00:48 +01:00
|
|
|
cd $WORKSPACE/buildserver
|
2016-09-15 14:38:36 +02:00
|
|
|
vagrant halt
|
2016-02-03 22:00:48 +01:00
|
|
|
sleep 5
|
2016-09-15 14:38:36 +02:00
|
|
|
killall VBoxHeadless
|
2016-02-03 22:00:48 +01:00
|
|
|
sleep 5
|
2016-09-15 14:38:36 +02:00
|
|
|
killall -9 VBoxHeadless
|
2016-02-03 22:00:48 +01:00
|
|
|
echo "$(date -u) - cleanup done."
|
|
|
|
}
|
|
|
|
trap cleanup_all INT TERM EXIT
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
# make sure we have the vagrant box image cached
|
|
|
|
test -e ~/.cache/fdroidserver || mkdir -p ~/.cache/fdroidserver
|
|
|
|
cd ~/.cache/fdroidserver
|
2016-07-04 13:14:37 +02:00
|
|
|
wget --tries=1 --timeout=5 --continue https://f-droid.org/jessie64.box || true
|
|
|
|
echo "de3e3c4a9c13e8c015e30edeea0f583b195d1ee8ff9ad4814e933bbfb560200f jessie64.box" > jessie64.box.sha256
|
|
|
|
sha256sum -c jessie64.box.sha256
|
2016-02-03 22:00:48 +01:00
|
|
|
|
|
|
|
# redirect homes to be in the git repo, so they'll get cleaned and reset
|
|
|
|
export XDG_CONFIG_HOME=$WORKSPACE
|
|
|
|
export VBOX_USER_HOME=$WORKSPACE/VirtualBox
|
|
|
|
mkdir $VBOX_USER_HOME
|
2016-09-15 14:38:36 +02:00
|
|
|
if which VBoxManage; then
|
|
|
|
VBoxManage setproperty machinefolder $WORKSPACE/virtualbox.d
|
|
|
|
VBoxManage setproperty logginglevel debug
|
|
|
|
fi
|
2016-02-03 22:00:48 +01:00
|
|
|
export VAGRANT_HOME=$WORKSPACE/vagrant.d
|
|
|
|
mkdir $VAGRANT_HOME
|
|
|
|
|
|
|
|
cd $WORKSPACE
|
2017-03-16 14:48:08 +01:00
|
|
|
echo "debian_mirror = 'https://deb.debian.org/debian/'" > $WORKSPACE/makebuildserver.config.py
|
2016-02-03 22:00:48 +01:00
|
|
|
echo "boot_timeout = 1200" >> $WORKSPACE/makebuildserver.config.py
|
|
|
|
echo "apt_package_cache = True" >> $WORKSPACE/makebuildserver.config.py
|
2016-09-15 14:38:36 +02:00
|
|
|
./makebuildserver --verbose --clean
|
2016-02-03 22:00:48 +01:00
|
|
|
|
2016-02-03 22:02:50 +01:00
|
|
|
# this can be handled in the jenkins job, or here:
|
2016-02-25 15:47:31 +01:00
|
|
|
if [ -e fdroiddata ]; then
|
|
|
|
cd fdroiddata
|
2016-10-26 14:24:14 +02:00
|
|
|
while ! git fetch; do sleep 1; done
|
2017-02-10 12:45:04 +01:00
|
|
|
git remote update -p
|
2016-03-14 09:35:23 +01:00
|
|
|
git checkout master
|
2017-02-10 12:45:04 +01:00
|
|
|
git reset --hard origin/master
|
2016-02-25 15:47:31 +01:00
|
|
|
cd ..
|
|
|
|
else
|
|
|
|
git clone --depth 1 https://gitlab.com/fdroid/fdroiddata.git fdroiddata
|
2016-02-03 22:02:50 +01:00
|
|
|
fi
|
2016-02-25 15:47:31 +01:00
|
|
|
|
2016-02-03 22:02:50 +01:00
|
|
|
cd fdroiddata
|
2017-02-09 15:50:58 +01:00
|
|
|
|
|
|
|
if [ -z $ANDROID_HOME ]; then
|
|
|
|
if [ -e ~/.android/bashrc ]; then
|
|
|
|
. ~/.android/bashrc
|
|
|
|
else
|
|
|
|
echo "ANDROID_HOME must be set!"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
../fdroid init --verbose
|
|
|
|
export GNUPGHOME=$WORKSPACE/tests/gnupghome
|
|
|
|
echo "gpghome = '$GNUPGHOME'" >> config.py
|
|
|
|
echo "gpgkey = 'CE71F7FB'" >> config.py
|
|
|
|
echo "build_server_always = True" >> config.py
|
|
|
|
|
2016-07-04 16:34:11 +02:00
|
|
|
# if it can't build fdroid, then its really broken
|
|
|
|
../fdroid build --verbose --stop --latest org.fdroid.fdroid
|
2016-02-25 16:03:06 +01:00
|
|
|
# Gradle, JNI, preassemble
|
2016-07-07 21:44:55 +02:00
|
|
|
../fdroid build --verbose --stop org.adaway:55
|
2016-02-25 15:48:51 +01:00
|
|
|
# Uses verification
|
2016-07-07 21:44:55 +02:00
|
|
|
../fdroid build --verbose --stop info.guardianproject.checkey:101
|
|
|
|
# building old versions should still work
|
|
|
|
../fdroid build --verbose --stop org.fdroid.fdroid:96150
|
2017-02-09 15:50:58 +01:00
|
|
|
# test OTA update ZIP build and publish
|
2017-04-24 12:19:37 +02:00
|
|
|
../fdroid build --verbose --stop org.fdroid.fdroid.privileged.ota:2030
|
2017-02-09 15:50:58 +01:00
|
|
|
|
|
|
|
# publish process when building and signing are on separate machines
|
|
|
|
test -d repo || mkdir repo
|
|
|
|
test -d archive || mkdir archive
|
|
|
|
../fdroid publish --verbose
|
|
|
|
../fdroid gpgsign --verbose
|
|
|
|
../fdroid update --verbose --nosign
|
|
|
|
../fdroid signindex --verbose
|
2017-02-24 14:01:09 +01:00
|
|
|
|
|
|
|
../fdroid rewritemeta --verbose
|
|
|
|
git --no-pager diff
|