File: update_version.sh

package info (click to toggle)
freebayes 1.3.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,984 kB
  • sloc: cpp: 125,778; ansic: 4,581; sh: 1,084; python: 672; asm: 271; javascript: 94; lisp: 85; makefile: 37; perl: 27
file content (25 lines) | stat: -rwxr-xr-x 839 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

BASE_DIR=$1

RELEASED_VERSION_FILE=${BASE_DIR}/src/version_release.txt
if [ -d "${BASE_DIR}/.git" ] && which git > /dev/null
then
	DETECTED_VERSION=$(git describe --always --tags --dirty)
else
	DETECTED_VERSION=$(grep -v "^#" $RELEASED_VERSION_FILE)
fi

VERSION_FILE=${BASE_DIR}/src/version_git.h
CURRENT_VERSION=""
[ -e "$VERSION_FILE" ] && CURRENT_VERSION=$(grep "define VERSION_GIT " "$VERSION_FILE" | cut -f3 -d" " | sed 's/"//g')
echo "DETECTED_VERSION = $DETECTED_VERSION"
echo "CURRENT_VERSION  = $CURRENT_VERSION"
if [ "${DETECTED_VERSION}" != "${CURRENT_VERSION}" ]
then
	echo "Updating version file."
	echo "#ifndef VERSION_GIT_H" > $VERSION_FILE
	echo "#define VERSION_GIT_H" >> $VERSION_FILE
	echo "#define VERSION_GIT \"${DETECTED_VERSION}\"" >> $VERSION_FILE
	echo "#endif /* VERSION_GIT_H */" >> $VERSION_FILE
fi