diff options
author | Jonas Bjurel <jonas.bjurel@ericsson.com> | 2015-03-17 20:24:42 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-03-17 20:24:42 +0000 |
commit | 759706220ebf55d4bcb1cd967c984eb18f022d05 (patch) | |
tree | 2b5c57c83fdc15e23cf19ae92d0581421ebeedc8 /fuel/build/cache.mk | |
parent | 92284bbf3c64af4b5ec45aabd0e405597d5b9e2b (diff) | |
parent | df6c1db2695030b1ba68184bac9aab9fb2d41e71 (diff) |
Merge "*** FIRST VERSION OF CI BUILD SCRIPT *** - Provides build cache management to a remote location - Provides automatic cashe repopulation - See /fuel/ci/README - Rebased to master - Bug around cache handling fixed - New option -r introduced to invoke external script/program instead of standard http(s)/fttp get and put, eg. scripts or programs to integrate with dropbox, or similar. The script needs to anheaer to curl argument list. - Stefan Berg's comments implemented - Fatih Degirmenci's comments implemented with one exemption: the revision state .iso naming convention still remains the same - we need to discuss this. With the implementation of Fatih's comments the build.sh argument structure is slightly changed, please see ./build.sh -h"
Diffstat (limited to 'fuel/build/cache.mk')
-rw-r--r-- | fuel/build/cache.mk | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/fuel/build/cache.mk b/fuel/build/cache.mk new file mode 100644 index 0000000..a3f3516 --- /dev/null +++ b/fuel/build/cache.mk @@ -0,0 +1,87 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.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 +############################################################################## + +############################################################################ +# 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)) + +.PHONY: prepare-cache +prepare-cache: make-cache-dir $(CACHEDIRS) $(CACHEFILES) + +.PHONY: make-cache-dir +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}/$@;\ + fi + +.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}/$@;\ + else\ + 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\ + 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\ + 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; + +# $(SUBDIRS) + +.PHONY: $(CACHECLEAN) +$(CACHECLEAN): %.clean: + rm -f ${CACHE_DIR}/$* |