2017-08-29 17:17:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
codename=$1
|
|
|
|
package=$2
|
|
|
|
version=$3
|
|
|
|
arch=$4
|
|
|
|
|
2020-03-15 23:30:47 +01:00
|
|
|
sendxmpppy "Starting build ${package}/${version} for arch=$arch ..."
|
2018-06-30 20:29:10 +02:00
|
|
|
|
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
|
|
|
|
|
2020-02-12 18:57:41 +01:00
|
|
|
## Retrieve the number of processors for parallel building
|
2020-03-15 23:30:47 +01:00
|
|
|
## N.B. : disabled by Alex on Feb 12 2020 because this makes some build fail on buster for some reason..
|
2020-02-12 18:57:41 +01:00
|
|
|
#if [ -x /usr/bin/getconf ]; then
|
|
|
|
# JOBS=`getconf _NPROCESSORS_CONF`
|
|
|
|
#else
|
|
|
|
# JOBS=1
|
|
|
|
#fi
|
|
|
|
#DEBBUILDOPTS="$DEBBUILDOPTS -j$JOBS"
|
2017-08-29 17:17:25 +02:00
|
|
|
|
2017-09-04 19:13:28 +02:00
|
|
|
echo "######################"
|
|
|
|
echo " Starting build ... "
|
|
|
|
echo "######################"
|
2017-08-29 17:17:25 +02:00
|
|
|
|
|
|
|
# Format needed pbuilder arguments
|
|
|
|
DSC_FILE="${package}_${version}.dsc"
|
2018-04-26 18:17:56 +02:00
|
|
|
BASE_TGZ="${PBUILDER_IMAGES}/${codename}-${arch}.tgz"
|
2017-08-29 17:17:25 +02:00
|
|
|
EXTRA_OPTS=()
|
2017-09-04 19:13:28 +02:00
|
|
|
CONFIGFILE=""
|
2017-08-29 17:17:25 +02:00
|
|
|
|
|
|
|
# Use specific conf for nodejs builds
|
2017-09-04 19:13:28 +02:00
|
|
|
if [[ $package == "yunohost-admin" ]];
|
|
|
|
then
|
|
|
|
CONFIGFILE="--configfile $PBUILDER_CONF/nodejs.conf"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $arch == "armhf" ]];
|
|
|
|
then
|
|
|
|
CONFIGFILE="--configfile $PBUILDER_CONF/armhf.conf"
|
2017-08-29 17:17:25 +02:00
|
|
|
fi
|
|
|
|
|
2018-04-26 04:23:20 +02:00
|
|
|
if [[ $arch == "armel" ]];
|
|
|
|
then
|
|
|
|
CONFIGFILE="--configfile $PBUILDER_CONF/armel.conf"
|
|
|
|
fi
|
|
|
|
|
2018-04-23 19:24:59 +02:00
|
|
|
if [[ $arch == "arm64" ]];
|
|
|
|
then
|
|
|
|
CONFIGFILE="--configfile $PBUILDER_CONF/arm64.conf"
|
|
|
|
fi
|
|
|
|
|
2020-02-12 18:57:41 +01:00
|
|
|
echo "Running 'pbuilder build --basetgz "${BASE_TGZ}" --debbuildopts "${DEBBUILDOPTS}" ${CONFIGFILE} "${EXTRA_OPTS[@]}" $DSC_FILE"
|
|
|
|
|
2017-09-04 19:13:28 +02:00
|
|
|
pbuilder build \
|
|
|
|
--basetgz "${BASE_TGZ}" \
|
|
|
|
--debbuildopts "${DEBBUILDOPTS}" \
|
|
|
|
${CONFIGFILE} \
|
|
|
|
"${EXTRA_OPTS[@]}" \
|
|
|
|
$DSC_FILE
|
2017-08-29 17:17:25 +02:00
|
|
|
|
2017-09-04 19:13:28 +02:00
|
|
|
exit_code=$?
|
2017-08-29 17:17:25 +02:00
|
|
|
|
2018-06-30 20:29:10 +02:00
|
|
|
if [[ $exit_code != 0 ]];
|
|
|
|
then
|
2020-03-15 23:30:47 +01:00
|
|
|
sendxmpppy "Building ${package}/${version} for arch=$arch failed ?!"
|
2018-06-30 20:29:10 +02:00
|
|
|
fi
|
|
|
|
|
2017-08-29 17:17:25 +02:00
|
|
|
exit $exit_code
|