[Asterisk-code-review] releaser.sh: Clean it up (repotools[master])

Joshua Colp asteriskteam at digium.com
Tue Apr 11 04:55:39 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5426 )

Change subject: releaser.sh:  Clean it up
......................................................................


releaser.sh:  Clean it up

Remove the initial prompt and sleep.
Make options like other scripts.

Change-Id: I820bed6fdc04839458610a546a8d3b47555d35ec
---
M releaser.sh
1 file changed, 41 insertions(+), 24 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/releaser.sh b/releaser.sh
index 0c3130f..f740446 100755
--- a/releaser.sh
+++ b/releaser.sh
@@ -1,30 +1,47 @@
 #!/bin/bash
 
-echo "If you haven't already moved the files from pending/ to downloads-asterisk/ -- do that now!"
-echo ""
-echo "Hit CTRL-C if you haven't done it."
-sleep 3
+TYPE=release
 
-if [ $# -ne 5 ]; then
-	echo "You need to provide the version number to add and to remove."
-	echo ""
-	echo "Try something like:"
-	echo "     releaser.sh 1.4.26 1.4.25.1 1.4 release asterisk"
-	echo " or"
-	echo "     releaser.sh 1.4.26-rc2 1.4.26-rc1 1.4 RC asterisk-addons"
-	echo " or"
-	echo "     releaser.sh 1.6.0 1.5.0 dont_care release libpri"
-	echo " or"
-	echo "     releaser.sh 2.0.0 2.1.0 2.0 release libss7"
-	echo " the format is"
-	echo "     releaser.sh NEW_VERSION OLD_VERSION BRANCH TYPE PROJECT"
-	exit;
-else
-	NEW_VERSION=$1
-	OLD_VERSION=$2
-	BRANCH=$3
-	TYPE=$4
-	PROJECT=$5
+while [ ${#@} -gt 0 ] ; do
+	case ${1} in
+	-o)
+		shift
+		OLD_VERSION=$1
+		;;
+	-v)
+		shift
+		NEW_VERSION=$1
+		;;
+	-b)
+		shift
+		BRANCH=$1
+		;;
+	--rc)
+		TYPE=RC
+		;;
+	-p)
+		shift
+		PROJECT=$1
+		;;
+	*)
+		echo "releaser.sh -o <old_version> -v <new_version> -b <branch> -p <project> [ --rc ]"
+		exit 1;
+	;;
+	esac
+	shift
+done
+
+FAIL=0
+
+[ -z "$OLD_VERSION" ] && FAIL=1
+[ -z "$NEW_VERSION" ] && FAIL=1
+[ -z "$BRANCH" -a "$PROJECT" = "asterisk" ] && FAIL=1
+[ -z "$PROJECT" ] && FAIL=1
+
+if [ $FAIL -gt 0 ] ; then
+	echo "Missing parameters!"
+	echo "releaser.sh -o <old_version> -v <new_version> -b <branch> -p <project> [ --rc ]"
+	exit 1;
 fi
 
 commit_changes () {

-- 
To view, visit https://gerrit.asterisk.org/5426
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I820bed6fdc04839458610a546a8d3b47555d35ec
Gerrit-PatchSet: 2
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list