On Tue, 28 Feb 2006 13:02:10 -0500, Alec Warner <[EMAIL PROTECTED]> wrote:
> Ciaran McCreesh wrote: > > > if [ "${IS_UPGRADE}" = "1" ] ; then > > einfo "Removing old version ${REMOVE_PKG}" > > > > emerge -C "${REMOVE_PKG}" > > fi > > > > > > > Semantics of the logic aside, calling emerge from within an ebuild is > a BIG nono. > Reading the comments in the eclass, i can undestand the motivation. # why do we do this? well ... # # normally, emerge -u installs a new version and then removes the # old version. however, if the new version goes into a different # slot to the old version, then the old version gets left behind # # if USE=-vhosts, then we want to remove the old version, because # the user is relying on portage to do the magical thing for it Two suggestions (don't really know what they are worth though): * Short term, still evil, but less than calling emerge: pkg_postinst() { ... if ! use vhost ; then echo 0 > ${ROOT}var/db/pkg/${CATEGORY}/${PN}-${PVR}/SLOT fi } This way, emerge's autoclean (the slow one, at the end) would remove old version of USE="-vhost" packages, since they would be all slotted "0". * Long term, don't know how difficult it would be: Do some kind of USE-expansion of the SLOT variable, to allow something like SLOT="vhost? ( ${PVR} ) !vhost? ( 0 )" This would only affect SLOT when read from porttree sure. In vartree, and in the ebuild env in general, it should still be the reduced version ("${PVR}" or "0") that is used. -- TGL. -- gentoo-dev@gentoo.org mailing list