make_version 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/sh
  2. if [ -f ${1}/.version ]; then
  3. cat ${1}/.version
  4. elif [ -d .svn ]; then
  5. PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/asterisk/::' | sed -e 's:/: :g'`
  6. BRANCH=0
  7. TEAM=0
  8. TAG=0
  9. REV=`svnversion -c ${1} | cut -d: -f2`
  10. INTEGRATED=`LANG=C svn pg automerge-propname ${1}`
  11. if [ -z "${INTEGRATED}" ] ; then
  12. INTEGRATED=svnmerge-integrated
  13. fi
  14. BASE=`LANG=C svn pg ${INTEGRATED} ${1} | cut -d: -f1`
  15. if [ "${PARTS}" = "trunk" ] ; then
  16. echo SVN-trunk-r${REV}
  17. exit 0
  18. fi
  19. for PART in $PARTS ; do
  20. if [ ${TAG} != 0 ] ; then
  21. if [ "${PART}" = "autotag_for_be" ] ; then
  22. continue
  23. fi
  24. if [ "${PART}" = "autotag_for_sx00i" ] ; then
  25. continue
  26. fi
  27. RESULT="${PART}"
  28. break
  29. fi
  30. if [ ${BRANCH} != 0 ] ; then
  31. if [ -z "${RESULT}" ] ; then
  32. RESULT="${PART}"
  33. else
  34. RESULT="${RESULT}-${PART}"
  35. fi
  36. break
  37. fi
  38. if [ ${TEAM} != 0 ] ; then
  39. if [ -z "${RESULT}" ] ; then
  40. RESULT="${PART}"
  41. else
  42. RESULT="${RESULT}-${PART}"
  43. fi
  44. continue
  45. fi
  46. if [ "${PART}" = "branches" ] ; then
  47. BRANCH=1
  48. RESULT="branch"
  49. continue
  50. fi
  51. if [ "${PART}" = "tags" ] ; then
  52. TAG=1
  53. continue
  54. fi
  55. if [ "${PART}" = "team" ] ; then
  56. TEAM=1
  57. continue
  58. fi
  59. done
  60. if [ ${TAG} != 0 ] ; then
  61. echo ${RESULT}
  62. else
  63. echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}}
  64. fi
  65. else
  66. echo "UNKNOWN__and_probably_unsupported"
  67. fi