Merged revisions 55868 via svnmerge from
[asterisk-bristuff.git] / build_tools / make_version
blob6176de2c0b471a95dcb6de702c494bbff45e7e02
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/asterisk/::' | sed -e 's:/: :g'`
7 BRANCH=0
8 TEAM=0
9 TAG=0
11 REV=`svnversion -c ${1} | cut -d: -f2`
13 if [ "${PARTS}" = "trunk" ]
14 then
15 echo SVN-'trunk'-r${REV}
16 exit 0
19 for PART in $PARTS
21 if [ ${TAG} != 0 ]
22 then
23 RESULT="${PART}"
24 break
27 if [ ${BRANCH} != 0 ]
28 then
29 RESULT="${RESULT}-${PART}"
30 break
33 if [ ${TEAM} != 0 ]
34 then
35 RESULT="${RESULT}-${PART}"
36 continue
39 if [ "${PART}" = "branches" ]
40 then
41 BRANCH=1
42 RESULT="branch"
43 continue
46 if [ "${PART}" = "tags" ]
47 then
48 TAG=1
49 continue
52 if [ "${PART}" = "team" ]
53 then
54 TEAM=1
55 continue
57 done
59 if [ ${TAG} != 0 ]
60 then
61 echo ${RESULT}
62 else
63 echo SVN-${RESULT##-}-r${REV}