Merge "submodule: Kill fuel-astute"
[armband.git] / patches / opnfv-fuel / 0050-build-Move-patches-to-patch-repos-dir.patch
1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Sat, 27 Aug 2016 17:13:32 +0200
3 Subject: [PATCH] build: Move patches to <patch-repos> dir
4
5 Decouple main Makefile and repository patches by moving all Fuel
6 component patches to a subdir, <patch-repo>.
7
8 Proposed structure of <patch-repos> dir:
9 - patch-repos/*.patch are intended for <fuel-main> git repo;
10 - patch-repos/build/repo/<fuel-module>/*.patch are intended for
11   <fuel-module>, e.g. "fuel-nailgun";
12
13 Full list of Fuel submodules supported by this mechanism at [1].
14
15 While at it, replace all occurences of </tmp/fuel-main> with
16 <FUEL_MAIN_DIR> in main Makefile and rewrite a few git/make calls
17 to use the "-C" arg.
18
19 NOTE: `git -C` is available starting with git 1.8.5.
20
21 [1] https://github.com/openstack/fuel-main/blob/stable/mitaka/repos.mk
22     #L32-L44
23
24 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
25 ---
26  build/Makefile                                     | 42 ++++++++++++----------
27  .../0010-bootstrap_admin_node.sh.patch}            |  0
28  .../0020-isolinux.cfg.patch}                       |  0
29  .../0030-repo-multi-arch-local-mirrors.patch}      |  0
30  ...e-dpkg-checkbuilddeps-with-mk-build-deps.patch} |  0
31  ...tel-82599-10-Gigabit-NIC-as-DPDK-capable.patch} |  0
32  6 files changed, 24 insertions(+), 18 deletions(-)
33  rename build/{bootstrap_admin_node.sh.patch => patch-repos/0010-bootstrap_admin_node.sh.patch} (100%)
34  rename build/{isolinux.cfg.patch => patch-repos/0020-isolinux.cfg.patch} (100%)
35  rename build/{repo-multi-arch-local-mirrors.patch => patch-repos/0030-repo-multi-arch-local-mirrors.patch} (100%)
36  rename build/{replace-dpkg-checkbuilddeps-with-mk-build-deps.patch => patch-repos/0040-replace-dpkg-checkbuilddeps-with-mk-build-deps.patch} (100%)
37  rename build/{Mark-Intel-82599-10-Gigabit-NIC-as-DPDK-capable.patch => patch-repos/build/repos/fuel-nailgun/0010-Mark-Intel-82599-10-Gigabit-NIC-as-DPDK-capable.patch} (100%)
38
39 diff --git a/build/Makefile b/build/Makefile
40 index 377ecc6..b234924 100644
41 --- a/build/Makefile
42 +++ b/build/Makefile
43 @@ -83,6 +83,11 @@ ORIGDIR := $(TOPDIR)/origiso
44  # END of variables to customize
45  #############################################################################
46  
47 +# Fuel-main destination path and fuel-* submodule patching, for full list check:
48 +# https://github.com/openstack/fuel-main/blob/stable/mitaka/repos.mk#L32-L44
49 +FUEL_MAIN_DIR := /tmp/fuel-main
50 +FUEL_PATCHES  := $(shell find $(BUILD_BASE)/patch-repos -name '*.patch' | sort)
51 +
52  SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
53  
54  .PHONY: all
55 @@ -108,10 +113,10 @@ include cache.mk
56  
57  $(ISOCACHE):
58         # Clone Fuel to non-persistent location and build
59 -       sudo rm -rf /tmp/fuel-main
60 -       cd /tmp && git clone $(FUEL_MAIN_REPO)
61 -       cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG)
62 -       @echo "fuel" `git -C /tmp/fuel-main rev-parse HEAD` >> $(VERSION_FILE)
63 +       sudo rm -rf $(FUEL_MAIN_DIR)
64 +       git clone $(FUEL_MAIN_REPO) $(FUEL_MAIN_DIR)
65 +       git -C $(FUEL_MAIN_DIR) checkout $(FUEL_MAIN_TAG)
66 +       @echo "fuel" `git -C $(FUEL_MAIN_DIR) rev-parse HEAD` >> $(VERSION_FILE)
67         # Remove Docker optimizations, otherwise multistrap will fail during
68         # Fuel build.
69         sudo rm -f /etc/apt/apt.conf.d/docker*
70 @@ -127,25 +132,26 @@ $(ISOCACHE):
71         sudo service docker stop || exit 0
72         sudo service docker start
73  
74 -       cd /tmp/fuel-main && ./prepare-build-env.sh
75 +       cd $(FUEL_MAIN_DIR) && ./prepare-build-env.sh
76         # Verify that Docker is alive
77         sudo docker info
78 -       cd /tmp/fuel-main && make repos
79 -       $(REPOINFO) -r /tmp/fuel-main > gitinfo_fuel.txt
80 +       # fuel-main Makefiles do not like `make -C`
81 +       cd $(FUEL_MAIN_DIR) && make repos
82 +       $(REPOINFO) -r $(FUEL_MAIN_DIR) > gitinfo_fuel.txt
83         @if test -n $(ARMBAND_BASE); then \
84                 $(REPOINFO) -r $(ARMBAND_BASE) >> gitinfo_fuel.txt; \
85         fi
86         # OPNFV patches at Fuel build time
87         # Need to be commited in order for them to be considered by the Fuel
88         # build system
89 -       cd /tmp/fuel-main && git am $(TOPDIR)/bootstrap_admin_node.sh.patch
90 -       cd /tmp/fuel-main && git am $(TOPDIR)/isolinux.cfg.patch
91 -       cd /tmp/fuel-main/build/repos/fuel-nailgun && git am $(TOPDIR)/Mark-Intel-82599-10-Gigabit-NIC-as-DPDK-capable.patch
92 -       cd /tmp/fuel-main && git am $(TOPDIR)/repo-multi-arch-local-mirrors.patch
93 -       cd /tmp/fuel-main && git am $(TOPDIR)/replace-dpkg-checkbuilddeps-with-mk-build-deps.patch
94 +       $(foreach patch,$(FUEL_PATCHES),git \
95 +               -C $(subst $(BUILD_BASE)/patch-repos,$(FUEL_MAIN_DIR),$(dir $(patch))) \
96 +               am --whitespace=nowarn --committer-date-is-author-date $(patch) || \
97 +               (echo 'Error: Failed patching Fuel repos!' ; exit 1);)
98 +
99         # Repeat build up to three times
100         sudo -E ./fuel_build_loop
101 -       cp /tmp/fuel-main/build/artifacts/fuel*.iso .
102 +       cp $(FUEL_MAIN_DIR)/build/artifacts/fuel*.iso .
103         # Store artifact in cache straight away if caching is enabled
104         # (no .cacheid will be present unless this is a cached build)
105         test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0
106 @@ -227,11 +233,11 @@ debug:
107  #   - The commit ID of the full Fuel repo structre
108  #   - The contents of all local Fuel patches
109  .cacheid:
110 -       cd /tmp && git clone $(FUEL_MAIN_REPO)
111 -       cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG)
112 -       cd /tmp/fuel-main && make repos
113 -       $(REPOINFO) -r /tmp/fuel-main > .cachedata
114 -       sha1sum *.patch >> .cachedata
115 +       git clone $(FUEL_MAIN_REPO) $(FUEL_MAIN_DIR)
116 +       git -C $(FUEL_MAIN_DIR) checkout $(FUEL_MAIN_TAG)
117 +       make -C $(FUEL_MAIN_DIR) repos
118 +       $(REPOINFO) -r $(FUEL_MAIN_DIR) > .cachedata
119 +       $(foreach patch,$(FUEL_PATCHES),sha1sum $(patch) >> .cachedata;)
120         sha1sum fuel_build_loop >> .cachedata
121         sha1sum config.mk >> .cachedata
122         @if test -n $(ARMBAND_BASE); then \
123 diff --git a/build/bootstrap_admin_node.sh.patch b/build/patch-repos/0010-bootstrap_admin_node.sh.patch
124 similarity index 100%
125 rename from build/bootstrap_admin_node.sh.patch
126 rename to build/patch-repos/0010-bootstrap_admin_node.sh.patch
127 diff --git a/build/isolinux.cfg.patch b/build/patch-repos/0020-isolinux.cfg.patch
128 similarity index 100%
129 rename from build/isolinux.cfg.patch
130 rename to build/patch-repos/0020-isolinux.cfg.patch
131 diff --git a/build/repo-multi-arch-local-mirrors.patch b/build/patch-repos/0030-repo-multi-arch-local-mirrors.patch
132 similarity index 100%
133 rename from build/repo-multi-arch-local-mirrors.patch
134 rename to build/patch-repos/0030-repo-multi-arch-local-mirrors.patch
135 diff --git a/build/replace-dpkg-checkbuilddeps-with-mk-build-deps.patch b/build/patch-repos/0040-replace-dpkg-checkbuilddeps-with-mk-build-deps.patch
136 similarity index 100%
137 rename from build/replace-dpkg-checkbuilddeps-with-mk-build-deps.patch
138 rename to build/patch-repos/0040-replace-dpkg-checkbuilddeps-with-mk-build-deps.patch
139 diff --git a/build/Mark-Intel-82599-10-Gigabit-NIC-as-DPDK-capable.patch b/build/patch-repos/build/repos/fuel-nailgun/0010-Mark-Intel-82599-10-Gigabit-NIC-as-DPDK-capable.patch
140 similarity index 100%
141 rename from build/Mark-Intel-82599-10-Gigabit-NIC-as-DPDK-capable.patch
142 rename to build/patch-repos/build/repos/fuel-nailgun/0010-Mark-Intel-82599-10-Gigabit-NIC-as-DPDK-capable.patch