Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-dev@l.g.o, hasufell@g.o, amd64@g.o, toolchain@g.o
Subject: Re: [gentoo-dev] Re: [PATCH multilib.eclass] Distinguish between unset and empty variables when restoring.
Date: Mon, 22 Apr 2013 01:18:57
Message-Id: 201304212118.58385.vapier@gentoo.org
In Reply to: Re: [gentoo-dev] Re: [PATCH multilib.eclass] Distinguish between unset and empty variables when restoring. by "Michał Górny"
1 On Saturday 20 April 2013 11:42:42 Michał Górny wrote:
2 > On Sat, 20 Apr 2013 02:10:20 -0400 Mike Frysinger wrote:
3 > > On Saturday 20 April 2013 01:12:20 Michał Górny wrote:
4 > > > for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
5 > > >
6 > > > vv="__abi_saved_${v}"
7 > > >
8 > > > - export ${v}="${!vv}"
9 > > > + unset ${v}
10 > > > + [[ ${!vv+1} ]] && export ${v}="${!vv}"
11 > > >
12 > > > unset ${vv}
13 > >
14 > > merge the two unset commands. no need to run it twice.
15 >
16 > How would I do this? If I do both before the 'export', I lose
17 > the original value. If I do both after the 'export', I lose the value
18 > I just exported.
19
20 touche. i've committed the patch below.
21 -mike
22
23 --- multilib.eclass 21 Jan 2013 19:22:25 -0000 1.102
24 +++ multilib.eclass 22 Apr 2013 01:17:23 -0000
25 @@ -397,7 +397,7 @@ multilib_toolchain_setup() {
26 if [[ ${__DEFAULT_ABI_SAVED} == "true" ]] ; then
27 for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
28 vv="__abi_saved_${v}"
29 - export ${v}="${!vv}"
30 + [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v}
31 unset ${vv}
32 done
33 unset __DEFAULT_ABI_SAVED
34 @@ -408,7 +408,8 @@ multilib_toolchain_setup() {
35 if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then
36 # Back that multilib-ass up so we can restore it later
37 for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
38 - export __abi_saved_${v}="${!v}"
39 + vv="__abi_saved_${v}"
40 + [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv}
41 done
42 export __DEFAULT_ABI_SAVED="true"

Attachments

File name MIME type
signature.asc application/pgp-signature