3bdbb5f9bf
Library version will now only have major and minor. Package
version will now include number of commits since previous
package. Both SO and package versions rely on git tags to
determine the current build and the commits since the last
release.
Change-Id: If2bda74bf342930a9e07f5c91cb1380b6b7c64ca
[ROCm/amdsmi commit: fe738eaedb]
37 строки
744 B
Bash
Исполняемый файл
37 строки
744 B
Bash
Исполняемый файл
#!/bin/bash
|
|
|
|
# Handle commandline args
|
|
while [ "$1" != "" ]; do
|
|
case $1 in
|
|
-c ) # Commits since prevous tag
|
|
TARGET="count" ;;
|
|
* )
|
|
TARGET="count"
|
|
break ;;
|
|
esac
|
|
shift 1
|
|
done
|
|
TAG_PREFIX=$1
|
|
reg_ex="${TAG_PREFIX}*"
|
|
|
|
commits_since_last_tag() {
|
|
TAG_ARR=(`git tag --sort=committerdate -l ${reg_ex} | tail -2`)
|
|
PREVIOUS_TAG=${TAG_ARR[0]}
|
|
CURRENT_TAG=${TAG_ARR[1]}
|
|
|
|
PREV_CMT_NUM=`git rev-list --count $PREVIOUS_TAG`
|
|
CURR_CMT_NUM=`git rev-list --count $CURRENT_TAG`
|
|
|
|
# Commits since prevous tag:
|
|
let NUM_COMMITS="${CURR_CMT_NUM}-${PREV_CMT_NUM}"
|
|
echo $NUM_COMMITS
|
|
}
|
|
|
|
case $TARGET in
|
|
count) commits_since_last_tag ;;
|
|
*) die "Invalid target $target" ;;
|
|
esac
|
|
|
|
exit 0
|
|
|