public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 13/15] scons-utils.eclass: _scons_clean_makeopts, clean up and simplify
Date: Fri,  1 Jan 2016 17:41:19 +0100	[thread overview]
Message-ID: <1451666481-22145-14-git-send-email-mgorny@gentoo.org> (raw)
In-Reply-To: <1451666481-22145-1-git-send-email-mgorny@gentoo.org>

---
 eclass/scons-utils.eclass | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/eclass/scons-utils.eclass b/eclass/scons-utils.eclass
index 82e45e3..3185282 100644
--- a/eclass/scons-utils.eclass
+++ b/eclass/scons-utils.eclass
@@ -158,7 +158,7 @@ escons() {
 # gets an argument. Output the resulting flag list (suitable
 # for an assignment to SCONSOPTS).
 _scons_clean_makeopts() {
-	local new_makeopts
+	local new_makeopts=()
 
 	debug-print-function ${FUNCNAME} "${@}"
 
@@ -183,16 +183,16 @@ _scons_clean_makeopts() {
 		case ${1} in
 			# clean, simple to check -- we like that
 			--jobs=*|--keep-going)
-				new_makeopts=${new_makeopts+${new_makeopts} }${1}
+				new_makeopts+=( ${1} )
 				;;
 			# need to take a look at the next arg and guess
 			--jobs)
 				if [[ ${#} -gt 1 && ${2} =~ ^[0-9]+$ ]]; then
-					new_makeopts="${new_makeopts+${new_makeopts} }${1} ${2}"
+					new_makeopts+=( ${1} ${2} )
 					shift
 				else
 					# no value means no limit, let's pass a random int
-					new_makeopts=${new_makeopts+${new_makeopts} }${1}=5
+					new_makeopts+=( ${1}=5 )
 				fi
 				;;
 			# strip other long options
@@ -207,20 +207,20 @@ _scons_clean_makeopts() {
 				while [[ -n ${str} ]]; do
 					case ${str} in
 						k*)
-							new_optstr=${new_optstr}k
+							new_optstr+=k
 							;;
 						# -j needs to come last
 						j)
 							if [[ ${#} -gt 1 && ${2} =~ ^[0-9]+$ ]]; then
-								new_optstr="${new_optstr}j ${2}"
+								new_optstr+="j ${2}"
 								shift
 							else
-								new_optstr="${new_optstr}j 5"
+								new_optstr+="j 5"
 							fi
 							;;
 						# otherwise, everything after -j is treated as an arg
 						j*)
-							new_optstr=${new_optstr}${str}
+							new_optstr+=${str}
 							break
 							;;
 					esac
@@ -228,17 +228,16 @@ _scons_clean_makeopts() {
 				done
 
 				if [[ -n ${new_optstr} ]]; then
-					new_makeopts=${new_makeopts+${new_makeopts} }-${new_optstr}
+					new_makeopts+=( -${new_optstr} )
 				fi
 				;;
 		esac
 		shift
 	done
 
-	set -- ${new_makeopts}
-	_SCONS_CACHE_SCONSOPTS=${*}
-	debug-print "New SCONSOPTS: [${*}]"
-	SCONSOPTS=${*}
+	SCONSOPTS=${new_makeopts[*]}
+	_SCONS_CACHE_SCONSOPTS=${SCONSOPTS}
+	debug-print "New SCONSOPTS: [${SCONSOPTS}]"
 }
 
 # @FUNCTION: use_scons
-- 
2.6.4



  parent reply	other threads:[~2016-01-01 16:49 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-01 16:41 [gentoo-dev] [PATCH 00/15] scons-utils.eclass: EAPI 6, better docs and cleanup Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 01/15] scons-utils.eclass: Modernize the example not to rely on myescons Michał Górny
2016-01-01 16:57   ` [gentoo-dev] " Michael Palimaka
2016-01-01 17:15     ` Michał Górny
2016-01-01 17:42       ` Michael Palimaka
2016-01-02 13:38         ` Michael Orlitzky
2016-01-01 16:41 ` [gentoo-dev] [PATCH 02/15] scons-utils.eclass: Modernize the example to use usex Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 03/15] scons-utils.eclass: Describe common issues with scons Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 04/15] scons-utils.eclass: escons doc, 'die' does not respect nonfatal Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 05/15] scons-utils.eclass: escons, invert EAPI check to cover future EAPIs Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 06/15] scons-utils.eclass: escons, respect nonfatal in EAPI 6 Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 07/15] scons-utils.eclass: Deprecate myesconsargs, and kill it " Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 08/15] scons-utils.eclass: Deprecate use_scons, ban " Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 09/15] scons-utils.eclass: tests, be more verbose on tests being performed Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 10/15] scons-utils.eclass: scons_clean_makeopts, mark internal Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 11/15] scons-utils.eclass: _scons_clean_makeopts, fix result caching Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 12/15] scons-utils.eclass: _scons_clean_makeopts, stop exporting cache vars Michał Górny
2016-01-01 16:41 ` Michał Górny [this message]
2016-01-01 16:41 ` [gentoo-dev] [PATCH 14/15] scons-utils.eclass: Use nproc when --jobs is used without an argument Michał Górny
2016-01-01 16:41 ` [gentoo-dev] [PATCH 15/15] scons-utils.eclass: Enable EAPI 6 Michał Górny
2016-01-08  5:15 ` [gentoo-dev] [PATCH 00/15] scons-utils.eclass: EAPI 6, better docs and cleanup Michał Górny

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=1451666481-22145-14-git-send-email-mgorny@gentoo.org \
    --to=mgorny@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