Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Brian Harring <ferringb@...>
Subject: Re: new `usex` helper
Date: Tue, 13 Sep 2011 16:08:09 -0700
On Tue, Sep 13, 2011 at 06:13:10PM -0400, Mike Frysinger wrote:
> On Tuesday, September 13, 2011 18:01:25 Alec Warner wrote:
> > On Tue, Sep 13, 2011 at 2:56 PM, Mike Frysinger wrote:
> > > this is so i can do:
> > >        export some_var=$(usex some_flag)
> > > and get it set to "yes" or "no"
> > 
> > If the intent is to use it for logic:
> > 
> > export some_var=$(usex some_flag)
> > 
> > if [[ $some_var == yes ]]; then
> >  # buttsex
> > fi
> 
> that is not the intent
> 
> > Then I recommend making true / false the default and then doing
> > 
> > if $some_var; then
> >   # buttsex
> > fi
> 
> the point is to use it to construct vars that get passed to scripts like econf 
> or programs like emake
> 
> 	ac_cv_some_header=$(usex foo) \
> 	econf ...
> 
> 	emake USE_POOP=$(usex poo)

Making it overridable seems wiser-

usex() {
	local flag="$1"
	local tval=${2-yes}
	local fval=${3-no}
	if use $flag; then
		echo "${tval}"
	else
		echo "${fval}"
	fi
}

While a bit longer, we likely can gut most of the use_* logic to 
use that, and it makes it easier to deal w/ the situations where a 
configure's options always assume --enable-blah thus don't export the 
option, but *do* export a --disable-blah.

That way we can shift away from
$(use blah && use_with blah)
to
$(usex blah --with-blah '')

Or that's the intent at least.
~brian	



Replies:
Re: new `usex` helper
-- Mike Frysinger
References:
new `usex` helper
-- Mike Frysinger
Re: new `usex` helper
-- Alec Warner
Re: new `usex` helper
-- Mike Frysinger
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: new `usex` helper
Next by thread:
Re: new `usex` helper
Previous by date:
Re: new `usex` helper
Next by date:
Re: new `usex` helper


Updated Jun 29, 2012

Summary: Archive of the gentoo-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.