On Sun, Oct 30, 2005 at 01:08:49PM +0100, Thomas de Grenier de Latour wrote: > Hi Brian, > > I'm using latest 3.0-cache-backport-experimental-7.patch since a > few days, and i've noticed a minor annoyance: > - i'm using an overlay portage ebuild numbered 2.0.20051024 (a > patched SVN snapshot) > - when i sync, i always get the "An update to portage is available." > at the end, which is obviously not true (my overlay ebuild being the > best visible version) > > In bin/emerge, the chunk of code where it happens is like this: Correction to that code, in conjunction with the cache patch.
+ else:
+ pdb = portage.db[portage.root]["porttree"].dbapi
portage.portageexit()
reload(portage)
- mybestpv=portage.portdb.xmatch("bestmatch-visible","sys-apps/portage")
+ mybestpv=pdb.xmatch("bestmatch-visible","sys-apps/portage")
mypvs=portage.best(portage.db[portage.root]["vartree"].dbapi.match("sys-apps/portage"))
chk_updated_cfg_files()
if(mybestpv != mypvs):
> I've added a line to print mybestpv and mypvs in the message, and
> surprisingly i got:
> * Best is and installed is sys-apps/portage-2.0.20051024
> Obviously, mybestpv is an empty string here, and i don't understand why.
>
> Any idea?
Yeah, 2.0.20051024 > 2.0.53_rc7 :)
>>> portage.pkgcmp(*[portage.pkgsplit(x) for x in
>>> ["sys-apps/portage-2.0.20051024", "sys-apps/portage-2.0.53_rc7"]])
1
>>> portage.pkgcmp(*[portage.pkgsplit(x) for x in
>>> ["sys-apps/portage-2.0.53_rc8", "sys-apps/portage-2.0.53_rc7"]])
1
As to why mybestpv is empty? You've stumbled on a bug in portage, or
something locally is weird. If I had to guess, I'd put my finger on
reload(portage) not working as people expect.
The reload hack that is being used there is pretty crappy offhand,
since it's not exactly sane for python code that uses dynamic imports
(portage has always used __import__ to get the cache backend db). If
you hunt through what portageexit actually does... well... it does
pretty much nothing. All of the code that nukes caches/etc is atexit
based last I looked, although that shouldn't matter since a reload
_should_ recreate the portage namespace.
Meanwhile, the change above should be considered regardless of
this bug, since the check of "blah was updated" should really be
limited to the synced repo imo.
~harring
pgpHzrDvMp5zd.pgp
Description: PGP signature
