Gentoo Archives: gentoo-dev

From: Steve Long <slong@××××××××××××××××××.uk>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: Re: Re: [gentoo-commits] gentoo-x86 commit in x11-libs/qt: ChangeLog qt-4.3.2.ebuild
Date: Fri, 05 Oct 2007 23:50:06
Message-Id: fe6hrs$hej$1@sea.gmane.org
In Reply to: Re: [gentoo-dev] Re: Re: [gentoo-commits] gentoo-x86 commit in x11-libs/qt: ChangeLog qt-4.3.2.ebuild by Donnie Berkholz
1 Donnie Berkholz wrote:
2 > On 13:34 Fri 05 Oct , Steve Long wrote:
3 >> In actual fact, I'd be more likely to use parameter expansion than set,
4 >> eg: spec=${CHOST#*-*-} # chop first two fields off so spec is fields 3 on
5 >> spec=${spec%%-*} # chop all but first off so left with just field 3
6 >> ..which I believe works in sh[1] as well. The point for me, however, is
7 >> not whether sh can be kludged to do something, it's what the most
8 >> efficient ways to do something in scripts are. Whether you use pe, read
9 >> or an array, avoiding externals leads to quicker scripts.[2]
10 >
11 > That parameter workaround wouldn't work, because CHOST may also contain
12 > just 3 fields, as it does on Gentoo/BSD. Unpack a portage tarball and
13 > look at the make.conf's if you're curious.
14 >
15 Then the second expansion would have no effect.
16
17 > Avoiding externals at the cost of added complexity on something that
18 > only gets called one time certainly qualifies as premature optimization.
19 >
20 True enough. It might be more relevant for eclasses, or maybe only for
21 actual bash scripts.
22
23
24 --
25 gentoo-dev@g.o mailing list

Replies