Gentoo Archives: gentoo-dev

From: Nirbheek Chauhan <nirbheek@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: RFC: New eclass: mozlinguas.eclass
Date: Fri, 03 Feb 2012 16:46:10
Message-Id: CADqQcK7HfEEBeJwLYSRSJtm5JBLZ5SFBZt1Fn+xU5geZORkzQA@mail.gmail.com
In Reply to: Re: [gentoo-dev] Re: RFC: New eclass: mozlinguas.eclass by Mike Frysinger
1 On Fri, Feb 3, 2012 at 3:26 PM, Mike Frysinger <vapier@g.o> wrote:
2 > please post it inline to make review easier
3 >
4 >> # @MAINTAINER: mozilla@g.o
5 >> # @AUTHOR: Nirbheek Chauhan <nirbheek@g.o>
6 >
7 > goes on newline, not inlined
8 >
9
10 Fixed
11
12 >> # @DESCRIPTION: Array containing the list of language pack xpis available
13 >
14 > text starts on the next line, not the existing line
15 >
16
17 Fixed
18
19 >> # @ECLASS-VARIABLE: LANGS
20 >> # @ECLASS-VARIABLE: LANGPACK_PREFIX
21 >> # @ECLASS-VARIABLE: LANGPACK_SUFFIX
22 >
23 > these prob could use MOZ prefixes as well
24 >
25
26 Fixed
27
28 >> : ${LANGS:=""}
29 >
30 > you say it's an array but then you initialize it to a string ...
31 >
32
33 Meh, no real difference. :p
34
35 Changed anyway!
36
37 >> if ! [[ ${PV} =~ alpha|beta ]]; then
38 >>       for x in "${LANGS[@]}" ; do
39 >
40 > x is a global variable here ... one reason to write this as an internal func
41 > and then call it so you can use `local`
42 >
43
44 I just added an "unset x" at the end of the chunk, that should be
45 sufficient I think.
46
47 >>               if [[ ${x} = en ]] || [[ ${x} = en-US ]]; then
48 >
49 > should be == imo
50 >
51
52 Fixed
53
54 >>               SRC_URI="${SRC_URI}
55 >
56 > SRC_URI+="...
57 >
58
59 Fixed
60
61 >>               IUSE="${IUSE} linguas_${x/-/_}"
62 >
63 > IUSE+="...
64 >
65
66 Fixed
67
68 >> mozlinguas() {
69 >
70 > missing eclass documentation
71 >
72
73 Is it really needed for private functions? Nothing should ever call this.
74
75 >>       # Generate the list of language packs called "linguas"
76 >>       # This list is used to unpack and install the xpi language packs
77 >
78 > shouldn't this initialize linguas=() ?
79 >
80 > and shouldn't it name the return value mozlinguas ?
81 >
82
83 Fixed, and renamed the function to mozlinguas_export()
84
85 >>               # If this language is supported by ${P},
86 >>               elif has ${lingua} "${LANGS[@]//-/_}"; then
87 >>                       # Add the language to linguas, if it isn't already there
88 >>                       has ${lingua//_/-} "${linguas[@]}" || linguas+=(${lingua//_/-})
89 >>                       continue
90 >>               # For each short lingua that isn't in LANGS,
91 >>               # We used to add *all* long LANGS to the linguas list,
92 >>               # but we stopped doing that due to bug 325195.
93 >>               fi
94 >
95 > indentation on these comments seem to be off
96 >
97
98 No, that's on purpose. There used to be an `else` statement there.
99 That comment doesn't belong to the previous `elif` block. I've added
100 it outside a blank else block to clarify that.
101
102 >>               # FIXME: Add support for unpacking xpis to portage
103 >>               xpi_unpack "${MOZ_P}-${x}.xpi"
104 >
105 > or, add it to the new unpacker.eclass ;)
106 >
107 > also, seems to be missing `use linguas_${x} && xpi_unpack ...` ?  otherwise,
108 > you just unpack all linguas and not just the ones the user has requested ...
109 > same goes for the install ...
110 >
111
112 No, "${mozlinguas[@]}" is already the intersection of MOZ_LANGS and LINGUAS.
113
114 >>       if [[ "${linguas[*]}" != "" && "${linguas[*]}" != "en" ]]; then
115 >>               einfo "Selected language packs (first will be default): ${linguas[*]}"
116 >
117 > since linguas[*] will be big by default, i'd put the variable expansion into
118 > its own einfo
119
120 It's actually really small by default since it's the list of enabled langpacks.
121
122 Fixed version attached, thanks for the review!
123
124 --
125 ~Nirbheek Chauhan
126
127 Gentoo GNOME+Mozilla Team

Attachments

File name MIME type
mozlinguas.eclass.txt text/plain

Replies

Subject Author
Re: [gentoo-dev] Re: RFC: New eclass: mozlinguas.eclass Mike Frysinger <vapier@g.o>
Re: [gentoo-dev] Re: RFC: New eclass: mozlinguas.eclass Dan Douglas <ormaaj@×××××.com>