TAG to use _ instead of .

This commit is contained in:
Trevor Batley 2024-03-24 10:29:15 +11:00
parent 1e00424274
commit 452e84b2ca

View File

@ -4,13 +4,14 @@
# $2 = Organisation (smeserver or smecontrib)e # $2 = Organisation (smeserver or smecontrib)e
# optional (can be in any order) # optional (can be in any order)
# <local> will use parameters set for local repository else it will use remote # <local> will use parameters set for local repository else it will use remote
# <purge> will purge all old tags
# <debug> turn on debug regardless of ~/.smegit/config # <debug> turn on debug regardless of ~/.smegit/config
# <noisy> print a line showing how it was called # <noisy> print a line showing how it was called
# Module name must exist # Module name must exist
# #
if [[ -z $1 ]] ; then if [[ -z $1 ]] ; then
echo "************git-retag.sh <modulename> <organization> [<local> | <debug>]" echo "************git-retag.sh <modulename> <organization> [<local> | <purge> | <debug> | <noisy>]"
exit 0 exit 0
fi fi
@ -31,7 +32,7 @@ if [ ! -e $inifilename ] ; then
# Not here, look at system default # Not here, look at system default
if [ ! -e /etc/smegit.ini ] ; then if [ ! -e /etc/smegit.ini ] ; then
echo "No ini file found $inifiename or /etc/smegit.ini" echo "No ini file found $inifiename or /etc/smegit.ini"
echo "git-retag.sh <modulename> <organization> [<local> | <debug>]" echo "git-retag.sh <modulename> <organization> [<local> | <purge> | <debug> | <noisy>]"
exit 1 exit 1
else else
initfilename="/etc/smegit.ini" initfilename="/etc/smegit.ini"
@ -75,7 +76,7 @@ for param in $3 $4 $5 $6 ; do
DEBUG=true ;; DEBUG=true ;;
noisy ) noisy )
NOISY=true ;; NOISY=true ;;
clean ) purge )
CLEAN=true ;; CLEAN=true ;;
* ) * )
echo "Unkown parameter: $param" echo "Unkown parameter: $param"
@ -147,6 +148,7 @@ if [ $CLEAN ] ; then
OLDTAGS=$(git tag --list) OLDTAGS=$(git tag --list)
# delete old tag/s # delete old tag/s
for tag in $OLDTAGS ; do for tag in $OLDTAGS ; do
if [ $DEBUG ] ; then echo "Removing tag $tag" ; fi
git tag --delete $tag git tag --delete $tag
git push origin --delete $tag git push origin --delete $tag
git push --tags git push --tags
@ -156,6 +158,7 @@ fi
VERSION_RELEASE_LONG=`rpm --queryformat '%{version} %{release}\n' --specfile $REPO_NAME.spec` VERSION_RELEASE_LONG=`rpm --queryformat '%{version} %{release}\n' --specfile $REPO_NAME.spec`
VERSION_RELEASE=${VERSION_RELEASE_LONG%%$'\n'*} VERSION_RELEASE=${VERSION_RELEASE_LONG%%$'\n'*}
VERSION=${VERSION_RELEASE% *} VERSION=${VERSION_RELEASE% *}
VERSION=${VERSION//./_}
RELEASE=${VERSION_RELEASE#* } RELEASE=${VERSION_RELEASE#* }
TAG=$VERSION"-"${RELEASE%.*} TAG=$VERSION"-"${RELEASE%.*}
if [ $DEBUG ] ; then if [ $DEBUG ] ; then
@ -168,5 +171,6 @@ git pull
git tag -a $TAG -m "Setting tag to current Version-Release in spec file: $TAG" git tag -a $TAG -m "Setting tag to current Version-Release in spec file: $TAG"
git push origin --tag $TAG $QUIET git push origin --tag $TAG $QUIET
echo "Current $ORGGITEA/$REPO_NAME tagged as $TAG - old tags removed" echo "Current $ORGGITEA/$REPO_NAME tagged as $TAG"
if [ $CLEAN ] ; then echo " - old tags removed" ; fi
exit 0 exit 0