public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Daniel Drake <dsd@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] More general interface to use flags
Date: Fri, 02 Nov 2007 14:18:38 +0000	[thread overview]
Message-ID: <472B31BE.8080504@gentoo.org> (raw)
In-Reply-To: <472B2969.1070701@gentoo.org>

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



       reply	other threads:[~2007-11-02 14:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <472B2969.1070701@gentoo.org>
2007-11-02 14:18 ` Daniel Drake [this message]
2007-11-02 14:52   ` [gentoo-dev] More general interface to use flags Marijn Schouten (hkBst)
2007-11-02 14:53   ` Marijn Schouten (hkBst)
2007-11-02 13:44 Marijn Schouten (hkBst)
2007-11-02 14:04 ` Roy Marples
2007-11-02 14:27   ` Marijn Schouten (hkBst)
2007-11-02 14:52     ` Roy Marples
2007-11-02 14:59   ` Mike Frysinger
2007-11-02 15:30     ` Roy Marples
2007-11-02 15:38       ` Mike Frysinger
2007-11-02 15:48         ` Roy Marples
2007-11-02 15:58           ` Mike Frysinger
2007-11-02 16:10             ` Roy Marples
2007-11-02 16:30               ` Bo Ørsted Andresen
2007-11-02 16:52                 ` Roy Marples
2007-11-02 17:17                   ` Bo Ørsted Andresen
2007-11-02 17:35                     ` Roy Marples

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=472B31BE.8080504@gentoo.org \
    --to=dsd@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox