Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] Cache rewrite backport
Date: Sun, 30 Oct 2005 17:05:04
Message-Id: 20051030170120.GF6443@nightcrawler
In Reply to: Re: [gentoo-portage-dev] Cache rewrite backport by Thomas de Grenier de Latour
1 On Sun, Oct 30, 2005 at 01:08:49PM +0100, Thomas de Grenier de Latour wrote:
2 > Hi Brian,
3 >
4 > I'm using latest 3.0-cache-backport-experimental-7.patch since a
5 > few days, and i've noticed a minor annoyance:
6 > - i'm using an overlay portage ebuild numbered 2.0.20051024 (a
7 > patched SVN snapshot)
8 > - when i sync, i always get the "An update to portage is available."
9 > at the end, which is obviously not true (my overlay ebuild being the
10 > best visible version)
11 >
12 > In bin/emerge, the chunk of code where it happens is like this:
13 Correction to that code, in conjunction with the cache patch.
14
15 + else:
16 + pdb = portage.db[portage.root]["porttree"].dbapi
17 portage.portageexit()
18 reload(portage)
19 - mybestpv=portage.portdb.xmatch("bestmatch-visible","sys-apps/portage")
20 + mybestpv=pdb.xmatch("bestmatch-visible","sys-apps/portage")
21 mypvs=portage.best(portage.db[portage.root]["vartree"].dbapi.match("sys-apps/portage"))
22 chk_updated_cfg_files()
23 if(mybestpv != mypvs):
24
25
26 > I've added a line to print mybestpv and mypvs in the message, and
27 > surprisingly i got:
28 > * Best is and installed is sys-apps/portage-2.0.20051024
29 > Obviously, mybestpv is an empty string here, and i don't understand why.
30 >
31 > Any idea?
32 Yeah, 2.0.20051024 > 2.0.53_rc7 :)
33 >>> portage.pkgcmp(*[portage.pkgsplit(x) for x in ["sys-apps/portage-2.0.20051024", "sys-apps/portage-2.0.53_rc7"]])
34 1
35 >>> portage.pkgcmp(*[portage.pkgsplit(x) for x in ["sys-apps/portage-2.0.53_rc8", "sys-apps/portage-2.0.53_rc7"]])
36 1
37
38 As to why mybestpv is empty? You've stumbled on a bug in portage, or
39 something locally is weird. If I had to guess, I'd put my finger on
40 reload(portage) not working as people expect.
41
42 The reload hack that is being used there is pretty crappy offhand,
43 since it's not exactly sane for python code that uses dynamic imports
44 (portage has always used __import__ to get the cache backend db). If
45 you hunt through what portageexit actually does... well... it does
46 pretty much nothing. All of the code that nukes caches/etc is atexit
47 based last I looked, although that shouldn't matter since a reload
48 _should_ recreate the portage namespace.
49
50 Meanwhile, the change above should be considered regardless of
51 this bug, since the check of "blah was updated" should really be
52 limited to the synced repo imo.
53 ~harring