3 # This script is run by autogen to create the FULL_VERSION file.
5 # If run from a git branch, it append '.git.' + git sha1 to the VERSION file.
6 # If run from a svn branch, it append '.svn.' + svn number to the VERSION file.
7 # If run from a svn tag that match /rc/ it use only the tag name to set the
8 # VERSION, this is done specifically for zmanda rc build.
9 # If run from a svn tag that doesn't match /rc/ it use only the VERSION file.
11 # It is important to update the VERSION file before creating a tag.
13 # ./autogen run config/set_full_version, it create the FULL_VERSION file.
14 # ./configure use the FULL_VERSION file.
19 svn info . > conftemp.svn
21 echo "" > conftemp.svn
24 if test -d .svn && ( grep Revision: conftemp.svn > /dev/null; ); then
25 #if grep Revision: conftemp.svn > /dev/null ; then
26 SVN_REV=`grep Revision: conftemp.svn|cut -d: -f 2|cut -c2-`
27 SVN_URL=`grep URL: conftemp.svn|cut -d: -f 2-|cut -c2-`
28 SVN_PATH=`grep URL: conftemp.svn|cut -d "/" -f 7-`
29 SVN_TYPE=`echo ${SVN_PATH} |cut -d "/" -f 1`
30 SVN_BRANCH=`echo "${SVN_PATH}"| cut -d "/" -f 2`
31 url=`grep URL: conftemp.svn|cut -d: -f 2-|cut -c2-`
35 GIT_SHA1=`git rev-parse HEAD | cut -c -8 `
38 if test -f FULL_VERSION; then
39 FULL_VERSION_FILE="FULL_VERSION"
40 OLD_VERSION=`cat $FULL_VERSION_FILE`
41 else if test -n "$srcdir" -a -f $srcdir/FULL_VERSION; then
42 FULL_VERSION_FILE="$srcdir/FULL_VERSION"
43 OLD_VERSION=`cat $FULL_VERSION_FILE`
45 FULL_VERSION_FILE="FULL_VERSION"
50 if test -n "$srcdir"; then
51 VERSION_FILE="$srcdir/VERSION"
53 VERSION_FILE="VERSION"
55 VERSION=`cat $VERSION_FILE`
57 if test -n "$SVN_REV"; then
58 if test "${SVN_TYPE}" = "branches"; then
59 VERSION=${VERSION}.svn.${SVN_REV}
60 else if test "${SVN_TYPE}" = "trunk"; then
61 VERSION=${VERSION}.svn.${SVN_REV}
63 RC=`echo "${SVN_BRANCH}"| grep "rc"`
64 if test -n "$RC"; then
65 VERSION=`echo "${SVN_BRANCH}"| sed 's/[^0-9]*// ; s/[_.]//g'`
66 VERSION=`echo ${VERSION}| sed 's/^\([0-9]\)\([0-9]\)\([0-9]\)/\1.\2.\3/'`
71 else if test -n "$GIT_SHA1"; then
72 VERSION=${VERSION}".git."${GIT_SHA1}
74 else if test -n "$OLD_VERSION"; then
80 if test "$VERSION" != "$OLD_VERSION" -o $VERSION_FILE -nt FULL_VERSION; then
81 echo "$VERSION" > FULL_VERSION