From 856f768e3a54037cfa485b2f81ef7bdcfb20f40f Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 21 Mar 2018 09:42:02 +0000 Subject: [PATCH] version: Strip SOF_FW_XXX_ prefix from version number The version information is generated using git tags and needs to be numerical for version.h usage. Signed-off-by: Liam Girdwood --- version.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/version.sh b/version.sh index 4f25ecd0b..5413fb334 100755 --- a/version.sh +++ b/version.sh @@ -10,11 +10,22 @@ else DIR=$1 fi +# get version from git tag +GIT_TAG=`git describe --abbrev=4` + +# Some releases have a SOF_FW_XXX_ prefix on the tag and this prefix +# must be stripped for usage in version.h. i.e. we just need the number. +if [ $(expr match $GIT_TAG 'SOF_FW_[A-Z][A-Z][A-Z]_' ) -eq 11 ]; then + VER=`echo $GIT_TAG | cut -d_ -f4` +else + VER=$GIT_TAG +fi + # create git version if we are a git repo or git worktree if [ -e $DIR/.git -o -d $DIR/.git ]; then # version for make dist - git describe --abbrev=4 > $DIR/.version - git describe --abbrev=4 > $DIR/.tarball-version + echo $VER > $DIR/.version + echo $VER > $DIR/.tarball-version # git commit for IPC echo "#define REEF_TAG \"`git log --pretty=format:\"%h\" -1 | cut -c1-5`\"" > $DIR/src/include/version.h