Merge "deploy/reap.py: Dump extra interfaces information."
[fuel.git] / build / f_isoroot / f_repobuild / Makefile
index 522722e..7c6b163 100644 (file)
 
 SHELL := /bin/bash
 TOP := $(shell pwd)
-RSYNC_HOST := $(shell ./select_ubuntu_repo.sh)
-DEPENDENCIES_FILE := /etc/fuel-createmirror/requirements-deb.txt
+TMP_ROOT_DIR := $(shell echo "$(MIRROR_UBUNTU_ROOT)" | cut -d "/" -f2)
 
+include ../../config.mk
+include config.mk
+
+export MOS_VERSION
+export OPENSTACK_VERSION
 
 .PHONY: all
 all: nailgun
 
 nailgun:
-#      If RSYNC_CONNECT_PROG is set we need to do some magic to copy the
-#      keys. Make sure to have the username set in the SSH_CONNECT_PROG
-#      as well!
-       @if [ -n "${RSYNC_CONNECT_PROG}" -a ! -d /root/.ssh ]; then \
-               sudo mkdir -p /root/.ssh; \
-               test -d ${HOME}/.ssh && sudo find ${HOME}/.ssh -maxdepth 1 -type f -exec cp {} /root/.ssh \; ; \
-               sudo bash -c "echo StrictHostKeyChecking=no > /root/.ssh/config"; \
-               sudo chmod 700 /root/.ssh; \
-       fi
-       sudo apt-get install -y rsync python python-yaml dpkg-dev openssl
-       rm -rf tmpiso tmpdir
-       mkdir tmpiso
-       fuseiso ${ISOCACHE} tmpiso
-       cp tmpiso/ubuntu/pool/main/f/fuel-createmirror/fuel-createmirror_*.deb .
-       fusermount -u tmpiso
-       rm -rf tmpiso
-       sudo dpkg -i fuel-createmirror_*.deb
-       sudo sed -i 's/DOCKER_MODE=true/DOCKER_MODE=false/' /etc/fuel-createmirror/common.cfg
-       sudo sed -i 's/DEBUG="no"/DEBUG="yes"/' /etc/fuel-createmirror/ubuntu.cfg
-       sudo sed -i "s/MIRROR_UBUNTU_HOST=\".*\"/MIRROR_UBUNTU_HOST=\"$(RSYNC_HOST)\"/" /etc/fuel-createmirror/common.cfg
-       # Add dependencies from plugins. With awk help try add only unique packages.
-       sudo bash -c 'find ../ -name requirements-deb.txt -print0 | xargs -0 -I% awk '\''NR == FNR {first[$$0];next}; ! ($$0 in first)'\'' "${DEPENDENCIES_FILE}" "%" >> "${DEPENDENCIES_FILE}"'
+       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
-       sudo su - -c /opt/fuel-createmirror-*/fuel-createmirror
+       sudo mkdir -p /var/www/nailgun
+       git clone $(FUEL_MIRROR_REPO)
+       cd fuel-mirror && git checkout -q $(FUEL_MIRROR_COMMIT)
+       sudo pip install -U -r ./fuel-mirror/requirements.txt
+       sudo pip install ./fuel-mirror
+       sudo pip install ./fuel-mirror/contrib/fuel_mirror
+       ./opnfv_mirror_conf.py
+       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
+       -if [ "$(MIRROR_UBUNTU_ROOT)" != "/ubuntu/" ]; then \
+         mkdir -p nailgun/mirrors/ubuntu;\
+         mv nailgun/mirrors$(MIRROR_UBUNTU_ROOT)* nailgun/mirrors/ubuntu;\
+         [ "$(MIRROR_UBUNTU_ROOT)" != "/" ] && rm -rf nailgun/mirrors/$(TMP_ROOT_DIR);\
+       fi
+       # 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
 
 .PHONY: clean
 clean:
-       @rm -rf ../release/opnfv/nailgun nailgun fuel-createmirror_6.1*.deb
+       @rm -rf ../release/opnfv/nailgun nailgun fuel-mirror opnfv-config.yaml ubuntu.yaml
 
 .PHONY: release
 release:nailgun
        @rm -Rf ../release/opnfv/nailgun
        @mkdir -p ../release/opnfv
        @cp -Rp nailgun ../release/opnfv/nailgun
+       @cp fuel_bootstrap_cli.yaml ../release/opnfv/
 
 #############################################################################
 # Cache operations - only used when building through ci/build.sh
@@ -66,6 +65,9 @@ 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
 
 # Clean local data related to caching - called prior to ordinary build