fuel-plugin-bgpvpn/pre_build_hook

89 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# Add here any the actions which are required before plugin build
# like packages building, packages downloading from mirrors and so on.
# The script should return 0 if there were no errors.
set -eux
# Networking bgpvpn
NETWORKING_BGPVPN_REPO=${NETWORKING_BGPVPN_REPO:-https://github.com/openstack/networking-bgpvpn.git}
NETWORKING_BGPVPN_BRANCH=${NETWORKING_BGPVPN_BRANCH:-stable/newton}
#Networking odl
NETWORKING_ODL_REPO=${NETWORKING_ODL_REPO:-https://github.com/openstack/networking-odl.git}
NETWORKING_ODL_BRANCH=${NETWORKING_ODL_BRANCH:-stable/newton}
# For which systems odl package should be build
BUILD_FOR=${BUILD_FOR:-ubuntu}
DIR="$(dirname `readlink -f $0`)"
TMP_DIR="${DIR}/tmp"
#Remove temporary files
CLEANUP=${CLEANUP:-true}
function cleanup {
rm -rf "${TMP_DIR}"
}
function build_pkg {
# clean up old packages
rm -rf ${DIR}/repositories/${1}/*
case $1 in
ubuntu)
pushd "${DIR}/repositories/${1}/"
fpm --architecture all --force -s python -t deb -m 'mskalski@mirantis.com' \
--python-disable-dependency oslo.config ${TMP_DIR}/networking-bgpvpn/setup.py
# fpm -C is buggy https://github.com/jordansissel/fpm/issues/818
# so we have to change the rootdir manually
pushd ${TMP_DIR}/networking-bgpvpn/
fpm --architecture all --force -s dir -t deb -m 'nikolas.hermanns@ericsson.com' \
--config-files etc -n networking-bgpvpn-config -v 1.0 etc
mv networking-bgpvpn-config_*.deb ${DIR}/repositories/${1}/
popd
# Networking odl is needed cause it is a dependencie. There is no way yet to make
# the bgpvpn installation waiting for the ODL installation, when ODL installation
# is optional: http://permalink.gmane.org/gmane.comp.cloud.openstack.devel/63333
fpm --architecture all --force -s python -t deb -m 'nikolas.hermanns@ericsson.com' \
--no-python-dependencies -d python-pbr -d python-babel -d python-neutron ${TMP_DIR}/networking_odl/setup.py
popd
;;
*) echo "Not supported system"; exit 1;;
esac
}
command -v fpm >/dev/null 2>&1 || { echo >&2 "fpm ruby gem required but it's not installed. Aborting."; exit 1; }
cleanup
mkdir -p "${TMP_DIR}"
pushd $TMP_DIR
git clone $NETWORKING_BGPVPN_REPO networking-bgpvpn
pushd networking-bgpvpn
git checkout $NETWORKING_BGPVPN_BRANCH
sed -i -- 's/sphinxcontrib-blockdiag//' ./requirements.txt
sed -i -- 's/sphinxcontrib-seqdiag//' ./requirements.txt
popd
git clone $NETWORKING_ODL_REPO networking_odl
pushd networking_odl
git checkout $NETWORKING_ODL_BRANCH
popd
popd
for system in $BUILD_FOR
do
build_pkg $system
done
if [ "$CLEANUP" != false ];then
cleanup
fi