1 |
On 11/30/10 03:24, Zac Medico wrote: |
2 |
> Yes, hopefully something like this will do it: |
3 |
> |
4 |
> pkg_preinst() { |
5 |
> main_active_python=$(eselect python show) |
6 |
> } |
7 |
> |
8 |
> pkg_postinst() { |
9 |
> if [[ -n $main_active_python && |
10 |
> $main_active_python != $(eselect python show) ]] ; then |
11 |
> einfo "restoring active python interpreter" |
12 |
> eselect python set "$main_active_python" |
13 |
> fi |
14 |
> } |
15 |
|
16 |
Intersting approach. |
17 |
|
18 |
My debugging ebuild (attached) confirms a fitting order of invocations: |
19 |
|
20 |
# sudo EMERGE_DEFAULT_OPTS= emerge -1 =virtual/debug-2.7.1 \ |
21 |
| fgrep STAGE |
22 |
* STAGE pkg_setup (slot 2.7, version 2.7.1) |
23 |
* STAGE src_unpack (slot 2.7, version 2.7.1) |
24 |
* STAGE src_prepare (slot 2.7, version 2.7.1) |
25 |
* STAGE src_configure (slot 2.7, version 2.7.1) |
26 |
* STAGE src_compile (slot 2.7, version 2.7.1) |
27 |
* STAGE src_install (slot 2.7, version 2.7.1) |
28 |
* STAGE pkg_preinst (slot 2.7, version 2.7.1) |
29 |
* STAGE pkg_prerm (version 2.7, slot 2.7) <---- |
30 |
* STAGE pkg_postrm (version 2.7, slot 2.7) <---- |
31 |
* STAGE pkg_postinst (slot 2.7, version 2.7.1) |
32 |
|
33 |
Shall we give that approach a try? |
34 |
|
35 |
|
36 |
One case it doesn't seem to catch though is when you just run |
37 |
|
38 |
emerge -C dev-lang/python:X.Y |
39 |
|
40 |
on a machine where Python X.Y was installed with eselect_python_update() |
41 |
still in place. Correct? |
42 |
|
43 |
|
44 |
|
45 |
Sebastian |