summaryrefslogtreecommitdiffstats
path: root/build/Makefile
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2016-08-27 17:13:32 +0200
committerMichal Skalski <mskalski@mirantis.com>2016-09-17 20:20:53 +0000
commitf9326c161e2e8ed039499d30cced7c2553874e26 (patch)
tree1dd33d9050fda14d91c0a23c4e00a7becd76dbb3 /build/Makefile
parent269773ffd3bbd267aeee21b49f83783c064c04c6 (diff)
build: Move patches to <patch-repos> dir
Decouple main Makefile and repository patches by moving all Fuel component patches to a subdir, <patch-repo>. Proposed structure of <patch-repos> dir: - patch-repos/*.patch are intended for <fuel-main> git repo; - patch-repos/build/repo/<fuel-module>/*.patch are intended for <fuel-module>, e.g. "fuel-nailgun"; Full list of Fuel submodules supported by this mechanism at [1]. While at it, replace all occurences of </tmp/fuel-main> with <FUEL_MAIN_DIR> in main Makefile and rewrite a few git/make calls to use the "-C" arg. NOTE: `git -C` is available starting with git 1.8.5. [1] https://github.com/openstack/fuel-main/blob/stable/mitaka/repos.mk #L32-L44 Change-Id: I5e4adc7285054777c3898592ed48482ccd2b706f Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> (cherry picked from commit 52701ce099ac455aa393aac34d684f5d59b3d2fe)
Diffstat (limited to 'build/Makefile')
-rw-r--r--build/Makefile41
1 files changed, 24 insertions, 17 deletions
diff --git a/build/Makefile b/build/Makefile
index fa708696e..59d9096c6 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -80,6 +80,11 @@ ORIGDIR := $(TOPDIR)/origiso
# END of variables to customize
#############################################################################
+# Fuel-main destination path and fuel-* submodule patching, for full list check:
+# https://github.com/openstack/fuel-main/blob/stable/mitaka/repos.mk#L32-L44
+FUEL_MAIN_DIR := /tmp/fuel-main
+FUEL_PATCHES := $(shell find $(BUILD_BASE)/patch-repos -name '*.patch' | sort)
+
SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
.PHONY: all
@@ -105,10 +110,10 @@ include cache.mk
$(ISOCACHE):
# Clone Fuel to non-persistent location and build
- sudo rm -rf /tmp/fuel-main
- cd /tmp && git clone $(FUEL_MAIN_REPO)
- cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG)
- @echo "fuel" `git -C /tmp/fuel-main rev-parse HEAD` >> $(VERSION_FILE)
+ sudo rm -rf $(FUEL_MAIN_DIR)
+ git clone $(FUEL_MAIN_REPO) $(FUEL_MAIN_DIR)
+ git -C $(FUEL_MAIN_DIR) checkout $(FUEL_MAIN_TAG)
+ @echo "fuel" `git -C $(FUEL_MAIN_DIR) rev-parse HEAD` >> $(VERSION_FILE)
# Remove Docker optimizations, otherwise multistrap will fail during
# Fuel build.
sudo rm -f /etc/apt/apt.conf.d/docker*
@@ -124,21 +129,23 @@ $(ISOCACHE):
sudo service docker stop || exit 0
sudo service docker start
- cd /tmp/fuel-main && ./prepare-build-env.sh
+ cd $(FUEL_MAIN_DIR) && ./prepare-build-env.sh
# Verify that Docker is alive
sudo docker info
- cd /tmp/fuel-main && make repos
- $(REPOINFO) -r /tmp/fuel-main > gitinfo_fuel.txt
+ # fuel-main Makefiles do not like `make -C`
+ cd $(FUEL_MAIN_DIR) && make repos
+ $(REPOINFO) -r $(FUEL_MAIN_DIR) > gitinfo_fuel.txt
# 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 && git am $(TOPDIR)/bootstrap_admin_node.sh.patch
- cd /tmp/fuel-main && git am $(TOPDIR)/isolinux.cfg.patch
- cd /tmp/fuel-main/build/repos/fuel-nailgun && git am $(TOPDIR)/Mark-Intel-82599-10-Gigabit-NIC-as-DPDK-capable.patch
- cd /tmp/fuel-main && git am $(TOPDIR)/repo-multi-arch-local-mirrors.patch
+ $(foreach patch,$(FUEL_PATCHES),git \
+ -C $(subst $(BUILD_BASE)/patch-repos,$(FUEL_MAIN_DIR),$(dir $(patch))) \
+ am --whitespace=nowarn --committer-date-is-author-date $(patch) || \
+ (echo 'Error: Failed patching Fuel repos!' ; exit 1);)
+
# Repeat build up to three times
sudo -E ./fuel_build_loop
- cp /tmp/fuel-main/build/artifacts/fuel*.iso .
+ cp $(FUEL_MAIN_DIR)/build/artifacts/fuel*.iso .
# Store artifact in cache straight away if caching is enabled
# (no .cacheid will be present unless this is a cached build)
test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0
@@ -220,11 +227,11 @@ debug:
# - The commit ID of the full Fuel repo structre
# - The contents of all local Fuel patches
.cacheid:
- cd /tmp && git clone $(FUEL_MAIN_REPO)
- cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG)
- cd /tmp/fuel-main && make repos
- $(REPOINFO) -r /tmp/fuel-main > .cachedata
- sha1sum *.patch >> .cachedata
+ git clone $(FUEL_MAIN_REPO) $(FUEL_MAIN_DIR)
+ git -C $(FUEL_MAIN_DIR) checkout $(FUEL_MAIN_TAG)
+ make -C $(FUEL_MAIN_DIR) repos
+ $(REPOINFO) -r $(FUEL_MAIN_DIR) > .cachedata
+ $(foreach patch,$(FUEL_PATCHES),sha1sum $(patch) >> .cachedata;)
sha1sum fuel_build_loop >> .cachedata
sha1sum config.mk >> .cachedata
sha1sum Makefile >> .cachedata