Gentoo Archives: gentoo-dev

From: Ryan Hill <dirtyepic@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: How to pass list of paths to eclass?
Date: Wed, 12 Dec 2007 02:34:53
Message-Id: fjnh69$bs2$1@ger.gmane.org
In Reply to: [gentoo-dev] How to pass list of paths to eclass? by Peter Volkov
1 Peter Volkov wrote:
2 > Some eclasses (kernel-2, font) use variable to pass space separated PATH
3 > to patch or fontconfig files from ebuild to eclass. In ebuild we use:
4 >
5 > FONT_CONF="path1 path2"
6 >
7 > Then eclasses use the variable:
8 >
9 > for conffile in ${FONT_CONF}; do
10 > ...
11 > done
12 >
13 > The problem with this doesn't work if path{1,2} contain spaces. The
14 > solution I'm thinking about is to you arrays:
15 >
16 > FONT_CONF=("path1" "path2")
17 >
18 > for conffile in "${FONT_CONF[@]}"; do
19 > ...
20 > done
21 >
22 > But is this good idea? Are there better?
23
24 I was also thinking about changing it to a function instead of a variable,
25 so ebuilds would do something like:
26
27 dofontconfig "${FILESDIR}"/50-myconfig "${FILESDIR}"/51-myotherconfig
28
29 dofontconfig() {
30 insinto /etc/fonts/conf.avail/
31 for conf in "$@"; do
32 [[ -e ${conf} ]] && doins "${conf}"
33 done
34 }
35
36 course this would require a bit of ebuild editing. not many ebuilds
37 use FONT_CONF though.
38
39 on the other hand, the nicety of the variable is that font ebuilds
40 rarely need to contain a src_install.
41
42
43 --
44 looks like christmas at fifty-five degrees
45 this latitude weakens my knees
46 EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662 (0xF9A40662)

Attachments

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