Skip to content

Commit 11c209e

Browse files
Wei Liulijinxia
authored andcommitted
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 <weix.w.liu@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
1 parent 8af90e0 commit 11c209e

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ DM_OUT := $(ROOT_OUT)/devicemodel
1111
TOOLS_OUT := $(ROOT_OUT)/tools
1212
MISC_OUT := $(ROOT_OUT)/misc
1313
DOC_OUT := $(ROOT_OUT)/doc
14+
BUILD_VERSION ?=
15+
BUILD_TAG ?=
1416
export TOOLS_OUT
1517

1618
.PHONY: all hypervisor devicemodel tools misc doc
@@ -27,7 +29,7 @@ sbl-hypervisor:
2729

2830
devicemodel: tools
2931
make -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) clean
30-
make -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT)
32+
make -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) DM_BUILD_VERSION=$(BUILD_VERSION) DM_BUILD_TAG=$(BUILD_TAG)
3133

3234
tools:
3335
mkdir -p $(TOOLS_OUT)

devicemodel/Makefile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ include ../VERSION
55
FULL_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)$(EXTRA_VERSION)
66
BASEDIR := $(shell pwd)
77
DM_OBJDIR ?= $(CURDIR)/build
8+
DM_BUILD_VERSION ?=
9+
DM_BUILD_TAG ?=
810

911
CC ?= gcc
1012

@@ -154,16 +156,21 @@ distclean:
154156

155157
include/version.h:
156158
touch include/version.h
157-
@COMMIT=`git rev-parse --verify --short HEAD 2>/dev/null`;\
158-
DIRTY=`git diff-index --name-only HEAD`;\
159-
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
160-
DAILY_TAG=`git tag --merged HEAD|grep "acrn"|tail -n 1`;\
159+
if [ "$(DM_BUILD_VERSION)"x = x -o "$(DM_BUILD_TAG)"x = x ];then\
160+
COMMIT=`git rev-parse --verify --short HEAD 2>/dev/null`;\
161+
DIRTY=`git diff-index --name-only HEAD`;\
162+
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
163+
DAILY_TAG=`git tag --merged HEAD|grep "acrn"|tail -n 1`;\
164+
else\
165+
PATCH=$(DM_BUILD_VERSION);\
166+
DAILY_TAG=$(DM_BUILD_TAG);\
167+
fi;\
161168
TIME=`date "+%Y-%m-%d %H:%M:%S"`;\
162169
USER=`id -u -n`; \
163170
echo "/*" > include/version.h; \
164-
sed 's/^/ * /' ../LICENSE >> include/version.h; \
165-
echo " */" >> include/version.h; \
166-
echo "" >> include/version.h; \
171+
sed 's/^/ * /' ../LICENSE >> include/version.h;\
172+
echo " */" >> include/version.h;\
173+
echo "" >> include/version.h;\
167174
echo "#define DM_MAJOR_VERSION $(MAJOR_VERSION)" >> include/version.h;\
168175
echo "#define DM_MINOR_VERSION $(MINOR_VERSION)" >> include/version.h;\
169176
echo "#define DM_EXTRA_VERSION "\"$(EXTRA_VERSION)\""" >> include/version.h;\

0 commit comments

Comments
 (0)