public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* Re: [gentoo-dev] More general interface to use flags
       [not found]     <472B2969.1070701@gentoo.org>
@ 2007-11-02 14:18 99% ` Daniel Drake
  0 siblings, 0 replies; 1+ results
From: Daniel Drake @ 2007-11-02 14:18 UTC (permalink / raw
  To: gentoo-dev; +Cc: gentoo-portage-dev

Marijn Schouten (hkBst) wrote:
> Hi list,
> 
> the current interface to use flags, useq, usev, use_with, use_enable, as
> defined in /usr/lib/portage/bin/ebuild.sh lacks generality. The common thing
> is testing a use flag and possibly echoing a string, but there is no function
> that implements this common behaviour.
> 
> I propose that we add such a function. Proposed name for the function is "ifuse".

So these modifications are just cleanups to portage internals and would 
not affect the interfaces or behaviour of use/use_with/...?

> I also propose to add the utility function "ifv" which is useful for writing
> concise and clean code.
> 
> These additions would allow you to easily define your own function for
> processing use flags in ebuilds and eclasses. One such example is
> 
> use_mime() {
>     local WORD=$(ifv "$2" "$2" "$1")
> 
>     ifuse "$1" "${WORD};"
> }
> 
> for generating a string of ';'-separated mime-types based on use flags.
> 
> The explanation of this function is:
> 
> #set WORD to argument 2 or if that is empty to argument 1
> #output "${WORD};" if use flag $1 is set (or if it starts with ! and is unset)
> #otherwise don't output anything

I don't quite understand what this function does. What ebuild nastiness 
does it replace, or what does it allow that was not previously possible? 
(can you give an example?)

Thanks,
Daniel
-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
     [not found]     <472B2969.1070701@gentoo.org>
2007-11-02 14:18 99% ` [gentoo-dev] More general interface to use flags Daniel Drake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox