add clean option

This commit is contained in:
Trevor Batley 2024-03-11 21:01:54 +11:00
parent 9916c56721
commit a90599279b

View File

@ -52,6 +52,7 @@ GITEAUser=${remote_USER}
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN} GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
GITEAHOST=${remote_GITEAHOST} GITEAHOST=${remote_GITEAHOST}
NOISY= NOISY=
CLEAN=
EXTRAPARAMS= EXTRAPARAMS=
for param in $3 $4 $5 $6 ; do for param in $3 $4 $5 $6 ; do
if [ $param ] ; then if [ $param ] ; then
@ -65,6 +66,8 @@ for param in $3 $4 $5 $6 ; do
DEBUG=true ;; DEBUG=true ;;
noisy ) noisy )
NOISY=true ;; NOISY=true ;;
clean )
CLEAN=true ;;
* ) * )
echo "Unkown parameter: $param" echo "Unkown parameter: $param"
exit 1 exit 1
@ -130,19 +133,16 @@ else
fi fi
cd $GITFiles/$REPO_NAME cd $GITFiles/$REPO_NAME
if [ $CLEAN ] ; then
# read the existing tags # read the existing tags
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
# git tag --delete $tag git tag --delete $tag
# git push origin --delete $tag git push origin --delete $tag
# for some reason the remote delete is rejected, so were using the gitea API call instead git push --tags
if [[ $DEBUG ]] ; then echo "curl $checkSSL $SILENT4CURL -X 'DELETE' '$GITEAHOST/api/v1/orgs/$ORGGITEA/$REPO_NAME/tags/$tag' -H 'accept: application/json' -H 'Authorization: token $GITEAACCESSTOKEN'" ; fi
RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -X 'DELETE' \
"$GITEAHOST/api/v1/orgs/$ORGGITEA/$REPO_NAME/tags/$tag" \
-H 'accept: application/json' \
-H "Authorization: token $GITEAACCESSTOKEN" )
done done
fi
# Now create the version and release tag from the specfile # Now create the version and release tag from the specfile
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'*}