X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=Makefile;h=841b6b71bba8d484a2dd0e94b3548faa59720cab;hb=6fcc669084d3a26136454a4d932f68cc900a71c0;hp=8300711d7eb008142654a35099ac8222bce379ec;hpb=42f8585ebb8fffad19a89314659ab9129176c3e9;p=armband.git diff --git a/Makefile b/Makefile index 8300711d..841b6b71 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ ############################################################################## -# Copyright (c) 2016 Cavium -# Copyright (c) 2016 Enea AB and others. +# Copyright (c) 2016,2017 Cavium, Enea AB and others. # 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 @@ -23,13 +22,22 @@ # - Fuel@OPNFV is made aware of an Armband type build by passing # the "ARMBAND_BASE" env var; +SHELL = /bin/sh + export ARMBAND_BASE := $(shell pwd) export OPNFV_GIT_SHA := $(shell git rev-parse HEAD) export REVSTATE include armband-fuel-config.mk -all: release +all: upgrade + +# Ignore release tag and upgrade Armband to latest change on /HEAD +.PHONY: upgrade +upgrade: + @git fetch -u origin ${A_BRANCH}:${A_BRANCH} + @git checkout ${A_BRANCH} + @$(MAKE) -e submodules-clean patches-import # Fetch & update git submodules, checkout remote HEAD .PHONY: submodules-init @@ -41,13 +49,11 @@ submodules-init: .submodules-init else \ git submodule update --init 2>/dev/null; \ fi - @ln -sf ${A_FUEL_BASE}/ci/clean_cache.sh ${ARMBAND_BASE}/ci/clean_cache.sh @touch $@ # Clean any changes made to submodules, checkout Armband root commit .PHONY: submodules-clean -submodules-clean: .submodules-init - @test ! -d ${F_REPOS_DIR} || $(MAKE) fuel-patches-clean +submodules-clean: @git submodule -q foreach ' \ git am -q --abort 2>/dev/null; \ git checkout -q -f ${A_OPNFV_TAG}-root 2>/dev/null; \ @@ -55,13 +61,15 @@ submodules-clean: .submodules-init git tag | grep ${A_OPNFV_TAG} | xargs git tag -d > /dev/null 2>&1; \ git reset -q --hard HEAD; \ git clean -xdff' - @rm -f .submodules-patched + @rm -f .submodules-* + @$(MAKE) -e submodules-init # Generate patches from submodules .PHONY: patches-export patches-export: .submodules-init @git submodule -q foreach ' \ SUB_DIR=${A_PATCH_DIR}/$$name; \ + rm -rf $$SUB_DIR/*; \ git tag | awk "!/root/ && /${A_OPNFV_TAG}-fuel/" | while read A_TAG; do \ SUB_FEATURE=`dirname $${A_TAG#${A_OPNFV_TAG}-fuel/}`; \ echo "`tput setaf 2`== exporting $$name ($$A_TAG)`tput sgr0`"; \ @@ -88,14 +96,15 @@ patches-import: .submodules-init .submodules-patched SUB_FEATURE=$${p_dir#$$SUB_DIR} \ SUB_TAG=${A_OPNFV_TAG}-fuel$$SUB_FEATURE/patch; \ echo "`tput setaf 2`== patching $$name ($$SUB_TAG)`tput sgr0`";\ - git tag $$SUB_TAG-root && git am -3 --whitespace=nowarn \ + git tag $$SUB_TAG-root && \ + git am -3 --whitespace=nowarn --patch-format=mbox \ --committer-date-is-author-date $$SUB_PATCHES && \ git tag $$SUB_TAG || exit 1; \ fi \ done && \ git tag ${A_OPNFV_TAG}' # Staging Fuel@OPNFV patches - @ls -d ${F_SUB_DIR}/* 2>/dev/null | while read p_sub_path; do \ + @ls -d ${F_PATCH_DIR}/* 2>/dev/null | while read p_sub_path; do \ SUB_NAME=`basename $$p_sub_path`; \ find ${A_PATCH_DIR}/$$SUB_NAME -name '*.patch' 2>/dev/null -exec sh -c '\ A_PATCH={}; R_PATCH=$${A_PATCH#${A_PATCH_DIR}/}; \ @@ -113,47 +122,23 @@ patches-import: .submodules-init .submodules-patched done @touch $@ -# Pass down clean/deepclean/build to Fuel@OPNFV -.PHONY: clean -clean: .submodules-init - $(MAKE) -e --no-print-directory -C ${F_BUILD_DIR} clean - -.PHONY: deepclean -deepclean: clean - $(MAKE) -e --no-print-directory -C ${F_BUILD_DIR} deepclean - @git submodule deinit -f . - @rm -f .submodules* - -.PHONY: build -build: patches-import - $(MAKE) -e --no-print-directory -C ${F_BUILD_DIR} all - -.PHONY: release -release: export LC_ALL=en_US.UTF-8 -release: build - ############################################################################## # Fuel@OPNFV patch operations - to be used only during development ############################################################################## - # Apply all Fuel@OPNFV patches, including Armband patches .PHONY: fuel-patches-import fuel-patches-import: .submodules-patched fuel-patches-clean - $(MAKE) -e -C ${F_REPOS_DIR} patches-import - -# Export Fuel@OPNFV patches, including Armband patches -.PHONY: fuel-patches-export -fuel-patches-export: .submodules-patched - $(MAKE) -e -C ${F_REPOS_DIR} patches-export - @ls -d ${F_PATCH_DIR}/* 2>/dev/null | while read p_sub_path; do \ - SUB_NAME=`basename $$p_sub_path`; \ - if [ -d $$p_sub_path/armband ]; then \ - echo "`tput setaf 6`* Pulling $$SUB_NAME patches.`tput sgr0`"; \ - cp -R $$p_sub_path/armband/* ${A_PATCH_DIR}/$$SUB_NAME && \ - rm -rf $$p_sub_path/armband; \ - fi \ - done + $(MAKE) -e -C ${F_PATCH_DIR} patches-import .PHONY: fuel-patches-clean fuel-patches-clean: - $(MAKE) -e -C ${F_REPOS_DIR} clean + $(MAKE) -e -C ${F_PATCH_DIR} clean + +# Add copyright header to patch files if not already present +.PHONY: patches-copyright +patches-copyright: + @grep -e "Copyright (c)" -L ${A_PATCHES} | while read p_file; do \ + ptmp=`mktemp` && \ + cat armband-patch-copyright.template $$p_file > $$ptmp && \ + mv $$ptmp $$p_file; \ + done