Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Cc: Mike Frysinger <vapier@g.o>
Subject: Re: [gentoo-dev] [PATCH] toolchain.eclass: set CHOST for gcc-config calls
Date: Tue, 27 Dec 2016 16:55:54
Message-Id: CAJ0EP42Jhc85DpsHYVYio1YF5BmutQn6OfDhwrP0L-QadJCHkw@mail.gmail.com
In Reply to: Re: [gentoo-dev] [PATCH] toolchain.eclass: set CHOST for gcc-config calls by Daniel Campbell
1 On Tue, Dec 27, 2016 at 3:22 AM, Daniel Campbell <zlg@g.o> wrote:
2 > On 12/26/2016 12:22 PM, Mike Gilbert wrote:
3 >> Bug: https://bugs.gentoo.org/603776
4 >> ---
5 >> eclass/toolchain.eclass | 8 ++++----
6 >> 1 file changed, 4 insertions(+), 4 deletions(-)
7 >>
8 >> diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
9 >> index 55249b00249b..97511ee12440 100644
10 >> --- a/eclass/toolchain.eclass
11 >> +++ b/eclass/toolchain.eclass
12 >> @@ -2119,13 +2119,13 @@
13 >>
14 >> do_gcc_config() {
15 >> if ! should_we_gcc_config ; then
16 >> - env -i ROOT="${ROOT}" gcc-config --use-old --force
17 >> + env -i CHOST="${CHOST}" ROOT="${ROOT}" gcc-config --use-old --force
18 >> return 0
19 >> fi
20 >>
21 >> local current_gcc_config target
22 >>
23 >> - current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
24 >> + current_gcc_config=$(env -i CHOST="${CHOST}" ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
25 >> if [[ -n ${current_gcc_config} ]] ; then
26 >> local current_specs use_specs
27 >> # figure out which specs-specific config is active
28 >> @@ -2159,12 +2159,12 @@ should_we_gcc_config() {
29 >> # if the current config is invalid, we definitely want a new one
30 >> # Note: due to bash quirkiness, the following must not be 1 line
31 >> local curr_config
32 >> - curr_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
33 >> + curr_config=$(env -i CHOST="${CHOST}" ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
34 >>
35 >> # if the previously selected config has the same major.minor (branch) as
36 >> # the version we are installing, then it will probably be uninstalled
37 >> # for being in the same SLOT, make sure we run gcc-config.
38 >> - local curr_config_ver=$(env -i ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}')
39 >> + local curr_config_ver=$(env -i CHOST="${CHOST}" ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}')
40 >>
41 >> local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
42 >>
43 >>
44 >
45 > Seems like an obvious bug and fix; is there any reason passing CHOST
46 > around might be a bad idea? It seems to me that it enforces the behavior
47 > it's meant to have to begin with and makes it more obvious that CHOST is
48 > used.
49
50 I am honestly not sure why the eclass is calling env -i in the first
51 place. It looks like vapier added that; maybe he can explain it?