Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] new `usex` helper
Date: Wed, 14 Sep 2011 03:44:36
Message-Id: 201109132343.49314.vapier@gentoo.org
In Reply to: Re: [gentoo-dev] new `usex` helper by Brian Harring
1 On Tuesday, September 13, 2011 23:04:06 Brian Harring wrote:
2 > On Tue, Sep 13, 2011 at 10:45:27PM -0400, Mike Frysinger wrote:
3 > > On Tuesday, September 13, 2011 19:08:09 Brian Harring wrote:
4 > > > While a bit longer, we likely can gut most of the use_* logic to
5 > > > use that, and it makes it easier to deal w/ the situations where a
6 > > > configure's options always assume --enable-blah thus don't export the
7 > > > option, but *do* export a --disable-blah.
8 > >
9 > > yeah, i thought about replacing use_{with,enable} with usex, but we'd
10 > > have to extend usex() a little bit more
11 >
12 > Only extension I can think of is adding a prefix/postfix... which
13 > frankly seems a bit too much. Anything else you were looking for?
14
15 i dont think the postfix is needed for use_{enable,with}:
16 usex() { use $1 && echo ${2:-yes} || echo ${3:-no} ; }
17 use_enable() { usex $1 --enable-${2:-$1}${3:+=}$3 --disable-${2:-$1} ; }
18 use_with() { usex $1 --with-${2:-$1}${3:+=}$3 --without-${2:-$1} ; }
19
20 although adding it to usex is cheap, simplifies the other helpers a little,
21 and might get used in more creative ways i cant imagine right now:
22 usex() { use $1 && echo ${2:-yes}$4 || echo ${3:-no}$5 ; }
23 use_enable() { usex $1 --{en,dis}able-${2:-$1} "${3:+=}$3" ; }
24 use_with() { usex $1 --with{,out}-${2:-$1} "${3:+=}$3"; }
25
26 so unless there's any other feedback, i'll open an EAPI bug on the topic and
27 merge it to eutils.eclass
28 -mike

Attachments

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

Replies

Subject Author
Re: [gentoo-dev] new `usex` helper Brian Harring <ferringb@×××××.com>