nailgun: Add NIC vendorid and device id for Cavium NIC
[armband.git] / patches / fuel-plugin-ovs / 0002-deb-src-Enable-building-Debian-source-pkgs.patch
1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2017 Enea AB and others.
3 :
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Wed, 25 Jan 2017 22:11:44 +0100
11 Subject: [PATCH] deb-src: Enable building Debian source pkgs
12
13 Armband plans on shipping prebuilt binaries.
14 Opensource rules dictate they should be accompanied by the
15 corresponding source packages.
16
17 So, add the possibility to also build Debian sources when a
18 dummy "ovs_build/build_debian_source" file exists (to avoid
19 passing an useless env var to each docker run).
20
21 Change-Id: I4e308d84c2eb01af043ed73440c46fc692c30d12
22 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
23 ---
24  ovs_build/build-ovs-dpdk.sh                        | 28 +++++++++++++++++-----
25  ovs_build/build-ovs-nsh.sh                         | 26 +++++++++++++++++---
26  .../debian/patches/series                          |  1 -
27  3 files changed, 45 insertions(+), 10 deletions(-)
28  delete mode 100644 ovs_build/openvswitch_2.6-dpdk_16.07/debian/patches/series
29
30 diff --git a/ovs_build/build-ovs-dpdk.sh b/ovs_build/build-ovs-dpdk.sh
31 index 7ce2a62..8dd7430 100755
32 --- a/ovs_build/build-ovs-dpdk.sh
33 +++ b/ovs_build/build-ovs-dpdk.sh
34 @@ -11,14 +11,30 @@ DEB_ARCH="$(dpkg --print-architecture)"
35
36  export DEB_BUILD_OPTIONS='parallel=8 nocheck'
37
38 +function debian_build() {
39 +  if [ -f "${BUILD_SRC}/build_debian_source" ]; then
40 +    dpkg-source -b .
41 +    cp -f ../*.{dsc,xz} ${BUILD_HOME}/deb
42 +  fi
43 +  debian/rules build; fakeroot debian/rules binary
44 +}
45 +
46 +function debian_src_prepare_ovs() {
47 +  if [ -f "${BUILD_SRC}/build_debian_source" ]; then
48 +    suffix="${OVS_VER}.orig.tar.xz"
49 +    tar cJf ../openvswitch_${suffix} --exclude='./debian' .
50 +    cd ..; ln -sf openvswitch_${suffix} openvswitch-dpdk_${suffix}; cd -
51 +  fi
52 +}
53 +
54  sudo apt-get update
55  sudo apt-get -y --force-yes install devscripts dpkg-dev git wget dkms
56
57  rm -rf ${BUILD_HOME}; mkdir -p ${BUILD_HOME}/deb
58
59  cd ${BUILD_HOME}
60 -wget -c http://fast.dpdk.org/rel/dpdk-16.07.tar.xz
61 -xz -d dpdk-16.07.tar.xz; tar xvf dpdk-16.07.tar
62 +wget -c http://fast.dpdk.org/rel/dpdk-16.07.tar.xz -O dpdk_16.07.orig.tar.xz
63 +tar xJvf dpdk_16.07.orig.tar.xz
64  cd dpdk-16.07
65  cp -r ${BUILD_SRC}/dpdk_16.07.fuel/debian .
66  cat << EOF > debian/changelog
67 @@ -45,7 +61,7 @@ sudo apt-get install -y --force-yes debhelper \
68                 python-sphinx  \
69                 texlive-fonts-recommended  \
70                 texlive-latex-extra
71 -debian/rules build; fakeroot debian/rules binary
72 +debian_build
73
74  cd ${BUILD_HOME}
75  sudo apt-get install -y --force-yes hwdata
76 @@ -73,7 +89,7 @@ sudo apt-get install -y --force-yes autoconf \
77                 python-six
78
79  git clone https://github.com/openvswitch/ovs.git
80 -cd ovs; git checkout ${OVS_COMMIT}; rm -rf .git
81 +cd ovs; git checkout ${OVS_COMMIT}; rm -rf .git; debian_src_prepare_ovs
82  cd ${BUILD_HOME}; cp -r ovs ovs-dpdk
83
84  cd ovs-dpdk
85 @@ -86,10 +102,10 @@ openvswitch-dpdk (${OVS_VER}-1) unstable; urgency=low
86   -- Open vSwitch team <dev@openvswitch.org>  $(date --rfc-2822)
87  EOF
88
89 -debian/rules build; fakeroot debian/rules binary
90 +debian_build
91
92  cd ${BUILD_HOME}/ovs
93 -debian/rules build; fakeroot debian/rules binary
94 +debian_build
95
96  cp -r ${BUILD_HOME}/*.deb ${BUILD_HOME}/deb
97  cd ${BUILD_HOME}/deb
98 diff --git a/ovs_build/build-ovs-nsh.sh b/ovs_build/build-ovs-nsh.sh
99 index dbebdb2..efbabab 100755
100 --- a/ovs_build/build-ovs-nsh.sh
101 +++ b/ovs_build/build-ovs-nsh.sh
102 @@ -11,6 +11,22 @@ DEB_ARCH="$(dpkg --print-architecture)"
103
104  export DEB_BUILD_OPTIONS='parallel=8 nocheck'
105
106 +function debian_build() {
107 +  if [ -f "${BUILD_SRC}/build_debian_source" ]; then
108 +    dpkg-source -b .
109 +    cp -f ../*.{dsc,xz} ${BUILD_HOME}/deb
110 +  fi
111 +  debian/rules build; fakeroot debian/rules binary
112 +}
113 +
114 +function debian_src_prepare_ovs() {
115 +  if [ -f "${BUILD_SRC}/build_debian_source" ]; then
116 +    suffix="${OVS_VER}.orig.tar.xz"
117 +    tar cJf ../openvswitch_${suffix} --exclude='./debian' .
118 +    cd ..; ln -sf openvswitch_${suffix} openvswitch-dpdk_${suffix}; cd -
119 +  fi
120 +}
121 +
122  sudo apt-get update
123  sudo apt-get -y --force-yes install devscripts dpkg-dev git wget dkms
124
125 @@ -39,12 +55,16 @@ sudo apt-get install -y --force-yes autoconf \
126                 python-six
127
128  git clone https://github.com/openvswitch/ovs.git
129 -cd ovs; git checkout ${OVS_COMMIT}; rm -rf .git
130 +cd ovs; git checkout ${OVS_COMMIT}; rm -rf .git; debian_src_prepare_ovs
131 +mkdir -p debian/patches; mkdir -p .pc
132  PATCHES=$(cd ${BUILD_SRC}/ovs_nsh_patches/v2.6.1/; echo *patch)
133  for patch in ${PATCHES}
134  do
135 -    patch -p1 < ${BUILD_SRC}/ovs_nsh_patches/v2.6.1/${patch}
136 +    echo "${patch}" >> debian/patches/series
137 +    cp ${BUILD_SRC}/ovs_nsh_patches/v2.6.1/${patch} debian/patches/
138 +    patch -p1 < debian/patches/${patch}
139  done
140 +cp debian/patches/series .pc/applied-patches
141
142  cat << EOF > debian/changelog
143  openvswitch (${OVS_VER}-1.nsh) unstable; urgency=low
144 @@ -53,7 +73,7 @@ openvswitch (${OVS_VER}-1.nsh) unstable; urgency=low
145
146   -- Open vSwitch team <dev@openvswitch.org>  $(date --rfc-2822)
147  EOF
148 -debian/rules build; fakeroot debian/rules binary
149 +debian_build
150
151  cp -r ${BUILD_HOME}/*.deb ${BUILD_HOME}/deb
152  cd ${BUILD_HOME}/deb
153 diff --git a/ovs_build/openvswitch_2.6-dpdk_16.07/debian/patches/series b/ovs_build/openvswitch_2.6-dpdk_16.07/debian/patches/series
154 deleted file mode 100644
155 index 8b13789..0000000
156 --- a/ovs_build/openvswitch_2.6-dpdk_16.07/debian/patches/series
157 +++ /dev/null
158 @@ -1 +0,0 @@
159 -