aboutsummaryrefslogtreecommitdiffstats
path: root/patches/fuel-plugin-ovs/0005-pre_build_hook-Introduce-USE_DOCKER-option.patch
blob: dbbfefcfedec02a0a46f1454dcd68ea52fdd809d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
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 <Alexandru.Avadanii@enea.com>
---
 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;;