1 |
On Sunday, May 27, 2012 11:21:31 PM Nikos Chantziaras wrote: |
2 |
> I have this in /etc/portage/package.env: |
3 |
> |
4 |
> app-emulation/emul-linux-x86-soundlibs soundlibs-delete-jack.conf |
5 |
> |
6 |
> and this in /etc/portage/env/soundlibs-delete-jack.conf: |
7 |
> |
8 |
> if [ "${EBUILD_PHASE}" == "src_prepare"] ; |
9 |
> then |
10 |
> rm -rf "${S}"/usr/lib32/jack |
11 |
> rm -f $(find "${S}" -name 'libjack*') |
12 |
> fi |
13 |
|
14 |
The env/!(bashrc) files are parsed using Python shlex at the time emerge is |
15 |
run, accepting essentially the same types of expressions that are valid in |
16 |
/etc/make.conf. It never goes through a shell. The reason this is "preferred" |
17 |
is certainly for performance, and due to certain things not being possible in |
18 |
abashrc such as setting FEATURES. |
19 |
|
20 |
The two options for defining phase hooks are the portage/bashrc file, and |
21 |
portage/env/CATEGORY/PKG. The bashrc file is global and if present always runs, |
22 |
while the package-specific ones are of course package-specific. |
23 |
|
24 |
Personally, I just use the global bashrc and handle the logic for selecting |
25 |
packages internally. I find it a bit easier to manage than many separate files. |
26 |
|
27 |
setupHookPtrs() { |
28 |
set -- "$@" 'categoryPtrs["$1"]' "$1"'["$2"]' |
29 |
local -A categoryPtrs=( |
30 |
[app-shells]='( |
31 |
[bash]=doBash |
32 |
[ksh]=doKsh |
33 |
)' |
34 |
[media-gfx]='( |
35 |
[digikam]=dgKamFix |
36 |
)' |
37 |
[sys-devel]='( |
38 |
[binutils]=doBinutils |
39 |
)' |
40 |
[www-client]='( |
41 |
[chromium]=chromiumHack |
42 |
)' |
43 |
) \ |
44 |
${categoryPtrs["$1"]+"$1"="${!3}"} |
45 |
${categoryPtrs["$1"]+"${!4-:}"} # Call whatever function. |
46 |
} |
47 |
|
48 |
setupHookPtrs "$CATEGORY" "$PN" |
49 |
|
50 |
-- |
51 |
Dan Douglas |