Gentoo Archives: gentoo-dev

From: Davide Pesavento <pesa@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: using array variables in qt4-r2.eclass
Date: Sun, 15 Jul 2012 15:36:50
Message-Id: CADfzvvZ1Cy2BCua1s5973uG5et6PVSQtNSPL81UsWhBx4wvT3Q@mail.gmail.com
In Reply to: Re: [gentoo-dev] RFC: using array variables in qt4-r2.eclass by "Michał Górny"
1 On Sun, Jul 15, 2012 at 3:42 PM, Michał Górny <mgorny@g.o> wrote:
2 > On Sun, 15 Jul 2012 13:00:47 +0200
3 > Davide Pesavento <pesa@g.o> wrote:
4 >
5 >> On Sat, Jul 14, 2012 at 4:00 PM, Michał Górny <mgorny@g.o>
6 >> wrote:
7 >> > On Sat, 14 Jul 2012 12:29:59 +0200
8 >> > Davide Pesavento <pesa@g.o> wrote:
9 >> >
10 >> >> On Fri, Jul 13, 2012 at 3:50 PM, Alexis Ballier
11 >> >> <aballier@g.o> wrote:
12 >> >> > On Fri, 13 Jul 2012 15:26:58 +0200
13 >> >> > Davide Pesavento <pesa@g.o> wrote:
14 >> >> >
15 >> >> >> > [...]
16 >> >> >> >> + # backward compatibility for non-array variables
17 >> >> >> >> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS
18 >> >> >> >> 2>/dev/null
19 >> >> >> >> 2>&1)" != "declare -a"* ]]; then
20 >> >> >> >> + dodoc ${DOCS} || die "dodoc failed"
21 >> >> >> >> + fi
22 >> >> >> >> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS
23 >> >> >> >> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
24 >> >> >> >> + dohtml -r ${HTML_DOCS} || die "dohtml failed"
25 >> >> >> >> + fi
26 >> >> >> >> }
27 >> >> >> >
28 >> >> >> > maybe issue an eqawarn in that case telling people to convert
29 >> >> >> > to arrays; some time later make this an ewarn telling
30 >> >> >> > non-array support will be removed and again later make this a
31 >> >> >> > die :) (if you take that route i would expect you to start
32 >> >> >> > converting packages to use arrays)
33 >> >> >> >
34 >> >> >>
35 >> >> >> We have no intention of deprecating non-array variables in
36 >> >> >> qt4-r2 eclass.
37 >> >> >
38 >> >> > why ? having two codepaths for the same thing, one being
39 >> >> > inferior, sounds like a good reason to deprecate the inferior
40 >> >> > one :)
41 >> >> >
42 >> >> > A.
43 >> >> >
44 >> >>
45 >> >> Maintaining these two codepaths has practically zero cost, while
46 >> >> forcing every ebuild using qt4-r2 to switch to arrays would waste
47 >> >> developers' time which is better spent elsewhere.
48 >> >>
49 >> >> Furthermore, the non-array variant is not necessarily inferior,
50 >> >> because it allows you to use bash globbing, brace expansion, etc...
51 >> >
52 >> > And arrays stopped to allow that overnight?
53 >> >
54 >>
55 >> I mean that the following won't work as you might expect:
56 >>
57 >> DOCS=("*.txt")
58 >
59 > I doubt anyone would expect quoted string to be evaluated as glob.
60 >
61
62 It depends on when the expansion is performed, although in the
63 base.eclass case, DOCS=(*.txt) doesn't work either, because the
64 quoting happens inside the eclass function.
65
66 Anyway, I was just explaining why I argued that "the non-array variant
67 is not necessarily inferior". Using DOCS="*.txt" is actually a
68 supported use case and a valid reason not to deprecate non-array
69 variables.
70
71 Regards,
72 Pesa

Replies

Subject Author
Re: [gentoo-dev] RFC: using array variables in qt4-r2.eclass "Michał Górny" <mgorny@g.o>