Gentoo Logo
Gentoo Spaceship

Installation:
Gentoo Handbook
Installation Docs

Documentation:
Home
Listing
About Gentoo
Philosophy
Social Contract

Resources:
Bug Tracker
Developer List
Discussion Forums
Gentoo BitTorrents
Gentoo Linux Enhancement Proposals
IRC Channels
Mailing Lists
Mirrors
Name and Logo Guidelines
Online Package Database
Security Announcements
Staffing Needs
Supporting Vendors
View our CVS

Graphics:
Logos and themes
Icons
ScreenShots

Miscellaneous Resources:
Gentoo Linux Store
Gentoo-hosted projects
IBM dW/Intel article archive




List Archive: gentoo-devhelp
Navigation:
Lists: gentoo-devhelp: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-devhelp@g.o
From: Mike Frysinger <vapier@g.o>
Subject: Re: Re: Re: LINGUAS vs LANGUAGES
Date: Thu, 13 Aug 2009 15:28:50 -0400
On Saturday 01 August 2009 11:22:41 Steven J Long wrote:
> Mike Frysinger wrote:
> > On Tuesday 21 July 2009 06:13:25 Steven J Long wrote:
> >> Nikos Chantziaras wrote:
> >> > Thanks.  I ended up doing it this way, though with only one loop in
> >> > src_install(), which seems to be a bit more efficient and shorter:
> >> >
> >> >
> >> > LANGUAGES="de"
> >> > for i in ${LANGUAGES}; do
> >> > IUSE="${IUSE} linguas_${i}"
> >> > done
> >>
> >> Just on a side-note (not saying it's how you want to do this one), this
> >> is something that BASH arrays are nice for (saving another loop):
> >> $ foo=(bar baz quux)
> >> $ echo "prefixed: '${foo[*]/#/pfx_}'"
> >> prefixed: 'pfx_bar pfx_baz pfx_quux'
> >
> > printf would probably be better as it is typically a shell builtin and it
> > doesnt require use of arrays/uncommon syntax.
> > media-gfx/exiv2/exiv2-0.18.ebuild:
> > IUSE_LINGUAS="de es fi fr pl ru sk"
> > IUSE="${IUSE} $(printf 'linguas_%s ' ${IUSE_LINGUAS})"
>
> Doh, forgot about printf. (We have alias print="printf '%s\n'" in our lib
> code which comes in handy too.) Nice one.
>
> The only issue with the above is that it requires a subshell; forking isn't
> cheap (especially on Interix/cygwin/doze) and in general it's considered a
> bit lame (at least amongst the ##bash old-timers that I bump heads with) to
> need forking in BASH, though ofc not in SH, which is why it might not be
> the best here, since the metadata generation phase is a restricted subset
> of SH, leave alone BASH, at least aiui.

forks are cheap on any sane *nix box, and subshells/builtins are better than 
external programs.  i'm pretty sure the overhead here tends to be less than 
the overhead of running for loops, especially as the LINGUAS gets bigger.
-mike
Attachment:
signature.asc (This is a digitally signed message part.)
Replies:
Re: Re: Re: LINGUAS vs LANGUAGES
-- Steven J Long
References:
Re: LINGUAS vs LANGUAGES
-- Nikos Chantziaras
Re: Re: LINGUAS vs LANGUAGES
-- Mike Frysinger
Re: Re: LINGUAS vs LANGUAGES
-- Steven J Long
Navigation:
Lists: gentoo-devhelp: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: Re: LINGUAS vs LANGUAGES
Next by thread:
Re: Re: Re: LINGUAS vs LANGUAGES
Previous by date:
Re: autotools and as-needed
Next by date:
Re: autotools and as-needed


Updated Oct 31, 2009

Donate to support our development efforts.

Gentoo Centric Hosting: vr.org

VR Hosted

Tek Alchemy

Tek Alchemy

SevenL.net

SevenL.net

php|architect

php|architect

Copyright 2001-2007 Gentoo Foundation, Inc. Questions, Comments? Email www@gentoo.org.