From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1KhVbP-00058h-06 for garchives@archives.gentoo.org; Sun, 21 Sep 2008 20:32:19 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1A7B2E04C2; Sun, 21 Sep 2008 20:32:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id BB1FFE04C2 for ; Sun, 21 Sep 2008 20:32:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 892EB67F6B for ; Sun, 21 Sep 2008 20:32:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at gentoo.org X-Spam-Score: -0.787 X-Spam-Level: X-Spam-Status: No, score=-0.787 required=5.5 tests=[AWL=0.744, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1, RCVD_NUMERIC_HELO=2.067, WEIRD_PORT=0.001] 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 A2iGzvSlfzFh for ; Sun, 21 Sep 2008 20:32:10 +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 984B167F98 for ; Sun, 21 Sep 2008 20:32:07 +0000 (UTC) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KhVbB-0000Ik-US for gentoo-dev@gentoo.org; Sun, 21 Sep 2008 20:32:05 +0000 Received: from 82.152.208.249 ([82.152.208.249]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Sep 2008 20:32:05 +0000 Received: from slong by 82.152.208.249 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Sep 2008 20:32:05 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: gentoo-dev@lists.gentoo.org From: Steve Long Subject: [gentoo-dev] Re: Default src_install for EAPI-2 or following EAPI Date: Sun, 21 Sep 2008 21:23:45 +0100 Message-ID: References: <18646.17986.821510.192980@a1ihome1.kph.uni-mainz.de> <8cd1ed20809211030w74725bb1qd60482d5fa7bfce2@mail.gmail.com> <18646.38777.205043.568794@a1ihome1.kph.uni-mainz.de> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@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.152.208.249 User-Agent: KNode/0.10.9 Sender: news X-Archives-Salt: db147482-0f9a-4ee6-a368-449f751c55d9 X-Archives-Hash: 2af2ba22a3dd5eb57779f2eaf64b71cd Ulrich Mueller wrote: >>>>>> On Mon, 22 Sep 2008, Kent Fredric wrote: > >> find /usr/share/doc/ -wholename "* *" >> /usr/share/doc/gpac-0.4.4-r1/ISO 639-2 codes.txt.bz2 > > Yes, and if you look into src_install of the ebuild, it does: > dodoc doc/*.txt > Well at least we've established that it can and does happen. > So a simple "dodoc ${DOCS}" with DOCS="... doc/*.txt ..." would work > even in this case. No need for arrays. > That works for that specific case, yes, but it's still not a general solution, which is what BASH arrays were invented for. For instance, an ebuild author cannot specifically include a file with spaces, and ignore all the other files in the same directory. To show what I mean, given this one-liner in a terminal: args() { (($#)) || return; echo "$# params:"; local i n=1; for i; do echo "$n: $i"; let n++; done; } ..try these (where doc is a subdirectory of your current folder, and mem* matches some files in it): DOCS="doc/mem* foo"; args $DOCS DOCS="doc/mem* 'foo bar baz'"; args $DOCS DOCS=(doc/mem* 'foo bar baz'); args "${DOCS[@]}" Globs work fine for a function call, or indeed for adding to an array. As soon as you try to indirect via a variable, it has to be an array if you want to be safe with filenames, for the general case. The same applies to dynamic commands. See: http://wooledge.org:8000/BashFAQ/040 and: http://wooledge.org:8000/BashFAQ/050 Given that we're using BASH, it seems strange to preclude useful constructs. It's a bit like telling someone to use Python without dicts (or even lists, given how basic arrays are to virtually every programming language.) It's much simpler to write scripts that will work with anything, and be able to rely on them, than have to fix or work round them later.