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.
5 FIXME: Not tested, only a discussion starter.
7 Submitted upstream in Fuel@OPNFv, see change-id.
10 Upstream removed all mirrors but usa and cz, and changed
11 its default to mirror.fuel-infra.org in [1].
13 This allows us to drop patching of fuel-main/config.mk
14 with the Czech mirror.
16 If needed, USE_MIRROR=cz can be specified as an env var.
18 FIXME: Remove when Fuel@OPNFV pulls change and deals with it.
20 Use `git apply` and/or `git am` in favor of `patch`.
21 Change patches from old context format to unified diff.
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.
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);
32 Remove obsolete (unused?) patch:
33 - fuel-main_docker_version.patch
35 [1] https://github.com/openstack/fuel-main/commit/
36 751d502cfe15d9c9df0ee89530ac3b0b73aa1638
38 Change-Id: I5b621370993b259779c813b47105f632948e6da7
39 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
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
49 diff --git a/build/Makefile b/build/Makefile
50 index 956183c..69e5690 100644
53 @@ -109,9 +109,9 @@ $(ISOCACHE):
54 cd /tmp && git clone $(FUEL_MAIN_REPO); \
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
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
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
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
96 - if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
99 - # Give user 15 seconds to enter fuelmenu or else continue
105 -+ ### OPNFV addition BEGIN
107 -+ for script in /opt/opnfv/bootstrap/pre.d/*.sh
109 -+ echo "Pre script: $script" >> /root/pre.log 2>&1
110 -+ $script >> /root/pre.log 2>&1
113 -+ ### OPNFV addition END
116 -+ systemctl enable sshd
117 -+ systemctl start sshd
119 - if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
122 - # Give user 15 seconds to enter fuelmenu or else continue
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
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
136 - if [ ! -f "${ASTUTE_YAML}" ]; then
137 - echo ${fuelmenu_fail_message}
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
147 - if [ ! -f "${ASTUTE_YAML}" ]; then
148 - echo ${fuelmenu_fail_message}
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}"
155 -! systemctl enable sshd
156 -! systemctl start sshd
159 - systemctl enable iptables.service
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}"
164 -! systemctl reload sshd
167 - systemctl enable iptables.service
174 -+ ### OPNFV addition BEGIN
176 -+ for script in /opt/opnfv/bootstrap/post.d/*.sh
178 -+ echo "Post script: $script" >> /root/post.log 2>&1
179 -+ $script >> /root/post.log 2>&1
182 -+ ### OPNFV addition END
184 - if [ "`get_bootstrap_skip`" = "False" ]; then
185 - build_ubuntu_bootstrap bs_status || true
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
196 ++### OPNFV addition BEGIN
198 ++for script in /opt/opnfv/bootstrap/pre.d/*.sh
200 ++ echo "Pre script: $script" >> /root/pre.log 2>&1
201 ++ $script >> /root/pre.log 2>&1
204 ++### OPNFV addition END
207 ++systemctl enable sshd
208 ++systemctl start sshd
210 + if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
214 + # Give user 15 seconds to enter fuelmenu or else continue
216 +@@ -360,9 +374,10 @@ else
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
227 + if [ ! -f "${ASTUTE_YAML}" ]; then
228 + echo ${fuelmenu_fail_message}
229 +@@ -377,7 +392,5 @@ if [ ! -f /etc/fuel_build_id ]; then
232 +-systemctl enable sshd
233 +-systemctl start sshd
234 ++systemctl reload sshd
237 + systemctl enable iptables.service
238 +@@ -532,6 +545,16 @@ systemctl start ntpd
242 ++### OPNFV addition BEGIN
244 ++for script in /opt/opnfv/bootstrap/post.d/*.sh
246 ++ echo "Post script: $script" >> /root/post.log 2>&1
247 ++ $script >> /root/post.log 2>&1
250 ++### OPNFV addition END
252 + if [ "`get_bootstrap_skip`" = "False" ]; then
253 + build_ubuntu_bootstrap bs_status || true
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
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
265 - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
267 - sudo apt-get update
268 -! sudo apt-get -y install lxc-docker-1.5.0
273 - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
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
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
286 -*** isolinux.cfg.orig Tue May 10 10:13:21 2016
287 ---- isolinux.cfg Tue May 10 10:15:12 2016
290 - menu label ^1. Fuel Install (Static IP)
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
295 - label nailgunifname
296 - menu label ^2. Fuel Advanced Install (Static IP)
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
300 - menu label ^1. Fuel Install (Static IP)
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
305 - label nailgunifname
306 - menu label ^2. Fuel Advanced Install (Static IP)
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
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)
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
325 + label nailgunifname
326 + menu label ^2. Fuel Advanced Install (Static IP)
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
335 -*** config.mk.orig Thu Jan 7 23:30:38 2016
336 ---- config.mk Thu Jan 7 23:32:36 2016
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
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/
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
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
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
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/