Gentoo Archives: gentoo-dev

From: "Petteri Räty" <betelgeuse@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] mozextension.eclass last call!
Date: Fri, 30 Dec 2005 11:18:28
Message-Id: 43B516DD.7090902@gentoo.org
In Reply to: [gentoo-dev] mozextension.eclass last call! by "Jory A. Pratt"
1 Jory A. Pratt wrote:
2 > Unless there are any major objections tomorrow night I will commit
3 > mozextension.eclass to the tree. You can find mozextension.eclass at
4 > http://dev.gentoo.org/~anarchy/eclass . You can also find the firefox
5 > and firefox-bin ebuilds at http://dev.gentoo.org/~anarchy/ebuilds that
6 > are waiting to go to be added to the tree which inherit mozextension.
7 >
8
9 http://dev.gentoo.org/~anarchy/eclass/mozconfig-2.eclass
10
11 if use debug; then
12 mozconfig_annotate +debug \
13 --enable-debug \
14 --enable-tests \
15 --disable-reorder \
16 --disable-strip \
17 --disable-strip-libs \
18 --enable-debugger-info-modules=ALL_MODULES
19 else
20 mozconfig_annotate -debug \
21 --disable-debug \
22 --disable-tests \
23 --enable-reorder \
24 --enable-strip \
25 --enable-strip-libs
26
27 I would use a local variable for the common options to avoid code
28 duplication.
29
30 http://dev.gentoo.org/~anarchy/eclass/mozcoreconf.eclass
31
32 declare MOZ=$([[ ${PN} == mozilla || ${PN} == gecko-sdk ]] && echo true
33 || echo false)
34 declare FF=$([[ ${PN} == *firefox ]] && echo true || echo false)
35 declare TB=$([[ ${PN} == *thunderbird ]] && echo true || echo false)
36 declare SB=$([[ ${PN} == *sunbird ]] && echo true || echo false)
37 declare EM=$([[${PN} == *enig]] && echo true || echo false)
38
39 [[${PN} == *enig]] && echo true || echo false
40 This seems to be duplicated here many times. Consider making this a
41 helper function.
42
43
44 mozconfig_final() {
45 declare ac opt hash reason
46
47 You seem to be using declare to keep variables local. I think it is more
48 common to use the local keyword for this:
49
50 betelgeuse@pena /usr/portage/eclass $ grep local * | wc -l
51 810
52 betelgeuse@pena /usr/portage/eclass $ grep declare * | wc -l
53 41
54
55 Why is mozconfig_final here three times?
56
57
58 http://dev.gentoo.org/~anarchy/eclass/mozextension.eclass
59
60 Consider adding debug-print calls to your functions.
61
62 if [ "${x:0:2}" = "./" ] ; then
63 srcdir=""
64 else
65 srcdir="${DISTDIR}/"
66 fi
67
68 srcdir is not declared local in the beginning of the function
69 Check this for other variables too.
70
71 cd "${WORKDIR}" || die "$myfail"
72
73 for consistency you should probably use ${myfail}
74
75 [ ${#} -ne 1 ] && die "'xpi_install' takes exactly one argument"
76
77 you can use FUNCNAME variable to get the name of the function
78
79 cd ${x}
80 Don't know if this can contain spaces but best to be sure and add
81 quotes. I also noticed a couple of other places where pathnames are not
82 quoted.
83
84 emid=$(sed -n '/<\?em:id>\?/!d; s/.*\([\"{].*[}\"]\).*/\1/; s/\"//g; p;
85 q' ${x}/install.rdf)
86
87 Consider adding some comments about what this is supposed to do so that
88 people who are looking at the code the first time get some kind of an idea.
89
90 Regards,
91 Petteri

Attachments

File name MIME type
signature.asc application/pgp-signature