[Sound-open-firmware] [PATCH] version: Strip SOF_FW_XXX_ prefix from version number

Liam Girdwood liam.r.girdwood at linux.intel.com
Wed Mar 21 10:44:29 CET 2018


The version information is generated using git tags and needs to be
numerical for version.h usage.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 version.sh | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/version.sh b/version.sh
index 4f25ecd0..5413fb33 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
-- 
2.14.1



More information about the Sound-open-firmware mailing list