.PHONY: repos repos: $(BUILD_DIR)/repos/repos.done fuel_components_repos:= # Usage: # (eval (call build_repo,repo_name,repo_uri,sha)) define build_repo $(BUILD_DIR)/repos/$1/%: $(BUILD_DIR)/repos/$1.done $(BUILD_DIR)/repos/repos.done: $(BUILD_DIR)/repos/$1.done fuel_components_repos:=$(fuel_components_repos) $1 $(BUILD_DIR)/repos/$1.done: # Clone repo and checkout required commit mkdir -p $(BUILD_DIR)/repos rm -rf $(BUILD_DIR)/repos/$1 #Clone everything and checkout to branch (or hash) git clone $2 $(BUILD_DIR)/repos/$1 && (cd $(BUILD_DIR)/repos/$1 && git checkout -q $3) # Pull gerrit commits if given $(foreach var,$(filter-out none,$5), ( cd $(BUILD_DIR)/repos/$1 && git fetch $4 $(var) && git cherry-pick FETCH_HEAD ) ; ) touch $$@ endef $(eval $(call build_repo,nailgun,$(NAILGUN_REPO),$(NAILGUN_COMMIT),$(NAILGUN_GERRIT_URL),$(NAILGUN_GERRIT_COMMIT))) $(eval $(call build_repo,python-fuelclient,$(PYTHON_FUELCLIENT_REPO),$(PYTHON_FUELCLIENT_COMMIT),$(PYTHON_FUELCLIENT_GERRIT_URL),$(PYTHON_FUELCLIENT_GERRIT_COMMIT))) $(eval $(call build_repo,astute,$(ASTUTE_REPO),$(ASTUTE_COMMIT),$(ASTUTE_GERRIT_URL),$(ASTUTE_GERRIT_COMMIT))) $(eval $(call build_repo,fuellib,$(FUELLIB_REPO),$(FUELLIB_COMMIT),$(FUELLIB_GERRIT_URL),$(FUELLIB_GERRIT_COMMIT))) $(eval $(call build_repo,ostf,$(OSTF_REPO),$(OSTF_COMMIT),$(OSTF_GERRIT_URL),$(OSTF_GERRIT_COMMIT))) $(BUILD_DIR)/repos/repos.done: version_yaml=$(BUILD_DIR)/repos/version.yaml; \ for repo in $(strip $(fuel_components_repos)); do \ repo_commit_id=`git --git-dir=$(BUILD_DIR)/repos/$$repo/.git rev-parse --verify HEAD`; \ echo " $${repo}_sha: \"$${repo_commit_id}\""; \ done > $${version_yaml}.tmp; \ fuelmain_commit_id=`git rev-parse --verify HEAD`; \ echo " fuelmain_sha: \"$${fuelmain_commit_id}\"" >> $${version_yaml}.tmp; \ mv $${version_yaml}.tmp $${version_yaml} $(ACTION.TOUCH)