Mailing List Archive

[PREFIX] calling portage within eclass/ebuilds
Hi all,

I've been working to get phpBB (along with webapp.eclass & webapp-config) to
work in prefixed environment. I've succeeded in getting those things
working and deployed in prefix, but during that process, I discovered
problems with scripts or commands that use portage within an ebuild or
eclass.

In my case, webapp.eclass uses webapp-config, and it imports portage. But
portage sets 'root' from ROOT environment variable and we, in turn, append
EPREFIX to it. This does not work within an eclass or ebuild because ROOT
already has the EPREFIX so webapp-config fails. I also noticed that
has_version() eventually calls portageq which has the same problem.

Has anyone else ran into this scenario?

In any case, I hacked portage.py to reset root to '/' if ROOT = EPREFIX

Looks like this:
if os.environ.has_key("ROOT"):
root=os.environ["ROOT"]
+
+ ## cchan - HACK for when portage is being called within an
ebuild/eclass
+ if root == portage_const.EPREFIX: root="/"
+
if not len(root):
root="/"
elif root[-1]!="/":

Thoughts from others?

BTW, I would be happy to submit my work on webapp.eclass, webapp-config, and
other ebuilds.

--
gentoo-osx@gentoo.org mailing list
Re: [PREFIX] calling portage within eclass/ebuilds [ In reply to ]
Hi,

I'm really delighted to see you diving this deep into the code.
Unfortunately I can't really tell you anything useful here. Kito is the
man with the knowledge here.

As far as the webapp eclass concerns, if I recall correctly, there are
some nasty things going in there, like calling emerge, but I think the
problem you have is sort of generic.


On 28-04-2006 11:45:30 -0700, Christopher Chan wrote:
> Hi all,
>
> I've been working to get phpBB (along with webapp.eclass & webapp-config) to
> work in prefixed environment. I've succeeded in getting those things
> working and deployed in prefix, but during that process, I discovered
> problems with scripts or commands that use portage within an ebuild or
> eclass.
>
> In my case, webapp.eclass uses webapp-config, and it imports portage. But
> portage sets 'root' from ROOT environment variable and we, in turn, append
> EPREFIX to it. This does not work within an eclass or ebuild because ROOT
> already has the EPREFIX so webapp-config fails. I also noticed that
> has_version() eventually calls portageq which has the same problem.
>
> Has anyone else ran into this scenario?
>
> In any case, I hacked portage.py to reset root to '/' if ROOT = EPREFIX
>
> Looks like this:
> if os.environ.has_key("ROOT"):
> root=os.environ["ROOT"]
> +
> + ## cchan - HACK for when portage is being called within an
> ebuild/eclass
> + if root == portage_const.EPREFIX: root="/"
> +
> if not len(root):
> root="/"
> elif root[-1]!="/":
>
> Thoughts from others?
>
> BTW, I would be happy to submit my work on webapp.eclass, webapp-config, and
> other ebuilds.
>

--
Fabian Groffen
Gentoo for Mac OS X Project
--
gentoo-osx@gentoo.org mailing list