Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 49225 - portage.pym: grab_stacked breaks order of overlaid stuff when handler returns DictType
Summary: portage.pym: grab_stacked breaks order of overlaid stuff when handler returns...
Status: RESOLVED DUPLICATE of bug 45468
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-27 17:44 UTC by Ed Catmur
Modified: 2005-07-17 13:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Catmur 2004-04-27 17:44:42 UTC
Demonstration, with virtuals:

>>> import portage
>>> portage.grab_stacked("virtuals",["/etc/make.profile"],portage.grabdict)['virtual/opengl']
['x11-base/xfree']
>>> portage.grab_stacked("virtuals",["/var/cache/edb"],portage.grabdict)['virtual/opengl']
['media-video/nvidia-glx', 'x11-base/xorg-x11']
>>> portage.grab_stacked("virtuals",["/etc/make.profile","/var/cache/edb"],portage.grabdict)['virtual/opengl']
['x11-base/xorg-x11', 'media-video/nvidia-glx', 'x11-base/xfree']

Obviously, this last should be ['media-video/nvidia-glx', 'x11-base/xorg-x11', 'x11-base/xfree'] to make sense and to conform with the Portage docs.

I don't mind saying this took me an age to figure out, and I didn't expect to have to go this deep into Portage internals.

The culprit is in pym/portage.py @@ 824-835:
			for y in stuff.keys():
				if not final_dict.has_key(y):
					final_dict[y] = stuff[y]
				else:
					for thing in stuff[y]:
						if thing:
							if thing[0] == '-':
								if thing[1:] in final_dict[y]:
									del final_dict[y][final_dict[y].index(thing[1:])]
							else:
								if thing not in final_dict[y]:
									final_dict[y].insert(0,thing)
Comment 1 Ed Catmur 2004-04-27 17:46:32 UTC
Ooh.

Looking at the viewcvs it seems like the whole lot of that code region has been refactored. I'll grab a recent portage 2.0.51_pre and see if that fixes things; if so I'll close this.
Comment 2 Ed Catmur 2004-04-27 17:55:04 UTC
Oh, I forgot to say: the obvious fix is to replace
					for thing in stuff[y]:
with
					for thing in stuff[y][::-1]:

I guess few enough people will be affected by this that the fix isn't really needed, though.
Comment 3 Ed Catmur 2004-04-27 19:23:50 UTC
And it does (although these "QA Notice" messages portage is throwing up are a little scary).

Closing FIXED, though not too sure if this is the correct resolution (how far away is portage 2.0.51 from a public testing release?)
Comment 4 Ed Catmur 2004-04-27 21:46:17 UTC
Reopening to mark as duplicate of bug 45468.
Comment 5 Ed Catmur 2004-04-27 21:47:48 UTC

*** This bug has been marked as a duplicate of 45468 ***