From 6de5bac371844b70b96b9bd75b62b8d06e5f51fc Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 24 Sep 2016 17:27:16 +0200 Subject: build: Use git submodules for Fuel git repos This change reworks support for cloning (fetching) and patching all Fuel components (fuel-library ... fuel-ui, see [1] for full list), both outside the ISO build process (for development purposes, like testing OPNFV patches apply cleanly to each component), and during the ISO build. The implementation relies heavily on git submodules and patches, so backporting pending upstream gerrit changes, as well as adding new out-of-upstream-tree patches, should be trivial. Also, since without tracking remotes the repos rarely change, leverage the in-place OPNFV build caching mechanism to drastically reduce the number of git clones during each build. The mechanism is detailed more in-depth in the JIRA ticket [3], and it's merely a rehash of the submodule handling in Armband, implemented initially by Stanislaw Kardach . Pros (+ new features): - OPNFV patches for Fuel components can be applied (imported) or developed (exported) outside of the ISO build process; - git repo caching reduces the number of external pulls; - reuse the same fuel-* componets in ALL targets e.g. fuel-mirror used to employ 2 slightly different git trees; - one step closer to Fuel/Armband merge (lots of steps left though); Cons: - adds a lot complexity to solve a non-problem (handling the repos is fine in the current form, for the current goals); However, patching or seems to be quite complicated with the current mechanism, as env vars override our locally patched repos for these components). The proposed change should eliminate this issue completely. CHANGE: Aligned divergent fuel-mirror in ISO vs local repo build by applying the 302 redirect fix ("Fixed handling http redirects") [2] on top of 9.0.1 tag in fuel-mirror repo, and using that for both. This obsoleted the followking mk file: - build/f_isoroot/f_repobuild/config.mk CHANGE: Removed unused make target `get-fuel-repo` from build/config.mk. FIXME: Remote tracking is currently deactivated for all branches. Change this when remote HEAD should be tracked instead, e.g. during Newton rebase. [1] https://github.com/openstack/fuel-main/blob/stable/mitaka/repos.mk#L32 [2] https://review.openstack.org/#/c/334882/ [3] https://jira.opnfv.org/browse/FUEL-200 TODO: Extend build/f_repos/README.md with info about: - branch changes; - tag bumps; - patching now supports subdirs; v5 -> v6: * Added support for nesting patches in subdirs, to be used for feature groups and related changes across submodules. E.g. Upcoming multiarch EFI support could go in: - .../f_repos/patch/fuel-agent/multiarch-efi/...; - .../f_repos/patch/fuel-astute/multiarch-efi/...; While Armband patches could go in: - .../f_repos/patch/fuel-agent/armband/...; - .../f_repos/patch/fuel-astute/armband/...; etc. v6 -> v13: * fix wrong tag used for VERSION dump; * fix wrong tag used for patches-export; * move OPNFV_TAG to main config.mk and use it in FUEL_*_COMMIT; * only run `patches-import` when patches changed / not yet applied; * only run `clean` for stale `.cacheid` (avoid re-applying patches); * allow git submodule path/name to be different (FIXED); * put-cache should only run when artifact is not already cached; * `git am`: use 3-way merge so already applied patches are gently skipped (useful for upstreaming patches from Armband); * Properly support nested patch dirs; * Colorize the output a little; JIRA: FUEL-200 Change-Id: I9dbdd9b3022896d4497d21be8dacc859730db489 Signed-off-by: Alexandru Avadanii --- build/f_isoroot/f_repobuild/Makefile | 7 ++----- build/f_isoroot/f_repobuild/config.mk | 13 ------------- 2 files changed, 2 insertions(+), 18 deletions(-) delete mode 100644 build/f_isoroot/f_repobuild/config.mk (limited to 'build/f_isoroot') diff --git a/build/f_isoroot/f_repobuild/Makefile b/build/f_isoroot/f_repobuild/Makefile index 7c6b16304..ad1a934fa 100644 --- a/build/f_isoroot/f_repobuild/Makefile +++ b/build/f_isoroot/f_repobuild/Makefile @@ -13,7 +13,6 @@ TOP := $(shell pwd) TMP_ROOT_DIR := $(shell echo "$(MIRROR_UBUNTU_ROOT)" | cut -d "/" -f2) include ../../config.mk -include config.mk export MOS_VERSION export OPENSTACK_VERSION @@ -25,8 +24,7 @@ nailgun: sudo apt-get install -y git libxml2-dev libxslt-dev python-dev python-pip libz-dev libyaml-dev createrepo python-yaml rm -Rf nailgun sudo mkdir -p /var/www/nailgun - git clone $(FUEL_MIRROR_REPO) - cd fuel-mirror && git checkout -q $(FUEL_MIRROR_COMMIT) + ln -sf ${F_SUBMOD_DIR}/fuel-mirror fuel-mirror sudo pip install -U -r ./fuel-mirror/requirements.txt sudo pip install ./fuel-mirror sudo pip install ./fuel-mirror/contrib/fuel_mirror @@ -34,7 +32,7 @@ nailgun: sudo fuel-mirror --debug --config ./opnfv-config.yaml create --group ubuntu --pattern=ubuntu sudo chmod -R 755 /var/www/nailgun cp -Rp /var/www/nailgun . - # On the end we want to have ubuntu repository in mirrors/ubuntu directory + # In the end we want to have ubuntu repository in mirrors/ubuntu directory -if [ "$(MIRROR_UBUNTU_ROOT)" != "/ubuntu/" ]; then \ mkdir -p nailgun/mirrors/ubuntu;\ mv nailgun/mirrors$(MIRROR_UBUNTU_ROOT)* nailgun/mirrors/ubuntu;\ @@ -65,7 +63,6 @@ release:nailgun .cacheid: date +"Repocache %G%V" > .cachedata sha1sum Makefile >> .cachedata - sha1sum config.mk >> .cachedata $(CACHETOOL) packages >> .cachedata echo -n $(UBUNTU_ARCH) | sha1sum | awk {'print $$1'} >> .cachedata cat .cachedata | $(CACHETOOL) getid > .cacheid diff --git a/build/f_isoroot/f_repobuild/config.mk b/build/f_isoroot/f_repobuild/config.mk deleted file mode 100644 index d81732849..000000000 --- a/build/f_isoroot/f_repobuild/config.mk +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################## -# Copyright (c) 2016 Ericsson AB and others. -# mskalski@mirantis.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -FUEL_MIRROR_REPO?=https://github.com/openstack/fuel-mirror -# Point to the commit where 302 redirects are handled -# https://bugs.launchpad.net/fuel/mitaka/+bug/1593674 -FUEL_MIRROR_COMMIT?=192a3d9f8f993afb12c5108dd9339c6688c23e11 -- cgit 1.2.3-korg