]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/ofed/management/gen_ver.sh
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / ofed / management / gen_ver.sh
1 #!/bin/sh
2 #
3 # This generates a version string which includes recent version as
4 # specified in correspondent sub project's configure.in file, plus
5 # git revision abbreviation in the case if sub-project HEAD is different
6 # from recent tag, plus "-dirty" suffix if local uncommitted changes are
7 # in the sub project tree.
8 #
9
10 usage()
11 {
12         echo "Usage: $0 <target>"
13         exit 2
14 }
15
16 test -z "$1" && usage
17
18 package=$1
19
20 cd `dirname $0`
21
22 conf_file=$package/configure.in
23 version=`cat $conf_file | sed -ne '/AC_INIT.*'$package'.*/s/^AC_INIT.*'$package', \(.*\),.*$/\1/p'`
24
25 git diff --quiet $package-$version..HEAD -- $package > /dev/null 2>&1
26 if [ $? -eq 1 ] ; then
27         abbr=`git rev-parse --short --verify HEAD 2>/dev/null`
28         if [ ! -z "$abbr" ] ; then
29                 version="${version}_${abbr}"
30         fi
31 fi
32
33 git diff-index --quiet HEAD -- $package > /dev/null 2>&1
34 if [ $? -eq 1 ] ; then
35         version="${version}_dirty"
36 fi
37
38 echo $version