scripts: add local version number file

we now using git tag for version number control, but if
we release the code without .git/ folder, the git tag version
number is not present, so will cause compile error.
add the .tarball-version file as the local version number file,
it still can be generated by the autogen.sh from git tag. So
everytime anyone make a git tag should still modify the
.tarball-version file.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
This commit is contained in:
Zhu Yingjiang 2018-11-20 14:32:59 +08:00
parent 041a56c541
commit 0a433c831e
3 changed files with 9 additions and 5 deletions

1
.gitignore vendored
View File

@ -15,7 +15,6 @@
*.rom
*.man
.version
.tarball-version
*.x
.build
*.dis

1
.tarball-version Normal file
View File

@ -0,0 +1 @@
v1.1-185-g3507

View File

@ -15,14 +15,18 @@ fi
GIT_TAG=`git describe --abbrev=4 2>/dev/null`
# may fail to get git describe in some case, add this fallback to handle error
if [[ "x$GIT_TAG" == "x" ]]
then
GIT_TAG="v0.0-0-g0000"
if [[ "x$GIT_TAG" == "x" ]]; then
if [ -e $DIR/.tarball-version ]; then
VER=$(cat $DIR/.tarball-version)
echo $VER > $DIR/.version
else
GIT_TAG="v0.0-0-g0000"
fi
fi
# 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]+_' ) -lt 15 ]; then
if [ $(expr match "$GIT_TAG" 'SOF_FW_[A-Z]+_' ) -lt 15 ]; then
VER=`echo $GIT_TAG | cut -d_ -f4`
else
VER=$GIT_TAG