4 # This script creates a component tag
8 # $2 : tag type (doc, package, source, test)
13 # Environment variable that MUST be defined
14 # by the calling script
16 # SVN_URL SVN_USER SVN_PASS
21 . `dirname $0`/functions
27 BIN_SVN="/usr/bin/svn"
45 if [ $EXIT -eq 0 ] ; then
48 $BIN_ECHO "-> SVN component parameter is missing"
54 $BIN_ECHO "-> Tag type parameter is missing (doc, package, source or test)"
57 if [ "$2" != "doc" -a "$2" != "package" -a "$2" != "source" -a "$2" != "test" ] ; then
58 $BIN_ECHO "-> Tag type '$2' is not supported (doc, package, source or test)"
65 $BIN_ECHO "-> SVN version parameter is missing"
71 if [ "$TAG_TYPE" = "package" ] ; then
72 $BIN_ECHO "-> SVN release parameter is missing"
79 if [ $EXIT -eq 0 ] ; then
80 $BIN_SVN list --username $SVN_USER --password $SVN_PASS $SVN_URL/trunk/component/$SVN_COMPONENT/$TAG_TYPE >> /dev/null 2>&1
81 if [ $? -ne 0 ] ; then
82 $BIN_ECHO "-> Directory '$SVN_URL/trunk/component/$SVN_COMPONENT/$TAG_TYPE' does not exist"
86 if [ $EXIT -eq 0 ] ; then
87 $BIN_SVN list --username $SVN_USER --password $SVN_PASS $SVN_URL/tags/component/$SVN_COMPONENT >> /dev/null 2>&1
88 if [ $? -ne 0 ] ; then
89 $BIN_SVN mkdir --username $SVN_USER --password $SVN_PASS -m "Create tag directory of component $SVN_COMPONENT" $SVN_URL/tags/component/$SVN_COMPONENT >> /dev/null 2>&1
90 if [ $? -ne 0 ] ; then
91 $BIN_ECHO "-> Error while creating directory '$SVN_URL/tags/component/$SVN_COMPONENT'"
96 if [ $EXIT -eq 0 ] ; then
97 $BIN_SVN list --username $SVN_USER --password $SVN_PASS $SVN_URL/tags/component/$SVN_COMPONENT/$TAG_TYPE >> /dev/null 2>&1
98 if [ $? -ne 0 ] ; then
99 $BIN_SVN mkdir --username $SVN_USER --password $SVN_PASS -m "Create $TAG_TYPE tag directory of component $SVN_COMPONENT" $SVN_URL/tags/component/$SVN_COMPONENT/$TAG_TYPE >> /dev/null 2>&1
100 if [ $? -ne 0 ] ; then
101 $BIN_ECHO "-> Error while creating directory '$SVN_URL/tags/component/$SVN_COMPONENT/$TAG_TYPE'"
106 if [ $EXIT -eq 0 ] ; then
107 TAG_NAME=$SVN_VERSION
108 if [ "$TAG_TYPE" = "package" ] ; then
109 TAG_NAME="$TAG_NAME-$SVN_RELEASE"
112 if [ $EXIT -eq 0 ] ; then
113 $BIN_SVN list --username $SVN_USER --password $SVN_PASS $SVN_URL/tags/component/$SVN_COMPONENT/$TAG_TYPE/$TAG_NAME >> /dev/null 2>&1
114 if [ $? -eq 0 ] ; then
115 $BIN_ECHO "-> Directory '$SVN_URL/tags/component/$SVN_COMPONENT/$TAG_TYPE/$TAG_NAME' already exists"
119 if [ $EXIT -eq 0 ] ; then
120 $BIN_SVN copy --username $SVN_USER --password $SVN_PASS -m "Create tag $TAG_TYPE/$TAG_NAME of component $SVN_COMPONENT" $SVN_URL/trunk/component/$SVN_COMPONENT/$TAG_TYPE $SVN_URL/tags/component/$SVN_COMPONENT/$TAG_TYPE/$TAG_NAME >> /dev/null 2>&1
121 if [ $? -ne 0 ] ; then
122 $BIN_ECHO "-> Error while creating tag '$SVN_URL/tags/component/$SVN_COMPONENT/$TAG_TYPE/$TAG_NAME' from '$SVN_URL/trunk/component/$SVN_COMPONENT/$TAG_TYPE'"