public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Lars Wendler" <polynomial-c@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/apache:master commit in: /
Date: Fri, 12 Feb 2021 14:55:45 +0000 (UTC)	[thread overview]
Message-ID: <1613141577.a1e9b3cf52660f09451ae056b98400d13fee2ae5.polynomial-c@gentoo> (raw)

commit:     a1e9b3cf52660f09451ae056b98400d13fee2ae5
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 12 14:52:57 2021 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Fri Feb 12 14:52:57 2021 +0000
URL:        https://gitweb.gentoo.org/proj/apache.git/commit/?id=a1e9b3cf

rolltarball.sh: Use bash features as we already have bash in shebang

Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 rolltarball.sh | 106 ++++++++++++++++++++-------------------------------------
 1 file changed, 36 insertions(+), 70 deletions(-)

diff --git a/rolltarball.sh b/rolltarball.sh
index 456d3d5..8852ca2 100755
--- a/rolltarball.sh
+++ b/rolltarball.sh
@@ -22,14 +22,13 @@
 
 # Please increase version number before each commit which includes changes to
 # this script.
-MYVERSION='2.1'
+MYVERSION='2.2'
 
 # ********** Begin functions **********
 
 usage() {
 	
-	if [ -n "$1" ]
-	then
+	if [[ -n "$1" ]] ; then
 		eerror $1
 	else
 		cat <<-USAGE_HEADER
@@ -91,8 +90,7 @@ eerror() {
 
 
 die() {
-	if [ "$#" -gt 0 ]
-	then
+	if [[ "$#" -gt 0 ]] ; then
 		eerror ${*}
 	fi
 	exit 1
@@ -100,16 +98,14 @@ die() {
 
 
 einfo() {
-	if [ "${VERBOSE}" -ge "1" ]
-	then
+	if [[ "${VERBOSE}" -ge "1" ]] ; then
 		echo -e " ${GOOD}*${NORMAL} ${*}"
 	fi
 }
 
 
 ebegin() {
-	if [ "${VERBOSE}" -ge "1" ]
-	then
+	if [[ "${VERBOSE}" -ge "1" ]] ; then
 		echo -e " ${GOOD}*${NORMAL} ${*}..."
 	fi
 }
@@ -117,22 +113,18 @@ ebegin() {
 
 eend() {
 
-	if [ "$#" -eq 0 ] || ([ -n "$1" ] && [ "$1" -eq 0 ])
-	then
-		if [ "${VERBOSE}" -ge "1" ]
-		then
+	if [[ "$#" -eq 0 ]] || { [[ -n "$1" ]] && [[ "$1" -eq 0 ]] ; } ; then
+		if [[ "${VERBOSE}" -ge "1" ]] ;	then
 			echo -e "${ENDCOL}  ${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}"
 		fi
 	else
 		retval=$1
 
-		if [ "$#" -ge 2 ]
-		then
+		if [[ "$#" -ge 2 ]] ; then
 			shift
 			eerror "${*}"
 		fi
-		if [ "${VERBOSE}" -ge "1" ]
-		then
+		if [[ "${VERBOSE}" -ge "1" ]] ;	then
 			echo -e "${ENDCOL}  ${BRACKET}[ ${BAD}!!${BRACKET} ]${NORMAL}"
 		fi	
 		return ${retval}
@@ -142,16 +134,14 @@ eend() {
 
 
 ewarn() {
-	if [ "${VERBOSE}" -ge "2" ]
-	then
+	if [[ "${VERBOSE}" -ge "2" ]] ;	then
 		echo -e " ${WARN}*${NORMAL} ${*}"
 	fi
 }
 
 
 edebug() {
-	if [ "${VERBOSE}" -ge "4" ]
-	then
+	if [[ "${VERBOSE}" -ge "4" ]] ;	then
 		echo -e " ${HILITE}*${NORMAL} ${*}"
 	fi
 }
@@ -202,22 +192,19 @@ UPLOAD_MIRROR=0
 VERBOSE=1
 
 # load configuration
-if [ -e ~/.apache-rolltarball ]
-then
+if [[ -e ~/.apache-rolltarball ]] ; then
 	. ~/.apache-rolltarball
 	edebug "Loaded configuration from ~/.apache-rolltarball"
 fi
 
-if [ "${COLOR}" -eq "0" ]
-then
+if [[ "${COLOR}" -eq "0" ]] ; then
 	nocolor;
 else
 	color;
 fi
 
 # Process command line
-until [ -z "$1" ]
-do
+until [[ -z "$1" ]] ; do
 	case "$1" in
 		--*)
 			# long options
@@ -233,7 +220,7 @@ do
 				no-copy)		COPYTO=;;
 				datestamp)		DATESTAMP=${VALUE};;
 				devspace)		UPLOAD_DEV=1;;
-				no-devspace)	UPLOAD_DEV=0;;
+				no-devspace)		UPLOAD_DEV=0;;
 				digest)			DIGEST=1;;
 				no-digest)		DIGEST=0;;
 				ebuild)			MOD_EBUILD=1;;
