Gentoo Archives: gentoo-dev

From: Alec Warner <antarus@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: Default src_install for EAPI-2 or following EAPI
Date: Mon, 22 Sep 2008 01:35:07
Message-Id: b41005390809211835h39f5a359k571e9693f7db1630@mail.gmail.com
In Reply to: Re: [gentoo-dev] Re: Default src_install for EAPI-2 or following EAPI by Vaeth
1 On Sat, Sep 20, 2008 at 11:18 PM, Vaeth
2 <vaeth@××××××××××××××××××××××××.de> wrote:
3 > Steve Long wrote:
4 >
5 >> Thomas Sachau wrote: [...]
6 >>
7 >> > [[ -n ${DOCS} ]] && dodoc ${DOCS}
8 > [...]
9 >>
10 >> It might be wise to use an array for DOCS there
11 >
12 > Since I have now seen suggestions for using arrays unnecessarily
13 > at least twice (see also
14 > [RFC] Ability to pass arguments to src_configure/src_compile
15 > but I am only speaking about the usage of _arrays_ here),
16 > let me remark that the more clever way to this is
17 >
18 > [ -n "${DOCS}" ] && eval "dodoc ${DOCS}"
19 >
20 > This way, people can simply quote as they like:
21 >
22 > DOCS="'filename with spaces' filename_without_space doc/*"
23 >
24 > or also
25 >
26 > DOCS="just_one_filename_without_special_characters"
27 >
28 > or also - when Push from /usr/bin/functions-eix.sh is used
29 > (which might be implemented simpler without using other functions):
30 >
31 > Push DOCS 'filename with spaces' filename_without_space "${S}"/doc/*
32 >
33 >
34 > Not only has this the advantage that it is POSIX (and thus does not
35 > force ebuilds to use the particular shell "bash" - a policy which perhaps
36 > some day might be changed: It is dangerous to depend on a particular
37 > implementation), the array-less solution is also much simpler to
38 > implement, easy to understand from the source, and clearer in usage.
39 > Case distinctions like
40
41 gentoo-x86 uses bash; the ebuilds, the eclasses, they all rely on it.
42 I'm pretty sure most package managers rely on bash as well, but I have
43 not looked at the code outside of portage to verify.
44
45 I really dislike ideas where the compelling argument is 'in the future
46 we may make a specific decision and that makes that one choice
47 easier.' If switching to POSIX shell was on the road map for Gentoo
48 or Gentoo-x86 or any of the package managers; I would maybe buy your
49 argument. But as far as I am aware it is not; so planning for future
50 decisions that currently are undecided is folly in my mind.
51
52 It is much more pragmatic to use bash now (since we already use it)
53 and utilize its features.
54
55 If you have a compelling argument for switching the entire tree to
56 POSIX then give it; however I'm pretty sure it is a difficult argument
57 to make (Uberlord tried to make it in the past and did not succeed).
58 Otherwise lets just roll with the bash implementation.
59
60 -Alec
61
62
63 >
64 >> isArr() [[ $(declare -p "$1" 2>/dev/null) = 'declare -a'* ]]
65 >> if isArr DOCS; then
66 >> ((${#DOCS[@]})) && dodoc "${DOCS[@]}"
67 >> else [[ $DOCS ]] && dodoc $DOCS
68 >> fi
69 >
70 > are just awful.
71 >
72 >

Replies

Subject Author
[gentoo-dev] Re: Default src_install for EAPI-2 or following EAPI Duncan <1i5t5.duncan@×××.net>