vinaigrette/scripts/rebuildd/build-binaries

65 lines
1.5 KiB
Text
Raw Normal View History

2017-08-29 17:17:25 +02:00
#!/bin/bash
codename=$1
package=$2
version=$3
arch=$4
2017-08-30 05:51:28 +02:00
source /home/vinaigrette/config/config
2017-08-31 00:35:22 +02:00
source /home/vinaigrette/scripts/package_helpers.sh
2017-08-29 17:17:25 +02:00
# 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 building..."
# Format needed pbuilder arguments
DEBBUILDOPTS="$DEBBUILDOPTS -j$JOBS"
DSC_FILE="${package}_${version}.dsc"
2017-08-30 05:51:28 +02:00
BASE_TGZ="${PBUILDER_IMAGES}/${arch}/${codename}.tgz"
2017-08-29 17:17:25 +02:00
EXTRA_OPTS=()
# Use specific conf for nodejs builds
if [[ $package =~ ^yunohost-admin$ ]]; then
2017-08-30 05:51:28 +02:00
base_tgz="${PBUILDER_IMAGES}/${arch}/${codename}-nodejs.tgz"
2017-08-29 17:17:25 +02:00
if [[ -f ${base_tgz} ]]; then
echo "+ using nodejs environment..."
BASE_TGZ=${base_tgz}
fi
fi
case $arch in
armhf)
pbuilder build --debbuildopts "${DEBBUILDOPTS}" \
2017-09-01 17:34:59 +02:00
--configfile $PBUILDER_CONF/armhf.conf \
2017-08-29 17:17:25 +02:00
--basetgz $BASE_TGZ "${EXTRA_OPTS[@]}" $DSC_FILE
exit_code=$?
;;
amd64|i386)
pbuilder build --debbuildopts "${DEBBUILDOPTS}" \
--basetgz $BASE_TGZ "${EXTRA_OPTS[@]}" $DSC_FILE
exit_code=$?
;;
esac
exit $exit_code