From: Alexandru Avadanii Date: Sat, 18 Jun 2016 01:09:27 +0200 Subject: [PATCH] WIP: build: fuel-main: Decouple patches, Makefile. FIXME: Not tested, only a discussion starter. Submitted upstream in Fuel@OPNFv, see change-id. ARMBAND changes: Upstream removed all mirrors but usa and cz, and changed its default to mirror.fuel-infra.org in [1]. This allows us to drop patching of fuel-main/config.mk with the Czech mirror. If needed, USE_MIRROR=cz can be specified as an env var. FIXME: Remove when Fuel@OPNFV pulls change and deals with it. Use `git apply` and/or `git am` in favor of `patch`. Change patches from old context format to unified diff. This change allows us to decouple Makefile and patches. This means we no longer have to manually stage touched files before committing them to git. Possible improvements: - replace cz mirror patch with USE_MIRROR=cz makevar; - move patches to separate dir and add ordering info (prefix); - merge patches (currently we have one per touched file); Remove obsolete (unused?) patch: - fuel-main_docker_version.patch [1] https://github.com/openstack/fuel-main/commit/ 751d502cfe15d9c9df0ee89530ac3b0b73aa1638 Change-Id: I5b621370993b259779c813b47105f632948e6da7 Signed-off-by: Alexandru Avadanii --- build/Makefile | 17 ++-- build/bootstrap_admin_node.sh.patch | 167 +++++++++++++++-------------------- build/fuel-main_docker_version.patch | 20 ----- build/isolinux.cfg.patch | 43 +++++---- build/repo-mirror-cz.patch | 32 +++---- 5 files changed, 113 insertions(+), 166 deletions(-) delete mode 100644 build/fuel-main_docker_version.patch diff --git a/build/Makefile b/build/Makefile index 956183c..69e5690 100644 --- a/build/Makefile +++ b/build/Makefile @@ -109,9 +109,9 @@ $(ISOCACHE): cd /tmp && git clone $(FUEL_MAIN_REPO); \ fi cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG) - @echo "fuel" `git -C /tmp/fuel-main show | grep commit | head -1 | cut -d " " -f2` >> $(VERSION_FILE) - # Patch for using the Czech Fuel mirror - cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/repo-mirror-cz.patch + @echo "fuel" `git -C /tmp/fuel-main rev-parse HEAD` >> $(VERSION_FILE) + # Patch for using the Czech Fuel mirror (non-committed) + cd /tmp/fuel-main && git apply $(TOPDIR)/repo-mirror-cz.patch # Remove Docker optimizations, otherwise multistrap will fail during # Fuel build. sudo rm -f /etc/apt/apt.conf.d/docker* @@ -135,13 +135,10 @@ $(ISOCACHE): # OPNFV patches at Fuel build time # Need to be commited in order for them to be considered by the Fuel # build system - cd /tmp/fuel-main/iso && git config user.name "Fuel OPNFV" - cd /tmp/fuel-main/iso && git config user.email "fuel@opnfv.org" - cd /tmp/fuel-main/iso && patch -p0 < $(TOPDIR)/bootstrap_admin_node.sh.patch - cd /tmp/fuel-main/iso && git add -u bootstrap_admin_node.sh - cd /tmp/fuel-main/iso/isolinux && patch -p0 < $(TOPDIR)/isolinux.cfg.patch - cd /tmp/fuel-main/iso/isolinux && git add -u isolinux.cfg - cd /tmp/fuel-main/iso && git commit -m "Added OPNFV patches" + cd /tmp/fuel-main && git config user.name "Fuel OPNFV" + cd /tmp/fuel-main && git config user.email "fuel@opnfv.org" + cd /tmp/fuel-main && git am $(TOPDIR)/bootstrap_admin_node.sh.patch + cd /tmp/fuel-main && git am $(TOPDIR)/isolinux.cfg.patch # Repeat build up to three times sudo -E ./fuel_build_loop cp /tmp/fuel-main/build/artifacts/fuel*.iso . diff --git a/build/bootstrap_admin_node.sh.patch b/build/bootstrap_admin_node.sh.patch index e137b74..8a2b69f 100644 --- a/build/bootstrap_admin_node.sh.patch +++ b/build/bootstrap_admin_node.sh.patch @@ -1,95 +1,72 @@ -*** bootstrap_admin_node.sh.orig Mon May 30 06:31:38 2016 ---- bootstrap_admin_node.sh Mon May 30 06:35:11 2016 -*************** -*** 339,346 **** - set +x - echo "Done!" - - if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then -! fuelmenu || fail - else - # Give user 15 seconds to enter fuelmenu or else continue - echo ---- 339,360 ---- - set +x - echo "Done!" - -+ ### OPNFV addition BEGIN -+ shopt -s nullglob -+ for script in /opt/opnfv/bootstrap/pre.d/*.sh -+ do -+ echo "Pre script: $script" >> /root/pre.log 2>&1 -+ $script >> /root/pre.log 2>&1 -+ done -+ shopt -u nullglob -+ ### OPNFV addition END -+ -+ # Enable sshd -+ systemctl enable sshd -+ systemctl start sshd -+ - if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then -! fuelmenu - else - # Give user 15 seconds to enter fuelmenu or else continue - echo -*************** -*** 360,368 **** - fi - fi +From: Fuel OPNFV +Date: Mon, 13 Jun 2016 22:23:57 +0200 +Subject: OPNFV: Additions to bootstrap_admin_node.sh - # Enable online base MOS repos (security, updates) if we run an ISO installation -! [ -f /etc/fuel_build_id ] && \ -! yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save - - if [ ! -f "${ASTUTE_YAML}" ]; then - echo ${fuelmenu_fail_message} ---- 360,369 ---- - fi - fi - -+ # OPNFV: Disabled to speedup installation in offline env. - # Enable online base MOS repos (security, updates) if we run an ISO installation -! #[ -f /etc/fuel_build_id ] && \ -! # yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save - - if [ ! -f "${ASTUTE_YAML}" ]; then - echo ${fuelmenu_fail_message} -*************** -*** 374,382 **** - [ ! -f /etc/fuel_build_id ] && \ - sed -i "s|127.0.0.1:8080/ubuntu/x86_64|mirror.fuel-infra.org/mos-repos/ubuntu/${FUEL_RELEASE}|g" "${ASTUTE_YAML}" - -! # Enable sshd -! systemctl enable sshd -! systemctl start sshd - - # Enable iptables - systemctl enable iptables.service ---- 388,394 ---- - [ ! -f /etc/fuel_build_id ] && \ - sed -i "s|127.0.0.1:8080/ubuntu/x86_64|mirror.fuel-infra.org/mos-repos/ubuntu/${FUEL_RELEASE}|g" "${ASTUTE_YAML}" - -! systemctl reload sshd - - # Enable iptables - systemctl enable iptables.service -*************** -*** 529,534 **** ---- 541,556 ---- - - bash /etc/rc.local - -+ ### OPNFV addition BEGIN -+ shopt -s nullglob -+ for script in /opt/opnfv/bootstrap/post.d/*.sh -+ do -+ echo "Post script: $script" >> /root/post.log 2>&1 -+ $script >> /root/post.log 2>&1 -+ done -+ shopt -u nullglob -+ ### OPNFV addition END -+ - if [ "`get_bootstrap_skip`" = "False" ]; then - build_ubuntu_bootstrap bs_status || true - else +--- +diff --git a/iso/bootstrap_admin_node.sh b/iso/bootstrap_admin_node.sh +index 3197c91..e035145 100755 +--- a/iso/bootstrap_admin_node.sh ++++ b/iso/bootstrap_admin_node.sh +@@ -339,8 +339,22 @@ fuelmenu --save-only --iface=$ADMIN_INTERFACE || fail + set +x + echo "Done!" + ++### OPNFV addition BEGIN ++shopt -s nullglob ++for script in /opt/opnfv/bootstrap/pre.d/*.sh ++do ++ echo "Pre script: $script" >> /root/pre.log 2>&1 ++ $script >> /root/pre.log 2>&1 ++done ++shopt -u nullglob ++### OPNFV addition END ++ ++# Enable sshd ++systemctl enable sshd ++systemctl start sshd ++ + if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then +- fuelmenu || fail ++ fuelmenu + else + # Give user 15 seconds to enter fuelmenu or else continue + echo +@@ -360,9 +374,10 @@ else + fi + fi + ++# OPNFV: Disabled to speedup installation in offline env. + # Enable online base MOS repos (security, updates) if we run an ISO installation +-[ -f /etc/fuel_build_id ] && \ +- yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save ++#[ -f /etc/fuel_build_id ] && \ ++# yum-config-manager --enable mos${FUEL_RELEASE}-security mos${FUEL_RELEASE}-updates --save + + if [ ! -f "${ASTUTE_YAML}" ]; then + echo ${fuelmenu_fail_message} +@@ -377,7 +392,5 @@ if [ ! -f /etc/fuel_build_id ]; then + +-# Enable sshd +-systemctl enable sshd +-systemctl start sshd ++systemctl reload sshd + + # Enable iptables + systemctl enable iptables.service +@@ -532,6 +545,16 @@ systemctl start ntpd + + bash /etc/rc.local + ++### OPNFV addition BEGIN ++shopt -s nullglob ++for script in /opt/opnfv/bootstrap/post.d/*.sh ++do ++ echo "Post script: $script" >> /root/post.log 2>&1 ++ $script >> /root/post.log 2>&1 ++done ++shopt -u nullglob ++### OPNFV addition END ++ + if [ "`get_bootstrap_skip`" = "False" ]; then + build_ubuntu_bootstrap bs_status || true + else diff --git a/build/fuel-main_docker_version.patch b/build/fuel-main_docker_version.patch deleted file mode 100644 index 22b5824..0000000 --- a/build/fuel-main_docker_version.patch +++ /dev/null @@ -1,20 +0,0 @@ -*** prepare-build-env.sh.orig 2016-01-11 14:55:50.615286910 +0100 ---- prepare-build-env.sh 2016-01-11 14:59:44.775308422 +0100 -*************** -*** 102,108 **** - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 - # Install docker - sudo apt-get update -! sudo apt-get -y install lxc-docker-1.5.0 - fi - - # Install software ---- 102,109 ---- - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 - # Install docker - sudo apt-get update -! sudo sh -c 'echo DOCKER_OPTS=\"--bip 172.45.0.1/24\" > /etc/default/docker' -! sudo apt-get -y -o Dpkg::Options::="--force-confold" install lxc-docker-1.7.1 - fi - - # Install software diff --git a/build/isolinux.cfg.patch b/build/isolinux.cfg.patch index ebd991b..7ca7a5c 100644 --- a/build/isolinux.cfg.patch +++ b/build/isolinux.cfg.patch @@ -1,24 +1,21 @@ -*** isolinux.cfg.orig Tue May 10 10:13:21 2016 ---- isolinux.cfg Tue May 10 10:15:12 2016 -*************** -*** 19,27 **** - menu label ^1. Fuel Install (Static IP) - menu default - kernel vmlinuz -! 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 - - label nailgunifname - menu label ^2. Fuel Advanced Install (Static IP) - kernel vmlinuz -! 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 ---- 19,27 ---- - menu label ^1. Fuel Install (Static IP) - menu default - kernel vmlinuz -! 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 - - label nailgunifname - menu label ^2. Fuel Advanced Install (Static IP) - kernel vmlinuz -! 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 +From: Fuel OPNFV +Date: Mon, 13 Jun 2016 22:23:57 +0200 +Subject: OPNFV: showmenu=yes in isolinux.cfg +--- +diff --git a/iso/isolinux/isolinux.cfg b/iso/isolinux/isolinux.cfg +index c6b1ed9..77a4b18 100644 +--- a/iso/isolinux/isolinux.cfg ++++ b/iso/isolinux/isolinux.cfg +@@ -19,9 +19,9 @@ label nailgun + menu label ^1. Fuel Install (Static IP) + menu default + kernel vmlinuz +- 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 ++ 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 + + label nailgunifname + menu label ^2. Fuel Advanced Install (Static IP) + kernel vmlinuz +- 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 ++ 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 diff --git a/build/repo-mirror-cz.patch b/build/repo-mirror-cz.patch index aa8eaf9..4b5643c 100644 --- a/build/repo-mirror-cz.patch +++ b/build/repo-mirror-cz.patch @@ -1,19 +1,13 @@ -*** config.mk.orig Thu Jan 7 23:30:38 2016 ---- config.mk Thu Jan 7 23:32:36 2016 -*************** -*** 153,159 **** - # 'msk', 'srt', 'usa', 'hrk', 'cz' - # Setting any other value or removing of this variable will cause - # download of all the packages directly from internet -! USE_MIRROR?=ext - - ifeq ($(USE_MIRROR),ext) - MIRROR_FUEL?=http://mirror.fuel-infra.org/mos-repos/centos/$(PRODUCT_NAME)$(PRODUCT_VERSION)-centos$(CENTOS_MAJOR)-fuel/os/x86_64/ ---- 153,159 ---- - # 'msk', 'srt', 'usa', 'hrk', 'cz' - # Setting any other value or removing of this variable will cause - # download of all the packages directly from internet -! USE_MIRROR?=cz - - ifeq ($(USE_MIRROR),ext) - MIRROR_FUEL?=http://mirror.fuel-infra.org/mos-repos/centos/$(PRODUCT_NAME)$(PRODUCT_VERSION)-centos$(CENTOS_MAJOR)-fuel/os/x86_64/ +diff --git a/config.mk b/config.mk +index 2a512cf..3193ecf 100644 +--- a/config.mk ++++ b/config.mk +@@ -133,7 +133,7 @@ LOCAL_MIRROR_UBUNTU_OS_BASEURL:=$(LOCAL_MIRROR_UBUNTU) + # 'msk', 'srt', 'usa', 'hrk', 'cz' + # Setting any other value or removing of this variable will cause + # download of all the packages directly from internet +-USE_MIRROR?=ext ++USE_MIRROR?=cz + + ifeq ($(USE_MIRROR),ext) + MIRROR_FUEL?=http://mirror.fuel-infra.org/mos-repos/centos/$(PRODUCT_NAME)$(PRODUCT_VERSION)-centos$(CENTOS_MAJOR)/os/x86_64/