diff options
Diffstat (limited to 'fuel/build')
-rw-r--r-- | fuel/build/Makefile | 46 | ||||
-rw-r--r-- | fuel/build/cache.mk | 79 | ||||
-rw-r--r-- | fuel/build/config.mk | 9 | ||||
-rw-r--r-- | fuel/build/f_example_control_bond/Makefile | 4 | ||||
-rw-r--r-- | fuel/build/f_example_packadd/Makefile | 4 | ||||
-rw-r--r-- | fuel/build/f_isoroot/Makefile | 4 | ||||
-rw-r--r-- | fuel/build/f_l23network/Makefile | 4 | ||||
-rw-r--r-- | fuel/build/f_ntp/Makefile | 4 | ||||
-rwxr-xr-x | fuel/build/f_odl_docker/Makefile | 10 | ||||
-rw-r--r-- | fuel/build/f_opnfv_puppet/Makefile | 4 | ||||
-rw-r--r-- | fuel/build/f_osnaily/Makefile | 4 | ||||
-rw-r--r-- | fuel/build/f_resolvconf/Makefile | 4 | ||||
l--------- | fuel/build/opendaylight/ | 1 | ||||
-rw-r--r-- | fuel/build/opendaylight/Makefile | 27 | ||||
-rw-r--r-- | fuel/build/opendaylight/f_odl/Makefile | 4 |
15 files changed, 143 insertions, 65 deletions
diff --git a/fuel/build/Makefile b/fuel/build/Makefile index b6b0eac..364fe31 100644 --- a/fuel/build/Makefile +++ b/fuel/build/Makefile @@ -8,11 +8,10 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +SHELL = /bin/bash ############################################################################ # BEGIN of variables to customize # -SHELL = /bin/bash - #Input args export UNIT_TEST = FALSE export INTERACTIVE = TRUE @@ -31,20 +30,10 @@ export DEB_DEST := $(BUILD_BASE)/release/packages/ubuntu/pool/main export PUPPET_DEST := $(BUILD_BASE)/release/puppet/modules export CACHE_DIR := $(BUILD_BASE)/cache export VERSION_FILE := $(BUILD_BASE)/.versions -DOCKERIMG = opnfv.org/ubuntu-builder:14.04 +export DOCKERIMG = opnfv.org/ubuntu-builder:14.04 export TOPDIR := $(shell pwd) - -# -# END of variables to customize -############################################################################# - -#Include definitions -include config.mk -include cache.mk - - -ORIGDIR := $(TOPDIR)/origiso +#Build subclasses SUBDIRS := f_isoroot SUBDIRS += f_opnfv_puppet @@ -53,32 +42,43 @@ SUBDIRS += f_l23network SUBDIRS += f_resolvconf SUBDIRS += f_ntp SUBDIRS += f_odl_docker - - +#SUBDIRS += f_odl # f_example is only an example of how to generate a .deb package and # should not be enabled in official builds. #SUBDIRS += f_example +ORIGDIR := $(TOPDIR)/origiso +# +# END of variables to customize +############################################################################# + SUBCLEAN = $(addsuffix .clean,$(SUBDIRS)) + .PHONY: all all: @docker version >/dev/null 2>&1 || (echo 'No Docker installation available'; exit 1) - @echo "Versions of cached build results built by" $(shell hostname) "at" $(shell date -u) > $(BUILD_BASE)/.versions - @echo "cache.mk" $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") >> $(BUILD_BASE)/.versions - @echo "config.mk" $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") >> $(BUILD_BASE)/.versions + @echo "Versions of cached build results built by" $(shell hostname) "at" $(shell date -u) > $(VERSION_FILE) + @echo "cache.mk" $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") >> $(VERSION_FILE) + @echo "config.mk" $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") >> $(VERSION_FILE) @make -C docker @docker/runcontext $(DOCKERIMG) $(MAKE) $(MAKEFLAGS) iso - +############################################################################ +# BEGIN of Include definitions +# +include config.mk +include cache.mk +# +# END Include definitions +############################################################################# $(ISOCACHE): # Clone Fuel to non-persistent location and build cd /tmp && git clone $(FUEL_MAIN_REPO) cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG) - @echo "fuel" `git -C /tmp/fuel-main show | grep commit | rev | cut -f1 -d " "` >> ${BUILD_BASE}/.versions - + @echo "fuel" `git -C /tmp/fuel-main show | grep commit | head -1 | cut -d " " -f2` >> $(VERSION_FILE) # Setup cgroups for docker-in-docker sudo /root/enable_dockerx2 # Patch to fix race condition when doing "Docker-in-Docker" build @@ -130,7 +130,7 @@ build-clean: $(SUBCLEAN) @rm -f $(NEWISO) .PHONY: clean $(SUBCLEAN) -clean: prepare $(SUBCLEAN) +clean: clean-cache prepare $(SUBCLEAN) $(MAKE) -C patch-packages -f Makefile clean #$(MAKE) -C opendaylight -f Makefile clean @rm -f *.iso diff --git a/fuel/build/cache.mk b/fuel/build/cache.mk index a3f3516..a2aa1d5 100644 --- a/fuel/build/cache.mk +++ b/fuel/build/cache.mk @@ -8,23 +8,22 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +SHELL = /bin/bash +CACHEVALIDATE := $(addsuffix .validate,$(SUBDIRS)) +CACHECLEAN := $(addsuffix .clean,$(CACHEFILES) $(CACHEDIRS)) + ############################################################################ # BEGIN of variables to customize # -SHELL = /bin/bash - -#export BUILD_BASE = $(shell pwd) -#export CACHE_DIR = "$(BUILD_BASE)/cache" - CACHEDIRS := opendaylight/f_odl/package CACHEFILES := opendaylight/.odl-build-history CACHEFILES += opendaylight/.odl-build.log CACHEFILES += .versions -CACHEFILES += fuel-6.0.1.iso -#CACHEFILES += $(ISOSRC) - -CACHECLEAN = $(addsuffix .clean,$(CACHEDIRS)) +CACHEFILES += $(shell basename $(ISOSRC)) +# +# END of variables to customize +############################################################################ .PHONY: prepare-cache prepare-cache: make-cache-dir $(CACHEDIRS) $(CACHEFILES) @@ -34,54 +33,66 @@ make-cache-dir: @rm -rf ${CACHE_DIR} @mkdir ${CACHE_DIR} - .PHONY: clean-cache clean-cache: $(CACHECLEAN) @rm -rf ${CACHE_DIR} .PHONY: $(CACHEDIRS) $(CACHEDIRS): - @mkdir -p $(dir ${CACHE_DIR}/$@) - @if [ ! -d ${BUILD_BASE}/$@ ]; then\ - mkdir -p $(dir ${BUILD_BASE}/$@);\ - ln -s ${BUILD_BASE}/$@ ${CACHE_DIR}/$@;\ - rm -rf ${BUILD_BASE}/$@;\ - else\ - ln -s ${BUILD_BASE}/$@ ${CACHE_DIR}/$@;\ + @mkdir -p $(dir $(CACHE_DIR)/$@) + @if [ ! -d $(BUILD_BASE)/$@ ]; then\ + mkdir -p $(BUILD_BASE)/$@;\ fi + @ln -s $(BUILD_BASE)/$@ $(CACHE_DIR)/$@ .PHONY: $(CACHEFILES) $(CACHEFILES): - @mkdir -p $(dir ${CACHE_DIR}/$@) - @if [ ! -f ${BUILD_BASE}/$@ ]; then\ - mkdir $(dir ${BUILD_BASE}/$@);\ - echo " " > ${BUILD_BASE}/$@;\ - ln -s ${BUILD_BASE}/$@ ${CACHE_DIR}/$@;\ - rm -f ${BUILD_BASE}/$@;\ + @mkdir -p $(dir $(CACHE_DIR)/$@) + @if [ ! -d $(dir $(BUILD_BASE)/$@) ]; then\ + mkdir -p $(dir $(BUILD_BASE)/$@);\ + fi + + @if [ ! -f $(BUILD_BASE)/$@ ]; then\ + echo " " > $(BUILD_BASE)/$@;\ + ln -s $(BUILD_BASE)/$@ $(CACHE_DIR)/$@;\ + rm -f $(BUILD_BASE)/$@;\ else\ - ln -s ${BUILD_BASE}/$@ ${CACHE_DIR}/$@;\ + ln -s $(BUILD_BASE)/$@ $(CACHE_DIR)/$@;\ fi .PHONY: validate-cache -validate-cache: -# if [ $(shell md5sum ${BUILD_BASE}/config.mk) -ne $(shell cat ${CACHE_DIR}/.versions | grep config.mk awk '{print $NF}') ]; then\ +validate-cache: prepare $(CACHEVALIDATE) + @if [[ $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") != $(shell cat $(VERSION_FILE) | grep config.mk | awk '{print $$NF}') ]]; then\ echo "Cache does not match current config.mk definition, cache must be rebuilt";\ exit 1;\ fi; -# if [ $(shell md5sum ${BUILD_BASE}/cache.mk) -ne $(shell cat ${CACHE_DIR}/.versions | grep config.mk awk '{print $NF}') ]; then\ + @if [[ $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") != $(shell cat $(VERSION_FILE) | grep cache.mk | awk '{print $$NF}') ]]; then\ echo "Cache does not match current cache.mk definition, cache must be rebuilt";\ exit 1;\ fi; -# $(MAKE) -C opendaylight validate-cache -# if [ $? -ne 0 ]; then\ - echo "Cache does not match current OpenDaylight version, cach must be rebuilt";\ - exit 1;\ - fi; +# Once the Make structure is refactored, this should go in as a validate-cache +# taget in the fuel Makefile + + @REMOTE_ID=$(shell git ls-remote $(FUEL_MAIN_REPO) $(FUEL_MAIN_TAG)^{} | awk '{print $$(NF-1)}'); \ + if [ -z $$REMOTE_ID ] || [ $$REMOTE_ID = " " ]; \ + then \ + REMOTE_ID=$(shell git ls-remote $(FUEL_MAIN_REPO) $(FUEL_MAIN_TAG) | awk '{print $$(NF-1)}'); \ + fi; \ + if [ $$REMOTE_ID != $(shell cat $(VERSION_FILE) | grep fuel | awk '{print $$NF}') ]; \ + then \ + echo "Cache does not match upstream Fuel, cache must be rebuilt!"; \ + exit 1; \ + fi + + #$(MAKE) -C opendaylight validate-cache -# $(SUBDIRS) +.PHONY: $(CACHEVALIDATE) +$(CACHEVALIDATE): %.validate: + @echo VALIDATE $(CACHEVALIDATE) + $(MAKE) -C $* -f Makefile validate-cache .PHONY: $(CACHECLEAN) $(CACHECLEAN): %.clean: - rm -f ${CACHE_DIR}/$* + rm -rf ${CACHE_DIR}/$* diff --git a/fuel/build/config.mk b/fuel/build/config.mk index 49b0173..19f502d 100644 --- a/fuel/build/config.mk +++ b/fuel/build/config.mk @@ -16,3 +16,12 @@ FUEL_MAIN_TAG = stable/6.0 DOCKER_REPO := http://get.docker.com/builds/Linux/x86_64 DOCKER_TAG := docker-latest + +.PHONY: get-odl-repo +get-odl-repo: + @echo $(ODL_MAIN_REPO) $(ODL_MAIN_TAG) + +.PHONY: get-fuel-repo +get-fuel-repo: + @echo $(FUEL_MAIN_REPO) $(FUEL_MAIN_TAG) + diff --git a/fuel/build/f_example_control_bond/Makefile b/fuel/build/f_example_control_bond/Makefile index c311a2d..0949737 100644 --- a/fuel/build/f_example_control_bond/Makefile +++ b/fuel/build/f_example_control_bond/Makefile @@ -18,6 +18,10 @@ clean: @rm -rf tmp @rm -rf release +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." .PHONY: release release: diff --git a/fuel/build/f_example_packadd/Makefile b/fuel/build/f_example_packadd/Makefile index eadc83f..a64293d 100644 --- a/fuel/build/f_example_packadd/Makefile +++ b/fuel/build/f_example_packadd/Makefile @@ -31,6 +31,10 @@ clean: @rm -rf release @rm -f ../release/packages/ubuntu/pool/main/$(DEB_NAME) +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." .PHONY: release release:release/pool/main/$(DEB_NAME) diff --git a/fuel/build/f_isoroot/Makefile b/fuel/build/f_isoroot/Makefile index 2fdbbae..bde8e64 100644 --- a/fuel/build/f_isoroot/Makefile +++ b/fuel/build/f_isoroot/Makefile @@ -26,6 +26,10 @@ clean: $(SUBCLEAN) $(SUBCLEAN): %.clean: $(MAKE) -C $* -f Makefile clean +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." + .PHONY: release release:clean $(SUBDIRS) @cp -Rvp release/* ../release/isoroot diff --git a/fuel/build/f_l23network/Makefile b/fuel/build/f_l23network/Makefile index c311a2d..0949737 100644 --- a/fuel/build/f_l23network/Makefile +++ b/fuel/build/f_l23network/Makefile @@ -18,6 +18,10 @@ clean: @rm -rf tmp @rm -rf release +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." .PHONY: release release: diff --git a/fuel/build/f_ntp/Makefile b/fuel/build/f_ntp/Makefile index c311a2d..0949737 100644 --- a/fuel/build/f_ntp/Makefile +++ b/fuel/build/f_ntp/Makefile @@ -18,6 +18,10 @@ clean: @rm -rf tmp @rm -rf release +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." .PHONY: release release: diff --git a/fuel/build/f_odl_docker/Makefile b/fuel/build/f_odl_docker/Makefile index b227bee..6135e71 100755 --- a/fuel/build/f_odl_docker/Makefile +++ b/fuel/build/f_odl_docker/Makefile @@ -12,7 +12,7 @@ TOP := $(shell pwd) BUILDTAG := loving_daniel # Edit this to match the GENESIS / OPNFV in your environment -export OPNFV_PUPPET := /home/lmcdasm/MAR24/genesis/common/puppet-opnfv +export OPNFV_PUPPET := $(BUILD_BASE)/../../common/puppet-opnfv include ../config.mk .PHONY: all @@ -25,7 +25,7 @@ all: @docker save ${BUILDTAG} > puppet/modules/opnfv/odl_docker/odl_docker_image.tar @wget ${DOCKER_REPO}/${DOCKER_TAG} -O puppet/modules/opnfv/odl_docker/docker-latest @echo "OPFNV_PUPPET is: ${OPNFV_PUPPET}" - @cp -Rvp ${OPNFV_PUPPET}/manifests/templates/dockerfile/compute_scripts puppet/modules/opnfv + @cp -Rvp ${OPNFV_PUPPET}/manifests/templates/dockerfile/container_scripts puppet/modules/opnfv .PHONY: clean clean: @@ -39,9 +39,13 @@ build-clean: @rm -rf puppet/modules/opnfv/odl_docker/odl_docker_image.tar @rm -rf puppet/modules/opnfv/odl_docker/docker-latest +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." .PHONY: release release: # Fetch PP from OPNFV Common - @cp -Rvp ${OPNFV_PUPPET}/common/puppet-opnfv/manifests/odl_docker.pp ${PUPPET_DEST} + @cp -Rvp ${OPNFV_PUPPET}/manifests/odl_docker.pp ${PUPPET_DEST} @cp -Rvp puppet/modules/* $(PUPPET_DEST) diff --git a/fuel/build/f_opnfv_puppet/Makefile b/fuel/build/f_opnfv_puppet/Makefile index c311a2d..0949737 100644 --- a/fuel/build/f_opnfv_puppet/Makefile +++ b/fuel/build/f_opnfv_puppet/Makefile @@ -18,6 +18,10 @@ clean: @rm -rf tmp @rm -rf release +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." .PHONY: release release: diff --git a/fuel/build/f_osnaily/Makefile b/fuel/build/f_osnaily/Makefile index c311a2d..0949737 100644 --- a/fuel/build/f_osnaily/Makefile +++ b/fuel/build/f_osnaily/Makefile @@ -18,6 +18,10 @@ clean: @rm -rf tmp @rm -rf release +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." .PHONY: release release: diff --git a/fuel/build/f_resolvconf/Makefile b/fuel/build/f_resolvconf/Makefile index c311a2d..0949737 100644 --- a/fuel/build/f_resolvconf/Makefile +++ b/fuel/build/f_resolvconf/Makefile @@ -18,6 +18,10 @@ clean: @rm -rf tmp @rm -rf release +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." .PHONY: release release: diff --git a/fuel/build/opendaylight/ b/fuel/build/opendaylight/ new file mode 120000 index 0000000..0519ecb --- /dev/null +++ b/fuel/build/opendaylight/ @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/fuel/build/opendaylight/Makefile b/fuel/build/opendaylight/Makefile index c112ff6..bd2eeb5 100644 --- a/fuel/build/opendaylight/Makefile +++ b/fuel/build/opendaylight/Makefile @@ -12,7 +12,7 @@ # BEGIN of variables to customize # SHELL = /bin/bash -include ../config.mk + BUILD_DIR := $(shell pwd) GIT_DIR := /tmp @@ -32,14 +32,31 @@ MAVEN_SPEC = $(BUILD_DIR)/odl_maven/settings.xml .PHONY: all all: odl +############################################################################ +# BEGIN of Include definitions +# +include ../config.mk +# +# END Include definitions +############################################################################# + .PHONY: setup setup: rm -f "$(BUILD_BASE)/f_odl" ln -s "$(shell readlink -e $(BUILD_DIR))/f_odl" "$(shell readlink -e $(BUILD_BASE))/f_odl" -.PHONY: check-cache-validity -check-cache-validity: - @if [ $(git ls-remote $(ODL_MAIN_REPO) $(ODL_MAIN_TAG) | awk '{print $(NF-1)}') -ne $(cat $(CACHE_DIR)/.versions | grep odl | awk '{print $NF}') ]; then @echo "Cache is not up to date, stopping!"; exit 1; fi +.PHONY: validate-cache +validate-cache: + @REMOTE_ID=$(shell git ls-remote $(ODL_MAIN_REPO) $(ODL_MAIN_TAG)^{} | awk '{print $$(NF-1)}'); \ + if [ -z $$REMOTE_ID ] || [ $$REMOTE_ID = " " ]; \ + then \ + REMOTE_ID=$(shell git ls-remote $(ODL_MAIN_REPO) $(ODL_MAIN_TAG) | awk '{print $$(NF-1)}'); \ + fi; \ + if [ $$REMOTE_ID != $(shell cat $(VERSION_FILE) | grep odl | awk '{print $$NF}') ]; \ + then \ + echo "Cache does not match upstream OpenDaylight, cache must be rebuilt!"; \ + exit 1; \ + fi .PHONY: odl odl: @@ -69,7 +86,7 @@ else mvn -gs $(MAVEN_SPEC) clean install;\ fi; - @echo "odl" `git -C /tmp/controller show | grep commit | rev | cut -f1 -d " "` >> $(BUILD_BASE)/.versions + @echo "odl" `git -C /tmp/controller show | grep commit | head -1 | cut -d " " -f2` >> $(VERSION_FILE) @./make-odl-deb.sh -N $(ODL_SHORT_NAME)_`cd /tmp/controller; git rev-parse --short HEAD` -n $(ODL_SHORT_NAME) -v "$(ODL_VERSION)" -t "$(ODL_MAIN_TAG)" -m $(MAINTAINER) -d $(DEPEND) -p $(TARGET_BUILD_PATH) @echo $(ODL_MAIN_TAG) > .odl-build.log endif diff --git a/fuel/build/opendaylight/f_odl/Makefile b/fuel/build/opendaylight/f_odl/Makefile index 6983f0c..f7ebd3e 100644 --- a/fuel/build/opendaylight/f_odl/Makefile +++ b/fuel/build/opendaylight/f_odl/Makefile @@ -36,6 +36,10 @@ clean: @rm -rf release @rm -f $(DEB_DEST)/$(DEB_NAME).deb +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." .PHONY: release release:release/pool/main/$(DEB_NAME).deb |