@@ -255,8 +242,7 @@ do
 			# short options
 			OPTLIST=${1/-/}
 			shift
-			while [ -n "${OPTLIST}" ]
-			do
+			while [[ -n "${OPTLIST}" ]] ; do
 				OPT=${OPTLIST:0:1}
 				OPTLIST=${OPTLIST#?}
 				case "${OPT}" in
@@ -287,8 +273,7 @@ do
 			done
 		;;
 		*)
-			if [ -n "${EBUILD}" ]
-			then
+			if [[ -n "${EBUILD}" ]] ; then
 				usage "Only one ebuild can be specified"
 			else
 				EBUILD=$1
@@ -298,33 +283,27 @@ do
 	esac
 done
 
-if [ -z "${EBUILD}" ]
-then
+if [[ -z "${EBUILD}" ]] ; then
 	usage "You must specify an ebuild"
 fi
 
-if [ "${EBUILD##*.}" != "ebuild" ]
-then
+if [[ "${EBUILD##*.}" != "ebuild" ]] ; then
 	usage "You must specify an ebuild"
 fi
 
-if [ ! -f ${EBUILD} ]
-then
+if [[ ! -f ${EBUILD} ]] ; then
 	die "Ebuild ${EBUILD} does not exist or is not a file"
 fi
 
-if [ "${VERBOSE}" -lt "0" ]
-then
+if [[ "${VERBOSE}" -lt "0" ]] ; then
 	VERBOSE=0
 fi
 
-if [ "${VERBOSE}" -gt "4" ]
-then
+if [[ "${VERBOSE}" -gt "4" ]] ; then
 	VERBOSE=4
 fi
 
-if [ "${VERBOSE}" -ge "3" ]
-then
+if [[ "${VERBOSE}" -ge "3" ]] ; then
 	edebug "Program output enabled"
 	exec 9>&1
 else
@@ -332,13 +311,11 @@ else
 	exec 9>/dev/null
 fi
 
-if [ "${ASK}" -eq "1" ]
-then
+if [[ "${ASK}" -eq "1" ]] ; then
 	PRETEND=1
 fi
 
-if [ -z "${G_USER}" ]
-then
+if [[ -z "${G_USER}" ]] ; then
 	G_USER="$(git log --pretty=fuller -1 | sed -n '/^Commit:/s&.*<\([[:alnum:]\._-]\+\)@.*>&\1&p')"
 	einfo "Detected Gentoo Developer: ${G_USER}"
 fi
@@ -363,8 +340,7 @@ git pull >&9
 eend $? "git update failed!" || die
 
 new_mtime=$(stat --format=%Y $0)
-if [ "${my_mtime}" -ne "${new_mtime}" ]
-then
+if [[ "${my_mtime}" -ne "${new_mtime}" ]] ; then
 	einfo "A new version of $0 is available"
 	einfo "Please restart $0"
 	die
