vinaigrette/scripts/rebuildd/build-binaries

81 lines
2 KiB
Bash
Executable file

#!/bin/bash
codename=$1
package=$2
version=$3
arch=$4
sendxmpppy "Starting build ${package}/${version} for $arch ..."
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 for parallel building
## N.B. : disabled by Alex on Feb 12 2020 because this makes some build fail on buster for some reason...
#if [ -x /usr/bin/getconf ]; then
# JOBS=`getconf _NPROCESSORS_CONF`
#else
# JOBS=1
#fi
#DEBBUILDOPTS="$DEBBUILDOPTS -j$JOBS"
echo "######################"
echo " Starting build ... "
echo "######################"
# Format needed pbuilder arguments
DSC_FILE="${package}_${version}.dsc"
BASE_TGZ="${PBUILDER_IMAGES}/${codename}-${arch}.tgz"
EXTRA_OPTS=()
CONFIGFILE=""
# Use specific conf for nodejs builds
if [[ $package == "yunohost-admin" ]];
then
CONFIGFILE="--configfile $PBUILDER_CONF/nodejs.conf"
fi
if [[ $arch == "armhf" ]];
then
CONFIGFILE="--configfile $PBUILDER_CONF/armhf.conf"
fi
if [[ $arch == "armel" ]];
then
CONFIGFILE="--configfile $PBUILDER_CONF/armel.conf"
fi
if [[ $arch == "arm64" ]];
then
CONFIGFILE="--configfile $PBUILDER_CONF/arm64.conf"
fi
echo "Running 'pbuilder build --basetgz "${BASE_TGZ}" --debbuildopts "${DEBBUILDOPTS}" ${CONFIGFILE} "${EXTRA_OPTS[@]}" $DSC_FILE"
pbuilder build \
--basetgz "${BASE_TGZ}" \
--debbuildopts "${DEBBUILDOPTS}" \
${CONFIGFILE} \
"${EXTRA_OPTS[@]}" \
$DSC_FILE
exit_code=$?
if [[ $exit_code != 0 ]];
then
sendxmpppy "Building ${package}/${version} for $arch failed ?!"
fi
exit $exit_code