1 |
On 20/10/15 18:37, Neil Bothwick wrote: |
2 |
> On Tue, 20 Oct 2015 17:04:10 +0300, Nikos Chantziaras wrote: |
3 |
> |
4 |
>> So I assume, since the docs don't mention anything special, that I |
5 |
>> should put the code in a conf file. So I created this file: |
6 |
>> |
7 |
>> /etc/portage/env/test.conf |
8 |
>> |
9 |
>> and in it: |
10 |
>> |
11 |
>> if [ "${EBUILD_PHASE}" == "postinst" ]; |
12 |
>> then |
13 |
>> echo ":: TEST" |
14 |
>> fi |
15 |
>> [...] |
16 |
>> |
17 |
>> But when I "emerge app-misc/mc", I get: |
18 |
>> |
19 |
>> !!! Problem in 'app-misc/mc' dependencies. |
20 |
>> !!! "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=') |
21 |
>> portage.exception |
22 |
>> ... done! |
23 |
>> "/etc/portage/env/test.conf", line 1: Invalid token '[' (not '=') |
24 |
> |
25 |
> I'm nut sure you can put that sort of thing in package.env, I thought it |
26 |
> was only for settings variables, like make.conf but per-package. You can |
27 |
> add function calls in /etc/portage/env/cat/pkg, for example I have |
28 |
> used this for a couple of packages that didn't support epatch_user |
29 |
> |
30 |
> post_src_unpack() { |
31 |
> cd "${S}" |
32 |
> epatch_user |
33 |
> } |
34 |
> |
35 |
> AFAIK you can do this for any of the standard ebuild functions listed in |
36 |
> man 5 ebuild. |
37 |
|
38 |
Thanks! That works just fine. |
39 |
|
40 |
Btw, you can put your epatch_user in /etc/portage/bashrc instead and |
41 |
have it for all packages. It is safe to have it twice even in packages |
42 |
that do support epatch_user. That function is specifically written for |
43 |
this use case, so that even when using it multiple times, the patches |
44 |
are only applied once. |