1 |
On Tue, 28 Feb 2006 13:02:10 -0500, |
2 |
Alec Warner <antarus@g.o> wrote: |
3 |
|
4 |
> Ciaran McCreesh wrote: |
5 |
> |
6 |
> > if [ "${IS_UPGRADE}" = "1" ] ; then |
7 |
> > einfo "Removing old version ${REMOVE_PKG}" |
8 |
> > |
9 |
> > emerge -C "${REMOVE_PKG}" |
10 |
> > fi |
11 |
> > |
12 |
> > |
13 |
> > |
14 |
> Semantics of the logic aside, calling emerge from within an ebuild is |
15 |
> a BIG nono. |
16 |
> |
17 |
|
18 |
Reading the comments in the eclass, i can undestand the motivation. |
19 |
# why do we do this? well ... |
20 |
# |
21 |
# normally, emerge -u installs a new version and then removes the |
22 |
# old version. however, if the new version goes into a different |
23 |
# slot to the old version, then the old version gets left behind |
24 |
# |
25 |
# if USE=-vhosts, then we want to remove the old version, because |
26 |
# the user is relying on portage to do the magical thing for it |
27 |
|
28 |
|
29 |
Two suggestions (don't really know what they are worth though): |
30 |
|
31 |
* Short term, still evil, but less than calling emerge: |
32 |
pkg_postinst() { |
33 |
... |
34 |
if ! use vhost ; then |
35 |
echo 0 > ${ROOT}var/db/pkg/${CATEGORY}/${PN}-${PVR}/SLOT |
36 |
fi |
37 |
} |
38 |
This way, emerge's autoclean (the slow one, at the end) would |
39 |
remove old version of USE="-vhost" packages, since they would be |
40 |
all slotted "0". |
41 |
|
42 |
* Long term, don't know how difficult it would be: Do some kind of |
43 |
USE-expansion of the SLOT variable, to allow something like |
44 |
SLOT="vhost? ( ${PVR} ) !vhost? ( 0 )" |
45 |
This would only affect SLOT when read from porttree sure. In vartree, |
46 |
and in the ebuild env in general, it should still be the reduced |
47 |
version ("${PVR}" or "0") that is used. |
48 |
|
49 |
-- |
50 |
TGL. |
51 |
-- |
52 |
gentoo-dev@g.o mailing list |