aboutsummaryrefslogtreecommitdiffstats
path: root/patches/fuel-plugin-ovs/0007-AArch64-Add-support-for-downloading-prebuilt-DEBs.patch
blob: deeba6558e30d0192076db16cf06b335b3efe8d7 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Mon, 12 Sep 2016 18:02:42 +0200
Subject: [PATCH] AArch64: Add support for downloading prebuilt DEBs

[ anders.roxell@enea.com ]
ovs_build/build-ovs-dpdk: libxenstore3.0: version bump
+Yet another version bump.
+ovs_build/build-ovs-dpdk: libxenstore3.0: version bump to 3.0_4.4.2-0ubuntu0.14.04.9

Signed-off-by: Anders Roxell <anders.roxell@enea.com>
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 ovs_build/build-ovs-armband-fetch.sh | 45 ++++++++++++++++++++++++++++++++++++
 ovs_build/build-ovs-dpdk.sh          | 18 ++++++++++++++-
 ovs_build/build-ovs-nsh-dpdk.sh      | 15 +++++++++++-
 3 files changed, 76 insertions(+), 2 deletions(-)
 create mode 100755 ovs_build/build-ovs-armband-fetch.sh

diff --git a/ovs_build/build-ovs-armband-fetch.sh b/ovs_build/build-ovs-armband-fetch.sh
new file mode 100755
index 0000000..a810b93
--- /dev/null
+++ b/ovs_build/build-ovs-armband-fetch.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+set -eux
+
+# armband_fetch will download all binaries for one debian source package
+#
+# Usage:
+#   armband_fetch <src_deb_name> <src_deb_version> \
+#                 [<repo_base_url> \
+#                 [<repo_Sources_relative_url> \
+#                 [<repo_Packages_relative_url>]]] \
+#
+# e.g.:
+#   armband_fetch dpdk 16.07-0~u14.04+mos1+mos9.0+amos1 \
+#     https://linux.enea.com/mos-repos/ubuntu/9.0 \
+#     dists/mos9.0-fuel-plugin-ovs/main/source/Sources \
+#     dists/mos9.0-fuel-plugin-ovs/main/binary-arm64/Packages
+function armband_fetch() {
+  local name=$1
+  local ver=${2//\+/\\\+}
+  local repo_base_url=${3:-http://linux.enea.com/mos-repos/ubuntu/9.0}
+  local repo_Sources_url=${4:-dists/mos9.0-fuel-plugin-ovs/main/source/Sources}
+  local repo_Packages_url=${5:-dists/mos9.0-fuel-plugin-ovs/main/binary-arm64/Packages}
+  local found=false
+
+  # Fetch Sources & Packages files if not already present
+  if [ ! -f Sources -o ! -f Packages ]; then
+    sudo apt-get -y --force-yes install wget
+    wget -c "${repo_base_url}/${repo_Sources_url}"
+    wget -c "${repo_base_url}/${repo_Packages_url}"
+  fi
+
+  L=$(grep -Pzo "(?s)(?<=^Package: ${name}\n^Binary: )(\N*?)(?=\n^Version: ${ver})" \
+    Sources | tr -d ',')
+  for deb_binary in ${L}; do
+    D=$(grep -Po "(?<=^Filename: )(.*?\/${deb_binary}_${ver}_.*?\.deb)" Packages) || true
+    if [ -n "${D}" ]; then
+      wget -c "${repo_base_url}/${D}" && found=true
+    fi
+  done
+  if [ ${found} = false ]; then
+    echo "ERROR: Could not find DEBs for pkg/ver: ${name}/${ver}"
+    exit 1
+  fi
+}
diff --git a/ovs_build/build-ovs-dpdk.sh b/ovs_build/build-ovs-dpdk.sh
index a0c50e3..8d70265 100755
--- a/ovs_build/build-ovs-dpdk.sh
+++ b/ovs_build/build-ovs-dpdk.sh
@@ -13,11 +13,13 @@ export DEB_BUILD_OPTIONS='parallel=8 nocheck'
 # AArch64 specifics, repository base URL, debian build versions
 AARCH64_REPO=${AARCH64_REPO:-'https://linux.enea.com/mos-repos/ubuntu/9.0'}
 AARCH64_DPDK_DEBV=${AARCH64_DPDK_DEBV:-'0~u14.04+mos1+mos9.0+amos1'}
+AARCH64_OVS_DEBV=${AARCH64_OVS_DEBV:-'2.5.90-1'}

 # Keep track of native arch (BUILD_ARCH) and target arch(s) (UBUNTU_ARCH)
 # All archs should be represented in `dpkg --print-architecture` format
 # UBUNTU_ARCH holds a space-separated list of target arch(s)
-# FIXME(armband): For now, only native building is supported!
+# FIXME(armband): For now, only native building and/or downloading prebuilt
+# debian binaries is supported!
 BUILD_ARCH=$(dpkg --print-architecture)
 UBUNTU_ARCH=${UBUNTU_ARCH:-${BUILD_ARCH}}

@@ -92,6 +94,20 @@ for ARCH in ${UBUNTU_ARCH}; do

     cd ${BUILD_DEST}/ovs
     debian/rules build; fakeroot debian/rules binary
+  else
+    # FIXME(armband): No cross-build support yet, download prebuilt DEBs
+    if [ ${ARCH} = 'arm64' ]; then
+      source ${BUILD_SRC}/build-ovs-armband-fetch.sh
+      # Fetch Sources/Packages from Armband and construct list of packages to download
+      armband_fetch 'dpdk' "16.07-${AARCH64_DPDK_DEBV}"
+      armband_fetch 'openvswitch-dpdk' "${AARCH64_OVS_DEBV}"
+      armband_fetch 'openvswitch' "${AARCH64_OVS_DEBV}"
+      # libxenstore (equivalent to `apt-get download` for native build)
+      AARCH64_LIBXENSTORE='libxenstore3.0_4.4.2-0ubuntu0.14.04.9_arm64.deb'
+      wget -c "http://ports.ubuntu.com/pool/main/x/xen/${AARCH64_LIBXENSTORE}"
+    else
+      echo "WARNING: Architecture [${ARCH}] does not provide precompiled DEBs, skipping!"
+    fi
   fi

   # Store DEBs in <${BUILD_DEB}/${ARCH}/> dir and cleanup
diff --git a/ovs_build/build-ovs-nsh-dpdk.sh b/ovs_build/build-ovs-nsh-dpdk.sh
index 59d8a79..9d8a837 100755
--- a/ovs_build/build-ovs-nsh-dpdk.sh
+++ b/ovs_build/build-ovs-nsh-dpdk.sh
@@ -11,10 +11,14 @@ DIR="$(dirname `readlink -f $0`)"

 export DEB_BUILD_OPTIONS='parallel=8 nocheck'

+# AArch64 specifics, repository base URL, debian build versions
+AARCH64_OVS_NSH_DEBV=${AARCH64_OVS_NSH_DEBV:-'2.5.90-1.nsh'}
+
 # Keep track of native arch (BUILD_ARCH) and target arch(s) (UBUNTU_ARCH)
 # All archs should be represented in `dpkg --print-architecture` format
 # UBUNTU_ARCH holds a space-separated list of target arch(s)
-# FIXME(armband): For now, only native building is supported!
+# FIXME(armband): For now, only native building and/or downloading prebuilt
+# debian binaries is supported!
 BUILD_ARCH=$(dpkg --print-architecture)
 UBUNTU_ARCH=${UBUNTU_ARCH:-${BUILD_ARCH}}

@@ -119,6 +123,15 @@ openvswitch (${OVS_VER}-1.nsh) unstable; urgency=low
  -- Open vSwitch team <dev@openvswitch.org>  $(date --rfc-2822)
 EOF
     debian/rules build; fakeroot debian/rules binary
+  else
+    # FIXME(armband): No cross-build support yet, download prebuilt DEBs
+    if [ ${ARCH} = 'arm64' ]; then
+      source ${DIR}/build-ovs-armband-fetch.sh
+      # FIXME(armband): https://jira.opnfv.org/browse/ARMBAND-86
+      armband_fetch 'openvswitch' "${AARCH64_OVS_NSH_DEBV}"
+    else
+      echo "WARNING: Architecture [${ARCH}] does not provide precompiled DEBs, skipping!"
+    fi
   fi

   # Store DEBs in <${BUILD_DEST}/${ARCH}/> dir and cleanup