@@ -406,8 +382,7 @@ edebug "  TB_DIR: ${TB_DIR}"
 
 # simply returns true or false based on whether we are in pretend mod or not
 pretend() {
-	if [ "${PRETEND}" -eq 1 ]
-	then
+	if [[ "${PRETEND}" -eq 1 ]] ; then
 		true
 		return $?
 	else
@@ -440,10 +415,8 @@ build_tarball() {
 		rm -rf ${TB_DIR} || ewarn "Couldn't clean up, manually remove ${TB_DIR}/"
 	}
 
-	if [ -n "${COPYTO}" ]
-	then
-		if [ -d ${COPYTO} -a -w ${COPYTO} ]
-		then
+	if [[ -n "${COPYTO}" ]] ; then
+		if [[ -d ${COPYTO} ]] && [[ -w ${COPYTO} ]] ; then
 			pretend && einfo "  Copy ${TB} to ${COPYTO}"
 			pretend || {
 				ebegin "Copying ${TB} to ${COPYTO}"
@@ -457,8 +430,7 @@ build_tarball() {
 		edebug "Copy not enabled"
 	fi
 
-	if [ "${UPLOAD_DEV}" -eq 1 ]
-	then
+	if [[ "${UPLOAD_DEV}" -eq 1 ]] ; then
 		pretend && einfo "  Upload ${TB} to"
 		pretend && einfo "      http://dev.gentoo.org/~${G_USER}/dist/apache/"
 		pretend || {
@@ -477,8 +449,7 @@ build_tarball() {
 		edebug "Upload to devspace not enabled"
 	fi
 
-	if [ "${UPLOAD_MIRROR}" -eq 1 ]
-	then
+	if [[ "${UPLOAD_MIRROR}" -eq 1 ]] ; then
 		pretend && einfo "  Upload ${TB} to mirror://gentoo/"
 		pretend || {
 			ebegin "Uploading ${TB} to mirror://gentoo/"
@@ -494,10 +465,8 @@ build_tarball() {
 		edebug "Upload to mirrors not enabled"
 	fi
 
-	if [ "${MOD_EBUILD}" -eq 1 ]
-	then
-		if [ -r ${EBUILD} ]
-		then
+	if [[ "${MOD_EBUILD}" -eq 1 ]] ; then
+		if [[ -r ${EBUILD} ]] ;	then
 			pretend && einfo "  Update GENTOO_PATCHSTAMP, GENTOO_DEVELOPER and GENTOO_PATCHNAME"
 			pretend || {
 				ebegin "Updating GENTOO_PATCHSTAMP, GENTOO_DEVELOPER and GENTOO_PATCHNAME"
@@ -517,8 +486,7 @@ build_tarball() {
 		edebug "Modify ebuild not enabled"
 	fi
 	
-	if [ "${DIGEST}" -eq 1 ]
-	then
+	if [[ "${DIGEST}" -eq 1 ]] ; then
 		pretend && einfo "  Regenerate digests"
 		pretend || {
 			ebegin "Regenerating digests"
@@ -530,13 +498,11 @@ build_tarball() {
 	fi
 	
 	pretend && einfo "No actions actually taken"
-	if [ "${ASK}" -eq 1 ]
-	then
+	if [[ "${ASK}" -eq 1 ]] ; then
 		einfo "Would you like to perform the above actions?"
 		echo -n "Type 'Yes' or 'No'> "
 		read ask_in
-		if [ "${ask_in}" == "Yes" -o "${ask_in}" == "yes" ]
-		then
+		if [[ "${ask_in}" == [Yy]es ]] ; then
 			ASK=0
 			PRETEND=0
 			build_tarball


             reply	other threads:[~2021-02-12 14:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 14:55 Lars Wendler [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-09-03  8:10 [gentoo-commits] proj/apache:master commit in: / Hans de Graaff
2021-02-12 14:38 Lars Wendler
2021-02-12 14:28 Lars Wendler
2020-12-01 12:26 Lars Wendler
2020-12-01 12:19 Lars Wendler
2020-12-01 12:19 Lars Wendler
2014-04-20 20:39 Lars Wendler
2014-04-20 20:12 Lars Wendler
2013-11-09 15:32 Lars Wendler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1613141577.a1e9b3cf52660f09451ae056b98400d13fee2ae5.polynomial-c@gentoo \
    --to=polynomial-c@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox