Merge "vswitchperf: Arch-indep build."
[armband.git] / patches / opnfv-fuel / 000098-FIXME-build-fuel-main-Decouple-patches-Makefile.patch
1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Sat, 18 Jun 2016 01:09:27 +0200
3 Subject: [PATCH] WIP: build: fuel-main: Decouple patches, Makefile.
4
5 FIXME: Not tested, only a discussion starter.
6
7 Submitted upstream in Fuel@OPNFv, see change-id.
8
9 ARMBAND changes:
10 Upstream removed all mirrors but usa and cz, and changed
11 its default to mirror.fuel-infra.org in [1].
12
13 This allows us to drop patching of fuel-main/config.mk
14 with the Czech mirror.
15
16 If needed, USE_MIRROR=cz can be specified as an env var.
17
18 FIXME: Remove when Fuel@OPNFV pulls change and deals with it.
19
20 Use `git apply` and/or `git am` in favor of `patch`.
21 Change patches from old context format to unified diff.
22
23 This change allows us to decouple Makefile and patches.
24 This means we no longer have to manually stage touched files
25 before committing them to git.
26
27 Possible improvements:
28 - replace cz mirror patch with USE_MIRROR=cz makevar;
29 - move patches to separate dir and add ordering info (prefix);
30 - merge patches (currently we have one per touched file);
31
32 Remove obsolete (unused?) patch:
33 - fuel-main_docker_version.patch
34
35 [1] https://github.com/openstack/fuel-main/commit/
36     751d502cfe15d9c9df0ee89530ac3b0b73aa1638
37
38 Change-Id: I5b621370993b259779c813b47105f632948e6da7
39 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
40 ---
41  build/Makefile                       |  17 ++--
42  build/bootstrap_admin_node.sh.patch  | 167 +++++++++++++++--------------------
43  build/fuel-main_docker_version.patch |  20 -----
44  build/isolinux.cfg.patch             |  43 +++++----
45  build/repo-mirror-cz.patch           |  32 +++----
46  5 files changed, 113 insertions(+), 166 deletions(-)
47  delete mode 100644 build/fuel-main_docker_version.patch
48
49 diff --git a/build/Makefile b/build/Makefile
50 index 956183c..69e5690 100644
51 --- a/build/Makefile
52 +++ b/build/Makefile
53 @@ -109,9 +109,9 @@ $(ISOCACHE):
54                 cd /tmp && git clone $(FUEL_MAIN_REPO); \
55         fi
56         cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG)
57 -       @echo "fuel" `git -C /tmp/fuel-main show | grep commit | head -1 | cut -d " " -f2` >> $(VERSION_FILE)
58 -       # Patch for using the Czech Fuel mirror
59 -       cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/repo-mirror-cz.patch
60 +       @echo "fuel" `git -C /tmp/fuel-main rev-parse HEAD` >> $(VERSION_FILE)
61 +       # Patch for using the Czech Fuel mirror (non-committed)
62 +       cd /tmp/fuel-main && git apply $(TOPDIR)/repo-mirror-cz.patch
63         # Remove Docker optimizations, otherwise multistrap will fail during
64         # Fuel build.
65         sudo rm -f /etc/apt/apt.conf.d/docker*
66 @@ -135,13 +135,10 @@ $(ISOCACHE):
67         # OPNFV patches at Fuel build time
68         # Need to be commited in order for them to be considered by the Fuel
69         # build system
70 -       cd /tmp/fuel-main/iso && git config user.name "Fuel OPNFV"
71 -       cd /tmp/fuel-main/iso && git config user.email "fuel@opnfv.org"
72 -       cd /tmp/fuel-main/iso && patch -p0 < $(TOPDIR)/bootstrap_admin_node.sh.patch
73 -       cd /tmp/fuel-main/iso && git add -u bootstrap_admin_node.sh
74 -       cd /tmp/fuel-main/iso/isolinux && patch -p0 <  $(TOPDIR)/isolinux.cfg.patch
75 -       cd /tmp/fuel-main/iso/isolinux && git add -u isolinux.cfg
76 -       cd /tmp/fuel-main/iso && git commit -m "Added OPNFV patches"
77 +       cd /tmp/fuel-main && git config user.name "Fuel OPNFV"
78 +       cd /tmp/fuel-main && git config user.email "fuel@opnfv.org"
79 +       cd /tmp/fuel-main && git am $(TOPDIR)/bootstrap_admin_node.sh.patch
80 +       cd /tmp/fuel-main && git am $(TOPDIR)/isolinux.cfg.patch
81         # Repeat build up to three times
82         sudo -E ./fuel_build_loop
83         cp /tmp/fuel-main/build/artifacts/fuel*.iso .
84 diff --git a/build/bootstrap_admin_node.sh.patch b/build/bootstrap_admin_node.sh.patch
85 index e137b74..8a2b69f 100644
86 --- a/build/bootstrap_admin_node.sh.patch
87 +++ b/build/bootstrap_admin_node.sh.patch
88 @@ -1,95 +1,72 @@
89 -*** bootstrap_admin_node.sh.orig       Mon May 30 06:31:38 2016
90 ---- bootstrap_admin_node.sh    Mon May 30 06:35:11 2016
91 -***************
92 -*** 339,346 ****
93 -  set +x
94 -  echo "Done!"
95 -  
96 -  if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
97 -!   fuelmenu || fail
98 -  else
99 -    # Give user 15 seconds to enter fuelmenu or else continue
100 -    echo
101 ---- 339,360 ----
102 -  set +x
103 -  echo "Done!"
104 -  
105 -+ ### OPNFV addition BEGIN
106 -+ shopt -s nullglob
107 -+ for script in /opt/opnfv/bootstrap/pre.d/*.sh
108 -+ do
109 -+   echo "Pre script: $script" >> /root/pre.log 2>&1
110 -+   $script >> /root/pre.log 2>&1
111 -+ done
112 -+ shopt -u nullglob
113 -+ ### OPNFV addition END
114 -+ 
115 -+ # Enable sshd
116 -+ systemctl enable sshd
117 -+ systemctl start sshd
118 -+ 
119 -  if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
120 -!   fuelmenu
121 -  else
122 -    # Give user 15 seconds to enter fuelmenu or else continue
123 -    echo
124 -***************
125 -*** 360,368 ****
126 -    fi
127 -  fi
128 +From: Fuel OPNFV <fuel@opnfv.org>
129 +Date: Mon, 13 Jun 2016 22:23:57 +0200
130 +Subject: OPNFV: Additions to bootstrap_admin_node.sh
131  
132 -  # Enable online base MOS repos (security, updates) if we run an ISO installation
133 -! [ -f /etc/fuel_build_id ] && \
134 -!   yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
135 -
136 -  if [ ! -f "${ASTUTE_YAML}" ]; then
137 -    echo ${fuelmenu_fail_message}
138 ---- 360,369 ----
139 -    fi
140 -  fi
141 -
142 -+ # OPNFV: Disabled to speedup installation in offline env.
143 -  # Enable online base MOS repos (security, updates) if we run an ISO installation
144 -! #[ -f /etc/fuel_build_id ] && \
145 -! #  yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
146 -
147 -  if [ ! -f "${ASTUTE_YAML}" ]; then
148 -    echo ${fuelmenu_fail_message}
149 -***************
150 -*** 374,382 ****
151 -  [ ! -f /etc/fuel_build_id ] && \
152 -    sed -i "s|127.0.0.1:8080/ubuntu/x86_64|mirror.fuel-infra.org/mos-repos/ubuntu/${FUEL_RELEASE}|g" "${ASTUTE_YAML}"
153 -  
154 -! # Enable sshd
155 -! systemctl enable sshd
156 -! systemctl start sshd
157 -  
158 -  # Enable iptables
159 -  systemctl enable iptables.service
160 ---- 388,394 ----
161 -  [ ! -f /etc/fuel_build_id ] && \
162 -    sed -i "s|127.0.0.1:8080/ubuntu/x86_64|mirror.fuel-infra.org/mos-repos/ubuntu/${FUEL_RELEASE}|g" "${ASTUTE_YAML}"
163 -  
164 -! systemctl reload sshd
165 -  
166 -  # Enable iptables
167 -  systemctl enable iptables.service
168 -***************
169 -*** 529,534 ****
170 ---- 541,556 ----
171 -  
172 -  bash /etc/rc.local
173 -  
174 -+ ### OPNFV addition BEGIN
175 -+ shopt -s nullglob
176 -+ for script in /opt/opnfv/bootstrap/post.d/*.sh
177 -+ do
178 -+   echo "Post script: $script" >> /root/post.log 2>&1
179 -+   $script >> /root/post.log 2>&1
180 -+ done
181 -+ shopt -u nullglob
182 -+ ### OPNFV addition END
183 -+ 
184 -  if [ "`get_bootstrap_skip`" = "False" ]; then
185 -    build_ubuntu_bootstrap bs_status || true
186 -  else
187 +---
188 +diff --git a/iso/bootstrap_admin_node.sh b/iso/bootstrap_admin_node.sh
189 +index 3197c91..e035145 100755
190 +--- a/iso/bootstrap_admin_node.sh
191 ++++ b/iso/bootstrap_admin_node.sh
192 +@@ -339,8 +339,22 @@ fuelmenu --save-only --iface=$ADMIN_INTERFACE || fail
193 + set +x
194 + echo "Done!"
195
196 ++### OPNFV addition BEGIN
197 ++shopt -s nullglob
198 ++for script in /opt/opnfv/bootstrap/pre.d/*.sh
199 ++do
200 ++  echo "Pre script: $script" >> /root/pre.log 2>&1
201 ++  $script >> /root/pre.log 2>&1
202 ++done
203 ++shopt -u nullglob
204 ++### OPNFV addition END
205 ++
206 ++# Enable sshd
207 ++systemctl enable sshd
208 ++systemctl start sshd
209 ++
210 + if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
211 +-  fuelmenu || fail
212 ++  fuelmenu
213 + else
214 +   # Give user 15 seconds to enter fuelmenu or else continue
215 +   echo
216 +@@ -360,9 +374,10 @@ else
217 +   fi
218 + fi
219
220 ++# OPNFV: Disabled to speedup installation in offline env.
221 + # Enable online base MOS repos (security, updates) if we run an ISO installation
222 +-[ -f /etc/fuel_build_id ] && \
223 +-  yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
224 ++#[ -f /etc/fuel_build_id ] && \
225 ++#  yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save
226
227 + if [ ! -f "${ASTUTE_YAML}" ]; then
228 +   echo ${fuelmenu_fail_message}
229 +@@ -377,7 +392,5 @@ if [ ! -f /etc/fuel_build_id ]; then
230
231 +-# Enable sshd
232 +-systemctl enable sshd
233 +-systemctl start sshd
234 ++systemctl reload sshd
235
236 + # Enable iptables
237 + systemctl enable iptables.service
238 +@@ -532,6 +545,16 @@ systemctl start ntpd
239
240 + bash /etc/rc.local
241
242 ++### OPNFV addition BEGIN
243 ++shopt -s nullglob
244 ++for script in /opt/opnfv/bootstrap/post.d/*.sh
245 ++do
246 ++  echo "Post script: $script" >> /root/post.log 2>&1
247 ++  $script >> /root/post.log 2>&1
248 ++done
249 ++shopt -u nullglob
250 ++### OPNFV addition END
251 ++
252 + if [ "`get_bootstrap_skip`" = "False" ]; then
253 +   build_ubuntu_bootstrap bs_status || true
254 + else
255 diff --git a/build/fuel-main_docker_version.patch b/build/fuel-main_docker_version.patch
256 deleted file mode 100644
257 index 22b5824..0000000
258 --- a/build/fuel-main_docker_version.patch
259 +++ /dev/null
260 @@ -1,20 +0,0 @@
261 -*** prepare-build-env.sh.orig  2016-01-11 14:55:50.615286910 +0100
262 ---- prepare-build-env.sh       2016-01-11 14:59:44.775308422 +0100
263 -***************
264 -*** 102,108 ****
265 -    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
266 -    # Install docker
267 -    sudo apt-get update
268 -!   sudo apt-get -y install lxc-docker-1.5.0
269 -  fi
270 -  
271 -  # Install software
272 ---- 102,109 ----
273 -    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
274 -    # Install docker
275 -    sudo apt-get update
276 -!   sudo sh -c 'echo DOCKER_OPTS=\"--bip 172.45.0.1/24\" > /etc/default/docker'
277 -!   sudo apt-get -y -o Dpkg::Options::="--force-confold" install lxc-docker-1.7.1
278 -  fi
279 -  
280 -  # Install software
281 diff --git a/build/isolinux.cfg.patch b/build/isolinux.cfg.patch
282 index ebd991b..7ca7a5c 100644
283 --- a/build/isolinux.cfg.patch
284 +++ b/build/isolinux.cfg.patch
285 @@ -1,24 +1,21 @@
286 -*** isolinux.cfg.orig  Tue May 10 10:13:21 2016
287 ---- isolinux.cfg       Tue May 10 10:15:12 2016
288 -***************
289 -*** 19,27 ****
290 -    menu label ^1. Fuel Install (Static IP)
291 -    menu default
292 -    kernel vmlinuz
293 -!   append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1
294 -  
295 -  label nailgunifname
296 -    menu label ^2. Fuel Advanced Install (Static IP)
297 -    kernel vmlinuz
298 -!   append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX
299 ---- 19,27 ----
300 -    menu label ^1. Fuel Install (Static IP)
301 -    menu default
302 -    kernel vmlinuz
303 -!   append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1 showmenu=yes
304 -  
305 -  label nailgunifname
306 -    menu label ^2. Fuel Advanced Install (Static IP)
307 -    kernel vmlinuz
308 -!   append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX showmenu=yes
309 +From: Fuel OPNFV <fuel@opnfv.org>
310 +Date: Mon, 13 Jun 2016 22:23:57 +0200
311 +Subject: OPNFV: showmenu=yes in isolinux.cfg
312  
313 +---
314 +diff --git a/iso/isolinux/isolinux.cfg b/iso/isolinux/isolinux.cfg
315 +index c6b1ed9..77a4b18 100644
316 +--- a/iso/isolinux/isolinux.cfg
317 ++++ b/iso/isolinux/isolinux.cfg
318 +@@ -19,9 +19,9 @@ label nailgun
319 +   menu label ^1. Fuel Install (Static IP)
320 +   menu default
321 +   kernel vmlinuz
322 +-  append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1
323 ++  append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1 showmenu=yes
324
325 + label nailgunifname
326 +   menu label ^2. Fuel Advanced Install (Static IP)
327 +   kernel vmlinuz
328 +-  append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX
329 ++  append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX showmenu=yes
330 diff --git a/build/repo-mirror-cz.patch b/build/repo-mirror-cz.patch
331 index aa8eaf9..4b5643c 100644
332 --- a/build/repo-mirror-cz.patch
333 +++ b/build/repo-mirror-cz.patch
334 @@ -1,19 +1,13 @@
335 -*** config.mk.orig     Thu Jan  7 23:30:38 2016
336 ---- config.mk  Thu Jan  7 23:32:36 2016
337 -***************
338 -*** 153,159 ****
339 -  # 'msk', 'srt', 'usa', 'hrk', 'cz'
340 -  # Setting any other value or removing of this variable will cause
341 -  # download of all the packages directly from internet
342 -! USE_MIRROR?=ext
343 -  
344 -  ifeq ($(USE_MIRROR),ext)
345 -  MIRROR_FUEL?=http://mirror.fuel-infra.org/mos-repos/centos/$(PRODUCT_NAME)$(PRODUCT_VERSION)-centos$(CENTOS_MAJOR)-fuel/os/x86_64/
346 ---- 153,159 ----
347 -  # 'msk', 'srt', 'usa', 'hrk', 'cz'
348 -  # Setting any other value or removing of this variable will cause
349 -  # download of all the packages directly from internet
350 -! USE_MIRROR?=cz
351 -  
352 -  ifeq ($(USE_MIRROR),ext)
353 -  MIRROR_FUEL?=http://mirror.fuel-infra.org/mos-repos/centos/$(PRODUCT_NAME)$(PRODUCT_VERSION)-centos$(CENTOS_MAJOR)-fuel/os/x86_64/
354 +diff --git a/config.mk b/config.mk
355 +index 2a512cf..3193ecf 100644
356 +--- a/config.mk
357 ++++ b/config.mk
358 +@@ -133,7 +133,7 @@ LOCAL_MIRROR_UBUNTU_OS_BASEURL:=$(LOCAL_MIRROR_UBUNTU)
359 + # 'msk', 'srt', 'usa', 'hrk', 'cz'
360 + # Setting any other value or removing of this variable will cause
361 + # download of all the packages directly from internet
362 +-USE_MIRROR?=ext
363 ++USE_MIRROR?=cz
364
365 + ifeq ($(USE_MIRROR),ext)
366 + MIRROR_FUEL?=http://mirror.fuel-infra.org/mos-repos/centos/$(PRODUCT_NAME)$(PRODUCT_VERSION)-centos$(CENTOS_MAJOR)/os/x86_64/