#!/bin/sh # # This script deletes a component tag # # Parameters # $1 : component name # $2 : tag type (doc, package, source, test) # $3 : version # $4 : release # # Environment variable that MUST be defined # by the calling script # # SVN_URL SVN_USER SVN_PASS # # Source functions # . `dirname $0`/functions # # Binaries # BIN_ECHO="/bin/echo" BIN_SVN="/usr/bin/svn" # # Parameters # SVN_COMPONENT="" TAG_TYPE="" SVN_VERSION="" SVN_RELEASE="" # # Internal variables # EXIT=0 # # Main script # if [ $EXIT -eq 0 ] ; then check_svn_parameters if [ -z "$1" ] ; then $BIN_ECHO "-> SVN component parameter is missing" EXIT=1 else SVN_COMPONENT=$1 fi if [ -z "$2" ] ; then $BIN_ECHO "-> Tag type parameter is missing (doc, package, source or test)" EXIT=1 else if [ "$2" != "doc" -a "$2" != "package" -a "$2" != "source" -a "$2" != "test" ] ; then $BIN_ECHO "-> Tag type '$2' is not supported (doc, package, source or test)" EXIT=1 else TAG_TYPE=$2 fi fi if [ -z "$3" ] ; then $BIN_ECHO "-> SVN version parameter is missing" EXIT=1 else SVN_VERSION=$3 fi if [ -z "$4" ] ; then if [ "$TAG_TYPE" = "package" ] ; then $BIN_ECHO "-> SVN release parameter is missing" EXIT=1 fi else SVN_RELEASE=$4 fi fi if [ $EXIT -eq 0 ] ; then TAG_NAME=$SVN_VERSION if [ "$TAG_TYPE" = "package" ] ; then TAG_NAME="$TAG_NAME-$SVN_RELEASE" fi $BIN_SVN delete --username $SVN_USER --password $SVN_PASS -m "Delete tag $TAG_TYPE/$TAG_NAME of component $SVN_COMPONENT" $SVN_URL/tags/component/$SVN_COMPONENT/$TAG_TYPE/$TAG_NAME >> /dev/null 2>&1 if [ $? -ne 0 ] ; then $BIN_ECHO "-> Error while deleting tag '$SVN_URL/tags/component/$SVN_COMPONENT/$TAG_TYPE/$TAG_NAME'" EXIT=1 fi fi exit $EXIT