Gentoo Archives: gentoo-osx

From: Christopher Chan <cchan@×××××××××××.com>
To: gentoo-osx@l.g.o
Subject: [gentoo-osx] [PREFIX] calling portage within eclass/ebuilds
Date: Fri, 28 Apr 2006 18:45:45
Message-Id: 001e01c66af3$ed461c70$491610ac@cardigan
1 Hi all,
2
3 I've been working to get phpBB (along with webapp.eclass & webapp-config) to
4 work in prefixed environment. I've succeeded in getting those things
5 working and deployed in prefix, but during that process, I discovered
6 problems with scripts or commands that use portage within an ebuild or
7 eclass.
8
9 In my case, webapp.eclass uses webapp-config, and it imports portage. But
10 portage sets 'root' from ROOT environment variable and we, in turn, append
11 EPREFIX to it. This does not work within an eclass or ebuild because ROOT
12 already has the EPREFIX so webapp-config fails. I also noticed that
13 has_version() eventually calls portageq which has the same problem.
14
15 Has anyone else ran into this scenario?
16
17 In any case, I hacked portage.py to reset root to '/' if ROOT = EPREFIX
18
19 Looks like this:
20 if os.environ.has_key("ROOT"):
21 root=os.environ["ROOT"]
22 +
23 + ## cchan - HACK for when portage is being called within an
24 ebuild/eclass
25 + if root == portage_const.EPREFIX: root="/"
26 +
27 if not len(root):
28 root="/"
29 elif root[-1]!="/":
30
31 Thoughts from others?
32
33 BTW, I would be happy to submit my work on webapp.eclass, webapp-config, and
34 other ebuilds.
35
36 --
37 gentoo-osx@g.o mailing list

Replies