From: Alexandru Avadanii Date: Sun, 26 Jun 2016 20:00:22 +0200 Subject: [PATCH] pre_build_hook: Introduce USE_DOCKER option The build system uses Ubuntu Trusty, which is not properly supported by Docker on AArch64 architecture. Introduce a new environment variable for enabling/disabling build containerization, and disable by default said variable for AArch64. This requires a slight rework of the pre_build_hook script. NOTE: Setting USE_DOCKER to false will build the packages on the host machine directly. AArch64 WARNING: This build will install packages automatically! Change-Id: Ib1294949ecc1767f12631a82e2c7099c45fcb615 Signed-off-by: Alexandru Avadanii --- pre_build_hook | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/pre_build_hook b/pre_build_hook index 63cf7b4..b9ae6bb 100755 --- a/pre_build_hook +++ b/pre_build_hook @@ -3,27 +3,40 @@ set -eux BUILD_FOR=${BUILD_FOR:-ubuntu} +USE_DOCKER=${USE_DOCKER:-true} DIR="$(dirname `readlink -f $0`)" +if [ `uname -m` = 'aarch64' ]; then + USE_DOCKER=false +fi + function build_pkg { case $1 in ubuntu) - rm -rf ${DIR}/repositories/ubuntu; mkdir -p ${DIR}/repositories/ubuntu + DEB_DIR=${DIR}/deb-ovs-dpdk + DEB_DIR_NSH=${DIR}/deb-ovs-nsh-dpdk + + rm -rf ${DIR}/repositories/ubuntu ${DEB_DIR} ${DEB_DIR_NSH} + mkdir -p ${DIR}/repositories/ubuntu ${DEB_DIR} ${DEB_DIR_NSH} + sudo chmod -R 777 ${DEB_DIR} ${DEB_DIR_NSH} cd ${DIR}/ovs_build - sudo docker build -t ovs_build . + if [ "${USE_DOCKER}" = true ]; then + sudo docker build -t ovs_build . + sudo docker run -v ${DEB_DIR}:/deb -t ovs_build /ovs_build/build-ovs-dpdk.sh + sudo docker run -v ${DEB_DIR_NSH}:/deb -t ovs_build /ovs_build/build-ovs-nsh-dpdk.sh + else + rm -rf /tmp/ovs-build-{,nsh-}dpdk; mkdir -p /tmp/ovs-build-{,nsh-}dpdk + BUILD_HOME=/tmp/ovs-build-dpdk BUILD_DEB=${DEB_DIR} ./build-ovs-dpdk.sh + BUILD_HOME=/tmp/ovs-build-nsh-dpdk BUILD_DEST=${DEB_DIR_NSH} ./build-ovs-nsh-dpdk.sh + rm -rf /tmp/ovs-build-{,nsh-}dpdk + fi - DEB_DIR=${DIR}/deb-ovs-dpdk - rm -rf ${DEB_DIR}; mkdir -p ${DEB_DIR}; chmod 777 ${DEB_DIR}; - sudo docker run -v ${DEB_DIR}:/deb -t ovs_build /ovs_build/build-ovs-dpdk.sh cd ${DEB_DIR}; tar czvf ../repositories/ubuntu/ovs-dpdk.tar.gz .; cd ..; rm -rf ${DEB_DIR} - DEB_DIR=${DIR}/deb-ovs-nsh-dpdk - rm -rf ${DEB_DIR}; mkdir -p ${DEB_DIR}; chmod 777 ${DEB_DIR}; - sudo docker run -v ${DEB_DIR}:/deb -t ovs_build /ovs_build/build-ovs-nsh-dpdk.sh - cd ${DEB_DIR}; tar czvf ../repositories/ubuntu/ovs-nsh-dpdk.tar.gz .; - cd ..; rm -rf ${DEB_DIR} + cd ${DEB_DIR_NSH}; tar czvf ../repositories/ubuntu/ovs-nsh-dpdk.tar.gz .; + cd ..; rm -rf ${DEB_DIR_NSH} ;; *) echo "Not supported system"; exit 1;;