vinaigrette/scripts/rebuildd/build-binaries
2017-09-04 19:13:28 +02:00

62 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
codename=$1
package=$2
version=$3
arch=$4
source /home/vinaigrette/config/config
source /home/vinaigrette/scripts/package_helpers.sh
# Build only binary-only limited to architecture dependent packages
DEBBUILDOPTS="-B"
if [[ $arch == $DEFAULT_ARCH ]]; then
# Build architecture independent packages too
DEBBUILDOPTS="-b"
elif [[ $arch == all ]]; then
# Build architecture independent packages too on default arch
arch=$DEFAULT_ARCH
DEBBUILDOPTS="-b"
fi
# Retrieve the number of processors
if [ -x /usr/bin/getconf ]; then
JOBS=`getconf _NPROCESSORS_CONF`
else
JOBS=1
fi
echo "######################"
echo " Starting build ... "
echo "######################"
# Format needed pbuilder arguments
DEBBUILDOPTS="$DEBBUILDOPTS -j$JOBS"
DSC_FILE="${package}_${version}.dsc"
BASE_TGZ="${PBUILDER_IMAGES}/${arch}/${codename}.tgz"
EXTRA_OPTS=()
CONFIGFILE=""
# Use specific conf for nodejs builds
if [[ $package == "yunohost-admin" ]];
then
BASE_TGZ="${PBUILDER_IMAGES}/${arch}/${codename}-nodejs.tgz"
CONFIGFILE="--configfile $PBUILDER_CONF/nodejs.conf"
fi
if [[ $arch == "armhf" ]];
then
CONFIGFILE="--configfile $PBUILDER_CONF/armhf.conf"
fi
pbuilder build \
--basetgz "${BASE_TGZ}" \
--debbuildopts "${DEBBUILDOPTS}" \
${CONFIGFILE} \
"${EXTRA_OPTS[@]}" \
$DSC_FILE
exit_code=$?
exit $exit_code