From 11c209e862e90fb3be283e6410af2b6abf75bb71 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Mon, 6 Aug 2018 10:09:27 +0800 Subject: [PATCH] DM: add tag info while no repo in release there is no git repo, which download from github release, however, acrn-dm -v will get tag info from this repo, in such case, the tag info was null. this patch will fix nul tag, which get it from CL mock build. Tracked-On: #676 Signed-off-by: Wei Liu Reviewed-by: Jason Chen CJ --- Makefile | 4 +++- devicemodel/Makefile | 21 ++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 7c3e07353..c0e021531 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,8 @@ DM_OUT := $(ROOT_OUT)/devicemodel TOOLS_OUT := $(ROOT_OUT)/tools MISC_OUT := $(ROOT_OUT)/misc DOC_OUT := $(ROOT_OUT)/doc +BUILD_VERSION ?= +BUILD_TAG ?= export TOOLS_OUT .PHONY: all hypervisor devicemodel tools misc doc @@ -27,7 +29,7 @@ sbl-hypervisor: devicemodel: tools make -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) clean - make -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) + make -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) DM_BUILD_VERSION=$(BUILD_VERSION) DM_BUILD_TAG=$(BUILD_TAG) tools: mkdir -p $(TOOLS_OUT) diff --git a/devicemodel/Makefile b/devicemodel/Makefile index 314f21f47..a72b5b21f 100644 --- a/devicemodel/Makefile +++ b/devicemodel/Makefile @@ -5,6 +5,8 @@ include ../VERSION FULL_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)$(EXTRA_VERSION) BASEDIR := $(shell pwd) DM_OBJDIR ?= $(CURDIR)/build +DM_BUILD_VERSION ?= +DM_BUILD_TAG ?= CC ?= gcc @@ -154,16 +156,21 @@ distclean: include/version.h: touch include/version.h - @COMMIT=`git rev-parse --verify --short HEAD 2>/dev/null`;\ - DIRTY=`git diff-index --name-only HEAD`;\ - if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\ - DAILY_TAG=`git tag --merged HEAD|grep "acrn"|tail -n 1`;\ + if [ "$(DM_BUILD_VERSION)"x = x -o "$(DM_BUILD_TAG)"x = x ];then\ + COMMIT=`git rev-parse --verify --short HEAD 2>/dev/null`;\ + DIRTY=`git diff-index --name-only HEAD`;\ + if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\ + DAILY_TAG=`git tag --merged HEAD|grep "acrn"|tail -n 1`;\ + else\ + PATCH=$(DM_BUILD_VERSION);\ + DAILY_TAG=$(DM_BUILD_TAG);\ + fi;\ TIME=`date "+%Y-%m-%d %H:%M:%S"`;\ USER=`id -u -n`; \ echo "/*" > include/version.h; \ - sed 's/^/ * /' ../LICENSE >> include/version.h; \ - echo " */" >> include/version.h; \ - echo "" >> include/version.h; \ + sed 's/^/ * /' ../LICENSE >> include/version.h;\ + echo " */" >> include/version.h;\ + echo "" >> include/version.h;\ echo "#define DM_MAJOR_VERSION $(MAJOR_VERSION)" >> include/version.h;\ echo "#define DM_MINOR_VERSION $(MINOR_VERSION)" >> include/version.h;\ echo "#define DM_EXTRA_VERSION "\"$(EXTRA_VERSION)\""" >> include/version.h;\