Files
asterisk/build_tools/make_version
T

80 lines
1.8 KiB
Bash
Raw Normal View History

#!/bin/sh
if [ -f ${1}/.version ]; then
2009-03-12 01:33:04 +00:00
cat ${1}/.version
elif [ -d .svn ]; then
2007-12-17 07:25:35 +00:00
PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/asterisk/::' | sed -e 's:/: :g'`
BRANCH=0
TEAM=0
2007-02-21 14:07:43 +00:00
TAG=0
2007-12-10 09:00:44 +00:00
REV=`svnversion -c ${1} | cut -d: -f2`
2007-05-22 20:26:35 +00:00
INTEGRATED=`LANG=C svn pg automerge-propname ${1}`
if [ -z "${INTEGRATED}" ] ; then
2009-03-12 01:33:04 +00:00
INTEGRATED=svnmerge-integrated
fi
BASE=`LANG=C svn pg ${INTEGRATED} ${1} | cut -d: -f1`
2007-12-10 09:00:44 +00:00
if [ "${PARTS}" = "trunk" ] ; then
2009-03-12 01:33:04 +00:00
echo SVN-trunk-r${REV}
exit 0
fi
2007-12-10 09:00:44 +00:00
for PART in $PARTS ; do
2009-03-12 01:33:04 +00:00
if [ ${TAG} != 0 ] ; then
if [ "${PART}" = "autotag_for_be" ] ; then
continue
fi
if [ "${PART}" = "autotag_for_sx00i" ] ; then
continue
fi
RESULT="${PART}"
break
fi
2007-12-10 09:00:44 +00:00
2009-03-12 01:33:04 +00:00
if [ ${BRANCH} != 0 ] ; then
if [ -z "${RESULT}" ] ; then
RESULT="${PART}"
else
RESULT="${RESULT}-${PART}"
fi
break
fi
2007-12-10 09:00:44 +00:00
2009-03-12 01:33:04 +00:00
if [ ${TEAM} != 0 ] ; then
if [ -z "${RESULT}" ] ; then
RESULT="${PART}"
else
RESULT="${RESULT}-${PART}"
fi
continue
fi
2007-12-10 09:00:44 +00:00
2009-03-12 01:33:04 +00:00
if [ "${PART}" = "branches" ] ; then
BRANCH=1
RESULT="branch"
continue
fi
2007-12-10 09:00:44 +00:00
2009-03-12 01:33:04 +00:00
if [ "${PART}" = "tags" ] ; then
TAG=1
continue
fi
2007-12-10 09:00:44 +00:00
2009-03-12 01:33:04 +00:00
if [ "${PART}" = "team" ] ; then
TEAM=1
continue
fi
done
2007-12-10 09:00:44 +00:00
if [ ${TAG} != 0 ] ; then
2009-03-12 01:33:04 +00:00
echo ${RESULT}
2007-12-10 09:00:44 +00:00
else
2009-03-12 01:33:04 +00:00
echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}}
2007-02-21 14:07:43 +00:00
fi
else
2009-03-12 01:33:04 +00:00
echo "UNKNOWN__and_probably_unsupported"
fi