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 16:16:45
Message-Id: CADfzvvYxSuuR-AWLbPogZP0jc0s-v2pO-0G1HRmLeLgwgG4F+w@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 5:53 PM, Michał Górny <mgorny@g.o> wrote:
2 > On Sun, 15 Jul 2012 17:36:05 +0200
3 > Davide Pesavento <pesa@g.o> wrote:
4 >
5 >> On Sun, Jul 15, 2012 at 3:42 PM, Michał Górny <mgorny@g.o>
6 >> wrote:
7 >> > On Sun, 15 Jul 2012 13:00:47 +0200
8 >> > Davide Pesavento <pesa@g.o> wrote:
9 >> >
10 >> >> On Sat, Jul 14, 2012 at 4:00 PM, Michał Górny <mgorny@g.o>
11 >> >> wrote:
12 >> >> > On Sat, 14 Jul 2012 12:29:59 +0200
13 >> >> > Davide Pesavento <pesa@g.o> wrote:
14 >> >> >
15 >> >> >> On Fri, Jul 13, 2012 at 3:50 PM, Alexis Ballier
16 >> >> >> <aballier@g.o> wrote:
17 >> >> >> > On Fri, 13 Jul 2012 15:26:58 +0200
18 >> >> >> > Davide Pesavento <pesa@g.o> wrote:
19 >> >> >> >
20 >> >> >> >> > [...]
21 >> >> >> >> >> + # backward compatibility for non-array variables
22 >> >> >> >> >> + if [[ -n ${DOCS} ]] && [[ "$(declare -p DOCS
23 >> >> >> >> >> 2>/dev/null
24 >> >> >> >> >> 2>&1)" != "declare -a"* ]]; then
25 >> >> >> >> >> + dodoc ${DOCS} || die "dodoc failed"
26 >> >> >> >> >> + fi
27 >> >> >> >> >> + if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p
28 >> >> >> >> >> HTML_DOCS
29 >> >> >> >> >> 2>/dev/null 2>&1)" != "declare -a"* ]]; then
30 >> >> >> >> >> + dohtml -r ${HTML_DOCS} || die "dohtml
31 >> >> >> >> >> failed"
32 >> >> >> >> >> + fi
33 >> >> >> >> >> }
34 >> >> >> >> >
35 >> >> >> >> > maybe issue an eqawarn in that case telling people to
36 >> >> >> >> > convert to arrays; some time later make this an ewarn
37 >> >> >> >> > telling non-array support will be removed and again later
38 >> >> >> >> > make this a die :) (if you take that route i would expect
39 >> >> >> >> > you to start converting packages to use arrays)
40 >> >> >> >> >
41 >> >> >> >>
42 >> >> >> >> We have no intention of deprecating non-array variables in
43 >> >> >> >> qt4-r2 eclass.
44 >> >> >> >
45 >> >> >> > why ? having two codepaths for the same thing, one being
46 >> >> >> > inferior, sounds like a good reason to deprecate the inferior
47 >> >> >> > one :)
48 >> >> >> >
49 >> >> >> > A.
50 >> >> >> >
51 >> >> >>
52 >> >> >> Maintaining these two codepaths has practically zero cost, while
53 >> >> >> forcing every ebuild using qt4-r2 to switch to arrays would
54 >> >> >> waste developers' time which is better spent elsewhere.
55 >> >> >>
56 >> >> >> Furthermore, the non-array variant is not necessarily inferior,
57 >> >> >> because it allows you to use bash globbing, brace expansion,
58 >> >> >> etc...
59 >> >> >
60 >> >> > And arrays stopped to allow that overnight?
61 >> >> >
62 >> >>
63 >> >> I mean that the following won't work as you might expect:
64 >> >>
65 >> >> DOCS=("*.txt")
66 >> >
67 >> > I doubt anyone would expect quoted string to be evaluated as glob.
68 >> >
69 >>
70 >> It depends on when the expansion is performed, although in the
71 >> base.eclass case, DOCS=(*.txt) doesn't work either, because the
72 >> quoting happens inside the eclass function.
73 >>
74 >> Anyway, I was just explaining why I argued that "the non-array variant
75 >> is not necessarily inferior". Using DOCS="*.txt" is actually a
76 >> supported use case and a valid reason not to deprecate non-array
77 >> variables.
78 >
79 > So, you're saying that you're going to support two different variants
80 > of the variable which work two different ways?
81 >
82
83 Basically yes. As yngwin said, we're introducing support for array
84 variables to be more in line with other eclasses. People do expect
85 DOCS to be an array variable, and I've already been asked a few times
86 for this kind of support.
87
88 Thanks,
89 Pesa