Gentoo Archives: gentoo-alt

From: Fabian Groffen <grobian@g.o>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] [prefix]-portage on native gentoo
Date: Mon, 24 Dec 2007 15:56:21
Message-Id: 20071224155604.GI15316@gentoo.org
In Reply to: Re: [gentoo-alt] [prefix]-portage on native gentoo by Fabian Groffen
1 On 22-12-2007 21:24:40 +0100, Fabian Groffen wrote:
2 > The same problem occurs when you try to bootstrap on a system with
3 > another bootstrapped image installed, and you think you can take a
4 > shortcut by not bootstrapping python but using it from your existing
5 > prefix...
6
7 portage-2.2.00.9049 should fix this issue.
8
9
10 > On 07-12-2007 16:34:14 +0100, Michael Haubenwallner wrote:
11 > > Hi,
12 > >
13 > > during bootstrap on native gentoo-linux I encountered this error:
14 > >
15 > > Traceback (most recent call last):
16 > > File "/eprefix/usr/lib/portage/bin/portageq", line 467, in ?
17 > > main()
18 > > File "/eprefix/usr/lib/portage/bin/portageq", line 450, in main
19 > > except portage.exception.PermissionDenied, e:
20 > > AttributeError: 'module' object has no attribute 'exception'
21 > >
22 > > This is because portageq tries to 'import portage', and only if it
23 > > fails, it prepends sys.path with "/eprefix/usr/lib/portage/pym".
24 > >
25 > > Prepending sys.path unconditionally helps here, because it accidentally
26 > > imported another portage:
27 > >
28 > > --- usr/lib/portage/bin/portageq.orig 2007-12-07 16:14:26.768371000 +0100
29 > > +++ usr/lib/portage/bin/portageq 2007-12-07 16:14:48.689741000 +0100
30 > > @@ -434,14 +434,11 @@
31 > > sys.stderr.flush()
32 > > sys.exit(os.EX_USAGE)
33 > > os.environ["ROOT"] = sys.argv[2]
34 > > + from os import path as osp
35 > > + sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
36 > > + global portage
37 > > + import portage
38 > > try:
39 > > - global portage
40 > > - try:
41 > > - import portage
42 > > - except ImportError:
43 > > - from os import path as osp
44 > > - sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
45 > > - import portage
46 > > if uses_root:
47 > > sys.argv[2] = portage.root
48 > > retval = function(sys.argv[2:])
49 > >
50 > > IMO having portage-provided "executables" (like emerge (does it?),
51 > > portageq, ...) relying on PYTHONPATH to "import portage" correctly is a
52 > > pain - not only in prefix: think of calling /usr/bin/portageq (the
53 > > "native" one) while prefix' PYTHONPATH is set up in environment...
54
55
56 --
57 Fabian Groffen
58 Gentoo on a different level
59 --
60 gentoo-alt@g.o mailing list