1 |
On Tue, 20 Oct 2015 17:04:10 +0300, Nikos Chantziaras wrote: |
2 |
|
3 |
> I'm following the documentation here: |
4 |
> |
5 |
> https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/Advanced#Using_.2Fetc.2Fportage.2Fenv |
6 |
> |
7 |
> to hook into the postinst phase of an ebuild. The docs only provide an |
8 |
> actual example for the global hook case (/etc/portage/bashrc), but it |
9 |
> says it works the same way on a per-ebuild basis |
10 |
> using /etc/portage/env. But it is totally silent on how to actually do |
11 |
> that :-/ |
12 |
> |
13 |
> So I assume, since the docs don't mention anything special, that I |
14 |
> should put the code in a conf file. So I created this file: |
15 |
> |
16 |
> /etc/portage/env/test.conf |
17 |
> |
18 |
> and in it: |
19 |
> |
20 |
> if [ "${EBUILD_PHASE}" == "postinst" ]; |
21 |
> then |
22 |
> echo ":: TEST" |
23 |
> fi |
24 |
> |
25 |
> Then I added this line to /etc/portage/package.env: |
26 |
> |
27 |
> app-misc/mc test.conf |
28 |
> |
29 |
> But when I "emerge app-misc/mc", I get: |
30 |
> |
31 |
> !!! Problem in 'app-misc/mc' dependencies. |
32 |
> !!! "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=') |
33 |
> portage.exception |
34 |
> ... done! |
35 |
> "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=') |
36 |
> |
37 |
> I don't get it... Can't I have a per-package bashrc or something? The |
38 |
> docs are suggesting that I can, but don't tell me how. |
39 |
|
40 |
I'm nut sure you can put that sort of thing in package.env, I thought it |
41 |
was only for settings variables, like make.conf but per-package. You can |
42 |
add function calls in /etc/portage/env/cat/pkg, for example I have |
43 |
used this for a couple of packages that didn't support epatch_user |
44 |
|
45 |
post_src_unpack() { |
46 |
cd "${S}" |
47 |
epatch_user |
48 |
} |
49 |
|
50 |
AFAIK you can do this for any of the standard ebuild functions listed in |
51 |
man 5 ebuild. |
52 |
|
53 |
|
54 |
-- |
55 |
Neil Bothwick |
56 |
|
57 |
"We demand rigidly defined areas of doubt and uncertainty!" |