From 55b872d17f44e3ffc4dc973928f080964e61e1a4 Mon Sep 17 00:00:00 2001 From: Dan Radez Date: Wed, 1 Apr 2015 14:10:23 -0400 Subject: Initial build.sh files for install via foreman build.sh accepts params defined by https://etherpad.opnfv.org/p/BGS_CI Build currently requires that - CentOS-7.0-1406-x86_64-Minimal.iso - VirtualBox-4.3-4.3.26_98988_fedora18-1.x86_64.rpm - vagrant_1.7.2_x86_64.rpm are placed in the build directory Produces a CentOS 7 iso that will be able to install foreman and provision OpenStack JIRA: BGS-15 Change-Id: If9786d9723f7e77b208745e61704b15cba3ae9c0 Signed-off-by: Dan Radez --- foreman/build/cache.mk | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 foreman/build/cache.mk (limited to 'foreman/build/cache.mk') diff --git a/foreman/build/cache.mk b/foreman/build/cache.mk new file mode 100644 index 0000000..9ae3a7c --- /dev/null +++ b/foreman/build/cache.mk @@ -0,0 +1,78 @@ +############################################################################## +# 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 +############################################################################## + +SHELL = /bin/bash +CACHEVALIDATE := $(addsuffix .validate,$(SUBDIRS)) +CACHECLEAN := $(addsuffix .clean,$(CACHEFILES) $(CACHEDIRS)) + +############################################################################ +# BEGIN of variables to customize +# +CACHEFILES += .versions +CACHEFILES += $(shell basename $(ISOSRC)) +# +# END of variables to customize +############################################################################ + +.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 $(BUILD_BASE)/$@;\ + fi + @ln -s $(BUILD_BASE)/$@ $(CACHE_DIR)/$@ + +.PHONY: $(CACHEFILES) +$(CACHEFILES): + @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)/$@;\ + fi + +.PHONY: validate-cache +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 | 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; + +.PHONY: $(CACHEVALIDATE) +$(CACHEVALIDATE): %.validate: + @echo VALIDATE $(CACHEVALIDATE) + $(MAKE) -C $* -f Makefile validate-cache + +.PHONY: $(CACHECLEAN) +$(CACHECLEAN): %.clean: + rm -rf ${CACHE_DIR}/$* -- cgit 1.2.3-korg