Rebase: upstream DEA mechanism changes
[armband.git] / patches / fuel-plugin-opendaylight / 0002-opnfv-quagga-Build-for-UBUNTU_ARCH.patch
1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Mon, 4 Jul 2016 20:44:49 +0200
3 Subject: [PATCH] opnfv-quagga: Build for UBUNTU_ARCH.
4
5 ODL itself is mostly arch-indep, but its deps (e.g. opnfv-quagga
6 and friends) are not.
7
8 Introduce opnfv-quagga building/packing for multiple archs, listed
9 in UBUNTU_ARCH, which holds a space-separated list of target
10 arch(s), represented in `dpkg --print-architecture` format.
11 Only applicable when "BUILD_FOR=ubuntu".
12
13 FIXME(armband): For now, only native building and prebuilt debs
14 are supported (no cross-building).
15
16 Due to the design of opnfv-packaging repo, it is easier to:
17 - patch upstream sources to support native arm64 builds (see [1]);
18 - add prebuilt arm64 binaries to output dir in git repo (like amd64),
19 submitted as pull request upstream [2];
20
21 Until above OPNFV-QUAGGA changes land upstream and/or are refactored,
22 rely on forked repository that contains above patches [3] on
23 branch "stable/colorado", including prebuilt binaries (DEBs) for:
24 - amd64 (also available in upstream repo);
25 - arm64 (submitted upstream in [3]);
26
27 [1] https://github.com/nikolas-hermanns/opnfv-quagga-packaging/pull/1
28 [2] https://github.com/nikolas-hermanns/opnfv-quagga-packaging/pull/2
29 [3] https://github.com/alexandruavadanii/opnfv-quagga-packaging
30
31 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
32 ---
33  pre_build_hook | 16 ++++++++++++++--
34  1 file changed, 14 insertions(+), 2 deletions(-)
35
36 diff --git a/pre_build_hook b/pre_build_hook
37 index f973826..953e66c 100755
38 --- a/pre_build_hook
39 +++ b/pre_build_hook
40 @@ -41,9 +41,17 @@ NETWORKING_ODL_BRANCH=${NETWORKING_ODL_BRANCH:-stable/mitaka}
41  OPNFV_QUAGGE_PACKAGING_REPO=${OPNFV_QUAGGE_PACKAGING_REPO:-https://github.com/nikolas-hermanns/opnfv-quagga-packaging}
42  OPNFV_QUAGGE_PACKAGING_BRANCH=stable/colorado
43  
44 -# For which systems odl package should be build
45 +# For which systems odl package should be built
46  BUILD_FOR=${BUILD_FOR:-ubuntu}
47  
48 +# For which architecture(s) package should be built
49 +# Only applicable when "BUILD_FOR=ubuntu"
50 +# ODL itself is mostly arch-indep, but its deps are not
51 +# All archs should be represented in `dpkg --print-architecture` format
52 +# UBUNTU_ARCH holds a space-separated list of target arch(s)
53 +# FIXME(armband): For now, only native building is supported!
54 +UBUNTU_ARCH=${UBUNTU_ARCH:-$(dpkg --print-architecture)}
55 +
56  DIR="$(dirname `readlink -f $0`)"
57  TMP_DIR="${DIR}/tmp"
58  MODULES="${DIR}/deployment_scripts/puppet/modules"
59 @@ -74,7 +82,10 @@ function add_opnfv_quagga {
60                  sudo apt-get -y install `cat requirements.txt`
61                  make -j6
62              fi
63 -            cp debian_package/* $path
64 +            # Filter only requested archs, bail on missing DEBs
65 +            for ARCH in ${UBUNTU_ARCH}; do
66 +                cp debian_package/*_${ARCH}.deb $path
67 +            done
68          popd
69      popd
70