Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Cc: James Le Cuirot <chewi@g.o>
Subject: [gentoo-dev] [PATCH 1/2] waf-utils.eclass: Simplify output of configure command and arguments
Date: Wed, 09 Jan 2019 22:08:56
Message-Id: 20190109220817.12006-1-chewi@gentoo.org
1 We can just assign these to an array and echo before executing. Using
2 @Q makes Bash quote the output. This only works in Bash 4.4 and later
3 but on earlier versions, it simply doesn't quote.
4
5 Signed-off-by: James Le Cuirot <chewi@g.o>
6 ---
7 eclass/waf-utils.eclass | 20 +++++++++++++-------
8 1 file changed, 13 insertions(+), 7 deletions(-)
9
10 diff --git a/eclass/waf-utils.eclass b/eclass/waf-utils.eclass
11 index 878068fc9f4f..8387829648a3 100644
12 --- a/eclass/waf-utils.eclass
13 +++ b/eclass/waf-utils.eclass
14 @@ -1,4 +1,4 @@
15 -# Copyright 1999-2015 Gentoo Foundation
16 +# Copyright 1999-2019 Gentoo Authors
17 # Distributed under the terms of the GNU General Public License v2
18
19 # @ECLASS: waf-utils.eclass
20 @@ -84,13 +84,19 @@ waf-utils_src_configure() {
21 [[ -z ${NO_WAF_LIBDIR} ]] && libdir=(--libdir="${EPREFIX}/usr/$(get_libdir)")
22
23 tc-export AR CC CPP CXX RANLIB
24 - echo "CCFLAGS=\"${CFLAGS}\" LINKFLAGS=\"${CFLAGS} ${LDFLAGS}\" \"${WAF_BINARY}\" --prefix=${EPREFIX}/usr ${libdir[@]} $@ configure"
25
26 - CCFLAGS="${CFLAGS}" LINKFLAGS="${CFLAGS} ${LDFLAGS}" "${WAF_BINARY}" \
27 - "--prefix=${EPREFIX}/usr" \
28 - "${libdir[@]}" \
29 - "${@}" \
30 - configure || die "configure failed"
31 + local CMD=(
32 + CCFLAGS="${CFLAGS}"
33 + LINKFLAGS="${CFLAGS} ${LDFLAGS}"
34 + "${WAF_BINARY}"
35 + "--prefix=${EPREFIX}/usr"
36 + "${libdir[@]}"
37 + "${@}"
38 + configure
39 + )
40 +
41 + echo "${CMD[@]@Q}"
42 + env "${CMD[@]}" || die "configure failed"
43 }
44
45 # @FUNCTION: waf-utils_src_compile
46 --
47 2.19.2

Replies