From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1MXGSE-00067W-3S for garchives@archives.gentoo.org; Sat, 01 Aug 2009 15:25:02 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A8992E053C; Sat, 1 Aug 2009 15:25:01 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 6BEBFE053C for ; Sat, 1 Aug 2009 15:25:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 2054A6686F for ; Sat, 1 Aug 2009 15:25:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at gentoo.org X-Spam-Score: -0.657 X-Spam-Level: X-Spam-Status: No, score=-0.657 required=5.5 tests=[AWL=0.875, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1, RCVD_NUMERIC_HELO=2.067] Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IWl1QleH0zsR for ; Sat, 1 Aug 2009 15:24:54 +0000 (UTC) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id E250666814 for ; Sat, 1 Aug 2009 15:24:52 +0000 (UTC) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MXGS0-0007De-V8 for gentoo-devhelp@gentoo.org; Sat, 01 Aug 2009 15:24:48 +0000 Received: from 82.153.195.87 ([82.153.195.87]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 01 Aug 2009 15:24:48 +0000 Received: from slong by 82.153.195.87 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 01 Aug 2009 15:24:48 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-devhelp@lists.gentoo.org From: Steven J Long Subject: [gentoo-devhelp] Re: Re: LINGUAS vs LANGUAGES Date: Sat, 01 Aug 2009 16:22:41 +0100 Organization: Friendly-Coders Message-ID: <13017217.uNbVpHm14s@news.friendly-coders.info> References: <4A0D8068.3090304@arcor.de> <23125183.lyQsYuCQA3@news.friendly-coders.info> <200907261651.44164.vapier@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Development-related help X-BeenThere: gentoo-devhelp@gentoo.org X-BeenThere: gentoo-devhelp@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 82.153.195.87 Sender: news X-Archives-Salt: 40966a8f-d57c-4297-8cd6-a2858190d38a X-Archives-Hash: b2b7ad96ad1708f95079e0073e612517 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. An example of BASH saving forking, would be where printf -v comes into play. A more portable, though less flexible command in terms of allowed characters is read from <<< [1]. Though that can be worked round, it's nice not to have to; a shell that is progressing while still retaining excellent portability is useful imo (so long as we don't get our knickers in a twist about using new features, since we can set a required EAPI per-profile in any case.) [1] @freenode: /msg greybot <<< Yes, I'm aware there are two versions of portability being discussed there. I figured our readership can differentiate, and if not you can always lead 'em gently by the hand to Massachusetts.. ;P -- #friendly-coders -- We're friendly but we're not /that/ friendly ;-)