Merge "submodule: Kill yardstick"
[armband.git] / patches / opnfv-fuel / 0036-repo-mirror-Allow-multi-arch-local-mirrors.patch
1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Sat, 18 Jun 2016 19:42:15 +0200
3 Subject: [PATCH] repo mirror: Allow multi-arch local mirrors
4
5 This patch allows specifying multiple architectures via UBUNTU_ARCH in
6 form of a list of space separated architectures. The first architecture
7 in the list is considered primary and will be used for building all the
8 deb packages by fuel-main. Additional architectures are added to allow
9 targets of other architectures to use the mirror.
10
11 NOTE: this imposes a requirement that all packages built are arch
12 independent (which is true so far).
13
14 [ Alexandru Avadanii ]
15 Reworked for applying on top of fuel@OPNFV.
16 Pass UBUNTU_ARCH to Docker containers.
17
18 Signed-off-by: Stanislaw Kardach <stanislaw.kardach@cavium.com>
19 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
20 ---
21  build/Makefile                            |  1 +
22  build/docker/Dockerfile                   |  2 +-
23  build/docker/runcontext                   |  8 ++++-
24  build/repo-multi-arch-local-mirrors.patch | 59 +++++++++++++++++++++++++++++++
25  4 files changed, 68 insertions(+), 2 deletions(-)
26  create mode 100644 build/repo-multi-arch-local-mirrors.patch
27
28 diff --git a/build/Makefile b/build/Makefile
29 index 95b1487..829a231 100644
30 --- a/build/Makefile
31 +++ b/build/Makefile
32 @@ -135,6 +135,7 @@ $(ISOCACHE):
33         cd /tmp/fuel-main && git am $(TOPDIR)/bootstrap_admin_node.sh.patch
34         cd /tmp/fuel-main && git am $(TOPDIR)/isolinux.cfg.patch
35         cd /tmp/fuel-main/build/repos/fuel-nailgun && git am $(TOPDIR)/Mark-Intel-82599-10-Gigabit-NIC-as-DPDK-capable.patch
36 +       cd /tmp/fuel-main && git am $(TOPDIR)/repo-multi-arch-local-mirrors.patch
37         # Repeat build up to three times
38         sudo -E ./fuel_build_loop
39         cp /tmp/fuel-main/build/artifacts/fuel*.iso .
40 diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile
41 index 1bb56b7..b38ea4c 100644
42 --- a/build/docker/Dockerfile
43 +++ b/build/docker/Dockerfile
44 @@ -30,7 +30,7 @@ RUN echo "Defaults env_keep += \"ftp_proxy http_proxy https_proxy no_proxy RSYNC
45  # Keeping PWD is needed to build as root
46  RUN echo "Defaults env_keep += \"PWD\"" > /etc/sudoers.d/keep-pwd
47  # Keeping variables for ISO build
48 -RUN echo "Defaults env_keep += \"MIRROR_UBUNTU MIRROR_UBUNTU_ROOT MIRROR_MOS_UBUNTU MIRROR_MOS_UBUNTU_ROOT MIRROR_FUEL LATEST_TARGET_UBUNTU\"" > /etc/sudoers.d/keep-mos
49 +RUN echo "Defaults env_keep += \"MIRROR_UBUNTU MIRROR_UBUNTU_ROOT MIRROR_MOS_UBUNTU MIRROR_MOS_UBUNTU_ROOT MIRROR_FUEL LATEST_TARGET_UBUNTU UBUNTU_ARCH\"" > /etc/sudoers.d/keep-mos
50  RUN chmod 0440 /etc/sudoers.d/open-sudo
51  RUN chmod 0440 /etc/sudoers.d/keep-proxies
52  RUN chmod 0440 /etc/sudoers.d/keep-pwd
53 diff --git a/build/docker/runcontext b/build/docker/runcontext
54 index 9f07776..daad663 100755
55 --- a/build/docker/runcontext
56 +++ b/build/docker/runcontext
57 @@ -111,7 +111,13 @@ if [ -n "$CACHEBASE" ]; then
58      fi
59  fi
60  
61 -RUN_CONTEXT_OPT="--cidfile $CID_FILE --privileged=true --rm -e HOME=$HOME -e CACHEDEBUG -e CACHETRANSPORT -e CACHEMAXAGE -e CACHEBASE -e BUILD_FUEL_PLUGINS -e MIRROR_UBUNTU -e MIRROR_UBUNTU_ROOT -e MIRROR_MOS_UBUNTU -e MIRROR_MOS_UBUNTU_ROOT -e MIRROR_FUEL -e LATEST_TARGET_UBUNTU -u $USER_ID:$GROUP_ID -w $PWD -v $GITROOT:$GITROOT -v /sys/fs/cgroup:/sys/fs/cgroup:ro $CACHEMOUNT"
62 +RUN_CONTEXT_OPT="--cidfile $CID_FILE --privileged=true --rm \
63 +    -e HOME=$HOME -e CACHEDEBUG -e CACHETRANSPORT -e CACHEMAXAGE -e CACHEBASE \
64 +    -e BUILD_FUEL_PLUGINS -e MIRROR_UBUNTU -e MIRROR_UBUNTU_ROOT \
65 +    -e MIRROR_MOS_UBUNTU -e MIRROR_MOS_UBUNTU_ROOT -e MIRROR_FUEL \
66 +    -e LATEST_TARGET_UBUNTU -e UBUNTU_ARCH \
67 +    -u $USER_ID:$GROUP_ID -w $PWD \
68 +    -v $GITROOT:$GITROOT -v /sys/fs/cgroup:/sys/fs/cgroup:ro $CACHEMOUNT"
69  
70  # Passing "debug" puts up an interactive bash shell
71  if [ "$1" == "debug" ]; then
72 diff --git a/build/repo-multi-arch-local-mirrors.patch b/build/repo-multi-arch-local-mirrors.patch
73 new file mode 100644
74 index 0000000..d404287
75 --- /dev/null
76 +++ b/build/repo-multi-arch-local-mirrors.patch
77 @@ -0,0 +1,59 @@
78 +From: Stanislaw Kardach <stanislaw.kardach@cavium.com>
79 +Date: Thu, 25 Feb 2016 13:31:19 +0100
80 +Subject: repo mirror: Allow multi-arch local mirrors
81 +
82 +This patch allows specifying multiple architectures via UBUNTU_ARCH in
83 +form of a list of space separated architectures. The first architecture
84 +in the list is considered primary and will be used for building all the
85 +deb packages by fuel-main. Additional architectures are added to allow
86 +targets of other architectures to use the mirror.
87 +NOTE: this imposes a requirement that all packages built are arch
88 +independent (which is true so far).
89 +
90 +Signed-off-by: Stanislaw Kardach <stanislaw.kardach@cavium.com>
91 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
92 +---
93 + mirror/ubuntu/module.mk | 2 +-
94 + sandbox.mk              | 2 +-
95 + config.mk               | 2 +-
96 + 3 files changed, 3 insertions(+), 3 deletions(-)
97 +
98 +diff --git a/mirror/ubuntu/module.mk b/mirror/ubuntu/module.mk
99 +index 7a9466e..fe1ada2 100644
100 +--- a/mirror/ubuntu/module.mk
101 ++++ b/mirror/ubuntu/module.mk
102 +@@ -81,7 +81,7 @@ $(BUILD_DIR)/mirror/ubuntu/mirror.done:
103 +       --root=$(MIRROR_MOS_UBUNTU_ROOT) \
104 +       --dist=$(MIRROR_MOS_UBUNTU_SUITE) \
105 +       --section=$(subst $(space),$(comma),$(MIRROR_MOS_UBUNTU_SECTION)) \
106 +-      --arch=$(UBUNTU_ARCH) \
107 ++      --arch=$(shell echo $(UBUNTU_ARCH) | tr ' ' ',') \
108 +       $(LOCAL_MIRROR_UBUNTU)/
109 +       rm -rf $(LOCAL_MIRROR_UBUNTU)/.temp $(LOCAL_MIRROR_UBUNTU)/project
110 +       $(ACTION.TOUCH)
111 +diff --git a/sandbox.mk b/sandbox.mk
112 +index 4bc3962..5ffddbd 100644
113 +--- a/sandbox.mk
114 ++++ b/sandbox.mk
115 +@@ -188,7 +188,7 @@ touch $(SANDBOX_UBUNTU)/etc/init.d/.legacy-bootordering
116 + mkdir -p $(SANDBOX_UBUNTU)/usr/sbin
117 + cp -a $(BUILD_DIR)/policy-rc.d $(SANDBOX_UBUNTU)/usr/sbin
118 + echo "Running debootstrap"
119 +-sudo debootstrap --no-check-gpg --include=ca-certificates --arch=$(UBUNTU_ARCH) $(MIRROR_UBUNTU_SUITE) $(SANDBOX_UBUNTU) $(MIRROR_UBUNTU_METHOD)://$(MIRROR_UBUNTU)$(MIRROR_UBUNTU_ROOT)
120 ++sudo debootstrap --no-check-gpg --include=ca-certificates --arch=$(word 1,$(UBUNTU_ARCH)) $(MIRROR_UBUNTU_SUITE) $(SANDBOX_UBUNTU) $(MIRROR_UBUNTU_METHOD)://$(MIRROR_UBUNTU)$(MIRROR_UBUNTU_ROOT)
121 + if [ -e $(SANDBOX_UBUNTU)/etc/resolv.conf ]; then sudo cp -a $(SANDBOX_UBUNTU)/etc/resolv.conf $(SANDBOX_UBUNTU)/etc/resolv.conf.orig; fi
122 + sudo cp /etc/resolv.conf $(SANDBOX_UBUNTU)/etc/resolv.conf
123 + if [ -e $(SANDBOX_UBUNTU)/etc/hosts ]; then sudo cp -a $(SANDBOX_UBUNTU)/etc/hosts $(SANDBOX_UBUNTU)/etc/hosts.orig; fi
124 +diff --git a/config.mk b/config.mk
125 +index 74ee039..45a3b30 100644
126 +--- a/config.mk
127 ++++ b/config.mk
128 +@@ -49,7 +49,7 @@ UBUNTU_MINOR:=04
129 + UBUNTU_RELEASE_NUMBER:=$(UBUNTU_MAJOR).$(UBUNTU_MINOR)
130 + UBUNTU_KERNEL_FLAVOR?=lts-trusty
131 + UBUNTU_NETBOOT_FLAVOR?=netboot
132 +-UBUNTU_ARCH:=amd64
133 ++UBUNTU_ARCH?=amd64
134 + UBUNTU_IMAGE_RELEASE:=$(UBUNTU_MAJOR)$(UBUNTU_MINOR)
135 + SEPARATE_IMAGES?=/boot,ext2 /,ext4
136 +