-
Notifications
You must be signed in to change notification settings - Fork 11
/
version_check.sh
executable file
·47 lines (34 loc) · 1.1 KB
/
version_check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
CUR_DIR=$(pwd)
cd ../../lib_nn/lib_nn
if ! ../version_check.sh; then
exit 1
fi
cd $CUR_DIR
printf "\nRunning version check for lib_tflite_micro..."
# in lib_tflite_micro/lib_tflite_micro folder
TAG=$(git describe --tags --abbrev=0)
GIT_VERSION=$(printf ${TAG} | sed 's/v//')
printf "\nGit version = "$GIT_VERSION
function get_version()
{
local filename=$1
MAJOR=$(grep 'major' $filename | awk '{print $6}' | sed 's/;//')
MINOR=$(grep 'minor' $filename | awk '{print $6}' | sed 's/;//')
PATCH=$(grep 'patch' $filename | awk '{print $6}' | sed 's/;//')
printf "$MAJOR.$MINOR.$PATCH"
}
VERSION_H="api/version.h"
VERSION_H_STR=$(get_version $VERSION_H)
printf "\nVersion header = "$VERSION_H_STR
if [ "$GIT_VERSION" != "$VERSION_H_STR" ]
then printf "\nVersion mismatch!" && exit 1
fi
MODULE_BUILD_INFO="module_build_info"
MODULE_BUILD_INFO_STR=$(grep 'VERSION' $MODULE_BUILD_INFO | awk '{print $3}')
printf "\nModule build info version = "$MODULE_BUILD_INFO_STR
if [ "$VERSION_H_STR" != "$MODULE_BUILD_INFO_STR" ]
then printf "\nVersion mismatch!" && exit 1
fi
printf "\n"
exit 0