I believe this is what was meant. (it matches how Asterisk does it)
[libpri-bristuff.git] / build_tools / make_version
blob28af581a047f828eea3c548515ec6ece2327595c
1 #!/bin/sh
3 if [ -f ${1}/.version ]; then
4 cat ${1}/.version
5 elif [ -d .svn ]; then
6 PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/libpri/::' | sed -e 's:/: :g'`
7 BRANCH=0
8 TEAM=0
9 TAG=0
11 REV=`svnversion -c ${1} | cut -d: -f2`
13 BASE=`LANG=C svn pg svnmerge-integrated ${1} | cut -d: -f1`
15 if [ "${PARTS}" = "trunk" ] ; then
16 echo SVN-trunk-r${REV}
17 exit 0
20 for PART in $PARTS ; do
21 if [ ${TAG} != 0 ] ; then
22 if [ "${PART}" = "autotag_for_be" ] ; then
23 continue
25 if [ "${PART}" = "autotag_for_sx00i" ] ; then
26 continue
28 RESULT="${PART}"
29 break
32 if [ ${BRANCH} != 0 ] ; then
33 if [ -z ${RESULT} ] ; then
34 RESULT="${PART}"
35 else
36 RESULT="${RESULT}-${PART}"
38 break
41 if [ ${TEAM} != 0 ] ; then
42 if [ -z ${RESULT} ] ; then
43 RESULT="${PART}"
44 else
45 RESULT="${RESULT}-${PART}"
47 continue
50 if [ "${PART}" = "branches" ] ; then
51 BRANCH=1
52 RESULT="branch"
53 continue
56 if [ "${PART}" = "tags" ] ; then
57 TAG=1
58 continue
61 if [ "${PART}" = "team" ] ; then
62 TEAM=1
63 continue
65 done
67 if [ ${TAG} != 0 ] ; then
68 echo ${RESULT}
69 else
70 echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}}