2016-02-03 22:00:48 +01:00
|
|
|
#!/bin/bash
|
2017-11-08 09:40:10 +01:00
|
|
|
#
|
|
|
|
# runs here:
|
|
|
|
# https://jenkins.debian.net/job/reproducible_setup_fdroid_build_environment
|
2016-02-03 22:00:48 +01:00
|
|
|
|
|
|
|
if [ `dirname $0` != "." ]; then
|
|
|
|
echo "only run this script like ./`basename $0`"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $WORKSPACE ]; then
|
|
|
|
WORKSPACE=`pwd`
|
|
|
|
fi
|
|
|
|
|
2018-09-24 12:15:46 +02:00
|
|
|
if [ -z $LC_ALL ] || [ $LC_ALL == "C.UTF-8" ] || [[ $LC_ALL != *.UTF-8 ]]; then
|
2018-10-17 17:17:16 +02:00
|
|
|
for var in `set | grep -Eo '^(LANG|LC_[A-Z]+)' | sort -u`; do
|
|
|
|
unset $var
|
|
|
|
done
|
2018-09-24 12:15:46 +02:00
|
|
|
export LC_ALL=en_US.UTF-8
|
2018-10-17 17:17:16 +02:00
|
|
|
echo "Forced locale to ${LC_ALL}:"
|
|
|
|
set | grep -E '^(LANG|LC_[A-Z]+)'
|
2018-09-24 12:15:46 +02:00
|
|
|
fi
|
|
|
|
|
2016-02-03 22:00:48 +01:00
|
|
|
# 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
|
2017-03-08 12:29:18 +01:00
|
|
|
ls -hl /var/lib/libvirt/images
|
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
|
|
|
|
|
|
|
|
test -e ~/.cache/fdroidserver || mkdir -p ~/.cache/fdroidserver
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2017-12-28 22:51:55 +01:00
|
|
|
rm -rf "$WORKSPACE"/../*/.testfiles
|
2017-12-05 12:26:15 +01:00
|
|
|
|
2019-11-18 18:13:37 +01:00
|
|
|
memtotal=$(grep ^MemTotal: /proc/meminfo | awk '{print $2}')
|
|
|
|
if [ $memtotal -gt 8092876 ]; then
|
|
|
|
memory=8192
|
|
|
|
else
|
|
|
|
memory=$(((memtotal / 1024) - 1024))
|
|
|
|
fi
|
|
|
|
if [ `nproc` -le 6 ]; then
|
|
|
|
cpus=$((`nproc` - 1))
|
|
|
|
else
|
|
|
|
cpus=6
|
|
|
|
fi
|
2019-02-12 20:42:17 +01:00
|
|
|
cat <<EOF > $WORKSPACE/makebuildserver.config.py
|
2019-02-14 14:09:06 +01:00
|
|
|
debian_mirror = 'http://deb.debian.org/debian/'
|
2019-02-12 20:42:17 +01:00
|
|
|
boot_timeout = 1200
|
|
|
|
apt_package_cache = True
|
|
|
|
copy_caches_from_host = True
|
2019-11-18 18:13:37 +01:00
|
|
|
memory = $memory
|
|
|
|
cpus = $cpus
|
2019-02-12 20:42:17 +01:00
|
|
|
EOF
|
2019-11-18 18:13:37 +01:00
|
|
|
|
|
|
|
cd $WORKSPACE
|
2017-03-24 20:04:50 +01:00
|
|
|
./makebuildserver -vv --clean
|
2016-02-03 22:00:48 +01:00
|
|
|
|
2017-03-24 00:49:02 +01:00
|
|
|
if [ -z "`vagrant box list | egrep '^buildserver\s+\((libvirt|virtualbox), [0-9]+\)$'`" ]; then
|
|
|
|
vagrant box list
|
|
|
|
echo "ERROR: buildserver box does not exist!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
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
|
2017-11-27 10:06:47 +01:00
|
|
|
while ! git fetch origin --tags --prune; do sleep 10; 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
|
2017-06-15 17:07:01 +02:00
|
|
|
git clean -fdx
|
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-11-27 09:58:51 +01:00
|
|
|
echo "build_server_always = True" > config.py
|
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!"
|
2017-03-24 00:49:02 +01:00
|
|
|
exit 1
|
2017-02-09 15:50:58 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
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
|
|
|
|
# building old versions should still work
|
2019-02-12 21:05:56 +01:00
|
|
|
../fdroid build --verbose --stop org.fdroid.fdroid:102350
|