1 |
On 09/11/2014 04:18 AM, Bertrand Simonnet wrote: |
2 |
> Hi guys, |
3 |
> |
4 |
> I have been working on a patch to make package.env (and env/ files) |
5 |
> stackable with the profiles. |
6 |
> The main goal would be to have a mechanism to be able to define a |
7 |
> per-package, per-profile environment in a simple way. |
8 |
> |
9 |
> We can currently do this with profile.bashrc but we have to add some |
10 |
> logic there to decide which package are relevant which already exist in |
11 |
> ebuild.sh and pym/*. |
12 |
> |
13 |
> I attached my current patch which contain two main modifications: |
14 |
> - ebuild.sh walk the profile and source all scripts with path: |
15 |
> ${profile_path}/env/${category}/${PN} |
16 |
> - config.py imports package.env from all profiles and then from |
17 |
> /etc/portage/package.env |
18 |
|
19 |
It seems like duplication of work, to load the per-package env in |
20 |
_grab_pkg_env on the python side, and to source it again on the bash |
21 |
side. Why load the environments in both places? Note that the python |
22 |
getconfig function only supports variable settings (no executable code), |
23 |
which is very limited to what can be done when sourcing the files in bash. |
24 |
|
25 |
> Note: |
26 |
> * I gated the env/$CATEGORY/$PN scripts with a new feature: per-profile-env. |
27 |
> I couldn't do this with package.env as the scripts are parsed before |
28 |
> we initialize self.features. |
29 |
> * I am not particularly attach to both package.env and |
30 |
> env/$CATEGORY/$PN. It might make more sense to have only |
31 |
> env/$CATEGORY/$PN, especially considering the problem with package.env. |
32 |
> |
33 |
> Do you have any suggestions on this patch ? |
34 |
|
35 |
1) If you want both the python-side env loading and the bash-side env |
36 |
loading, I would make those into separate features, since sourcing the |
37 |
files in bash supports full bash syntax while the python-side getconfig |
38 |
function does not. |
39 |
|
40 |
2) When adding new global functions in ebuild.sh, please unset them |
41 |
inside bin/save-ebuild-env.sh, when internal functions are stripped from |
42 |
the environment. |
43 |
|
44 |
3) You might want to look into using the repository's |
45 |
metadata/layout.conf profile-formats setting, as an alternative to using |
46 |
FEATURES to control profile-related behavior. |
47 |
|
48 |
> Would you be willing to accept this patch once the few problems are |
49 |
> sorted out ? |
50 |
|
51 |
I can't speak for everyone, but I'm pretty sure we can work something out. |
52 |
-- |
53 |
Thanks, |
54 |
Zac |