Gentoo Archives: gentoo-osx

From: Grobian <grobian@g.o>
To: gentoo-osx@l.g.o
Subject: Re: [gentoo-osx] [PREFIX] calling portage within eclass/ebuilds
Date: Fri, 28 Apr 2006 20:01:12
Message-Id: 20060428195915.GG28924@gentoo.org
In Reply to: [gentoo-osx] [PREFIX] calling portage within eclass/ebuilds by Christopher Chan
1 Hi,
2
3 I'm really delighted to see you diving this deep into the code.
4 Unfortunately I can't really tell you anything useful here. Kito is the
5 man with the knowledge here.
6
7 As far as the webapp eclass concerns, if I recall correctly, there are
8 some nasty things going in there, like calling emerge, but I think the
9 problem you have is sort of generic.
10
11
12 On 28-04-2006 11:45:30 -0700, Christopher Chan wrote:
13 > Hi all,
14 >
15 > I've been working to get phpBB (along with webapp.eclass & webapp-config) to
16 > work in prefixed environment. I've succeeded in getting those things
17 > working and deployed in prefix, but during that process, I discovered
18 > problems with scripts or commands that use portage within an ebuild or
19 > eclass.
20 >
21 > In my case, webapp.eclass uses webapp-config, and it imports portage. But
22 > portage sets 'root' from ROOT environment variable and we, in turn, append
23 > EPREFIX to it. This does not work within an eclass or ebuild because ROOT
24 > already has the EPREFIX so webapp-config fails. I also noticed that
25 > has_version() eventually calls portageq which has the same problem.
26 >
27 > Has anyone else ran into this scenario?
28 >
29 > In any case, I hacked portage.py to reset root to '/' if ROOT = EPREFIX
30 >
31 > Looks like this:
32 > if os.environ.has_key("ROOT"):
33 > root=os.environ["ROOT"]
34 > +
35 > + ## cchan - HACK for when portage is being called within an
36 > ebuild/eclass
37 > + if root == portage_const.EPREFIX: root="/"
38 > +
39 > if not len(root):
40 > root="/"
41 > elif root[-1]!="/":
42 >
43 > Thoughts from others?
44 >
45 > BTW, I would be happy to submit my work on webapp.eclass, webapp-config, and
46 > other ebuilds.
47 >
48
49 --
50 Fabian Groffen
51 Gentoo for Mac OS X Project
52 --
53 gentoo-osx@g.o mailing list