Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 13/15] scons-utils.eclass: _scons_clean_makeopts, clean up and simplify
Date: Fri, 01 Jan 2016 16:49:02
Message-Id: 1451666481-22145-14-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 00/15] scons-utils.eclass: EAPI 6, better docs and cleanup by "Michał Górny"
1 ---
2 eclass/scons-utils.eclass | 25 ++++++++++++-------------
3 1 file changed, 12 insertions(+), 13 deletions(-)
4
5 diff --git a/eclass/scons-utils.eclass b/eclass/scons-utils.eclass
6 index 82e45e3..3185282 100644
7 --- a/eclass/scons-utils.eclass
8 +++ b/eclass/scons-utils.eclass
9 @@ -158,7 +158,7 @@ escons() {
10 # gets an argument. Output the resulting flag list (suitable
11 # for an assignment to SCONSOPTS).
12 _scons_clean_makeopts() {
13 - local new_makeopts
14 + local new_makeopts=()
15
16 debug-print-function ${FUNCNAME} "${@}"
17
18 @@ -183,16 +183,16 @@ _scons_clean_makeopts() {
19 case ${1} in
20 # clean, simple to check -- we like that
21 --jobs=*|--keep-going)
22 - new_makeopts=${new_makeopts+${new_makeopts} }${1}
23 + new_makeopts+=( ${1} )
24 ;;
25 # need to take a look at the next arg and guess
26 --jobs)
27 if [[ ${#} -gt 1 && ${2} =~ ^[0-9]+$ ]]; then
28 - new_makeopts="${new_makeopts+${new_makeopts} }${1} ${2}"
29 + new_makeopts+=( ${1} ${2} )
30 shift
31 else
32 # no value means no limit, let's pass a random int
33 - new_makeopts=${new_makeopts+${new_makeopts} }${1}=5
34 + new_makeopts+=( ${1}=5 )
35 fi
36 ;;
37 # strip other long options
38 @@ -207,20 +207,20 @@ _scons_clean_makeopts() {
39 while [[ -n ${str} ]]; do
40 case ${str} in
41 k*)
42 - new_optstr=${new_optstr}k
43 + new_optstr+=k
44 ;;
45 # -j needs to come last
46 j)
47 if [[ ${#} -gt 1 && ${2} =~ ^[0-9]+$ ]]; then
48 - new_optstr="${new_optstr}j ${2}"
49 + new_optstr+="j ${2}"
50 shift
51 else
52 - new_optstr="${new_optstr}j 5"
53 + new_optstr+="j 5"
54 fi
55 ;;
56 # otherwise, everything after -j is treated as an arg
57 j*)
58 - new_optstr=${new_optstr}${str}
59 + new_optstr+=${str}
60 break
61 ;;
62 esac
63 @@ -228,17 +228,16 @@ _scons_clean_makeopts() {
64 done
65
66 if [[ -n ${new_optstr} ]]; then
67 - new_makeopts=${new_makeopts+${new_makeopts} }-${new_optstr}
68 + new_makeopts+=( -${new_optstr} )
69 fi
70 ;;
71 esac
72 shift
73 done
74
75 - set -- ${new_makeopts}
76 - _SCONS_CACHE_SCONSOPTS=${*}
77 - debug-print "New SCONSOPTS: [${*}]"
78 - SCONSOPTS=${*}
79 + SCONSOPTS=${new_makeopts[*]}
80 + _SCONS_CACHE_SCONSOPTS=${SCONSOPTS}
81 + debug-print "New SCONSOPTS: [${SCONSOPTS}]"
82 }
83
84 # @FUNCTION: use_scons
85 --
86 2.6.4