Skip to content

Commit e3a4436

Browse files
committed
Add missing lcov script get_version.sh
1 parent 79d76e8 commit e3a4436

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

lcov-1.12/bin/get_version.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
#
3+
# Usage: get_version.sh --version|--release|--full
4+
#
5+
# Print lcov version or release information as provided by Git, .version
6+
# or a fallback.
7+
8+
TOOLDIR=$(cd $(dirname $0) ; pwd)
9+
GITVER=$(cd $TOOLDIR ; git describe --tags 2>/dev/null)
10+
11+
if [ -z "$GITVER" ] ; then
12+
# Get version information from file
13+
if [ -e "$TOOLDIR/../.version" ] ; then
14+
source "$TOOLDIR/../.version"
15+
fi
16+
else
17+
# Get version information from git
18+
FULL=${GITVER:1}
19+
VERSION=${GITVER%%-*}
20+
VERSION=${VERSION:1}
21+
if [ "${GITVER#*-}" != "$GITVER" ] ; then
22+
RELEASE=${GITVER#*-}
23+
RELEASE=${RELEASE/-/.}
24+
fi
25+
fi
26+
27+
# Fallback
28+
[ -z "$VERSION" ] && VERSION="1.0"
29+
[ -z "$RELEASE" ] && RELEASE="1"
30+
[ -z "$FULL" ] && FULL="$VERSION"
31+
32+
[ "$1" == "--version" ] && echo -n "$VERSION"
33+
[ "$1" == "--release" ] && echo -n "$RELEASE"
34+
[ "$1" == "--full" ] && echo -n "$FULL"

0 commit comments

Comments
 (0)