[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: [gentoo-dev] Re: [PATCH multilib.eclass] Distinguish between unset and empty variables when rest
From:       Mike Frysinger <vapier () gentoo ! org>
Date:       2013-04-22 1:18:56
Message-ID: 201304212118.58385.vapier () gentoo ! org
[Download RAW message or body]


On Saturday 20 April 2013 11:42:42 Michał Górny wrote:
> On Sat, 20 Apr 2013 02:10:20 -0400 Mike Frysinger wrote:
> > On Saturday 20 April 2013 01:12:20 Michał Górny wrote:
> > >  		for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
> > >  		
> > >  			vv="__abi_saved_${v}"
> > > 
> > > -			export ${v}="${!vv}"
> > > +			unset ${v}
> > > +			[[ ${!vv+1} ]] && export ${v}="${!vv}"
> > > 
> > >  			unset ${vv}
> > 
> > merge the two unset commands.  no need to run it twice.
> 
> How would I do this? If I do both before the 'export', I lose
> the original value. If I do both after the 'export', I lose the value
> I just exported.

touche.  i've committed the patch below.
-mike

--- multilib.eclass	21 Jan 2013 19:22:25 -0000	1.102
+++ multilib.eclass	22 Apr 2013 01:17:23 -0000
@@ -397,7 +397,7 @@ multilib_toolchain_setup() {
 	if [[ ${__DEFAULT_ABI_SAVED} == "true" ]] ; then
 		for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
 			vv="__abi_saved_${v}"
-			export ${v}="${!vv}"
+			[[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v}
 			unset ${vv}
 		done
 		unset __DEFAULT_ABI_SAVED
@@ -408,7 +408,8 @@ multilib_toolchain_setup() {
 	if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then
 		# Back that multilib-ass up so we can restore it later
 		for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
-			export __abi_saved_${v}="${!v}"
+			vv="__abi_saved_${v}"
+			[[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv}
 		done
 		export __DEFAULT_ABI_SAVED="true"
 

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic