Gentoo Archives: gentoo-portage-dev

From: Brian <dol-sen@×××××.net>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] virtuals and dependencies dispaly
Date: Tue, 24 Oct 2006 16:39:40
Message-Id: 1161707766.18747.18.camel@localhost
In Reply to: Re: [gentoo-portage-dev] virtuals and dependencies dispaly by Jason Stubbs
1 On Wed, 2006-25-10 at 01:48 +0000, Jason Stubbs wrote:
2
3 > > virtuals = portage.db[portage.root]["virtuals"] from
4 > > gentoolkit.__init__.py
5 >
6 > I'm not sure exactly what this returns, but it's probably equivalent to
7 > portage.settings.virtuals.
8
9 I got the same result from both, but this one is easier. There are
10 probably a few more portage calls that could be updated as well.
11
12 >
13 > > I've found virtuals in the tree that are not in portages virtuals and
14 > > vice-versa.
15 > > Is there an order to their use by portage?
16 >
17 > atom = "virtual/portage"
18 > non_virtual_atom = portage.dep_virtual([atom], portage.settings)[0]
19 >
20 > if atom == non_virtual_atom:
21 > print atom,"is a 'new style' virtual (aka regular package)"
22 > else:
23 > print atom,"is an 'old style' virtual that resolves to',
24 > print non_virtual_atom
25 >
26
27 I used this almost without any change. I also am only calling this if
28 it did not resolve already from the best_ebuild or latest_installed
29 checks.
30
31 def get_virtual_dep(atom):
32 """returns a resolved virtual dependency.
33 contributed by Jason Stubbs, with a little adaptation"""
34 # Thanks Jason
35 non_virtual_atom = portage.dep_virtual([atom], portage.settings)[0]
36 if atom == non_virtual_atom:
37 # atom,"is a 'new style' virtual (aka regular package)"
38 return atom
39 else:
40 # atom,"is an 'old style' virtual that resolves to:
41 non_virtual_atom
42 return non_virtual_atom
43
44
45 > > Can the ones in the tree be
46 > > treated as a category/package for listings, etc.. The ones in the tree
47 > > do seem to be returned by:
48 > >
49 > > portage.db['/']['porttree'].getallnodes()[:] # copy
50 > >
51 > > The main reason I am looking at this is for indicating the dependency
52 > > installed/needed for the virtual. If an installed one is found I use
53 > > it's package name. If not where should I get it? From the virtuals in
54 > > portage or the tree? both? - then which order?
55 >
56 > The ones in the tree are just regular packages - but may also exist in the
57 > PROVIDE attribute of associated ebuilds. As for ordering, packages with
58 > PROVIDE override identically named packages in the tree. If you use something
59 > similar to the above, it should all be taken care of though.
60
61 I think these are resolved when I am checking for the best_ebuild and
62 latest_installed checking. Before I added your contribution, many were
63 resolving already from those checks.
64
65 >
66 > --
67 > Jason Stubbs
68
69 Thank you very much...
70
71
72 Now to add a popup dialog to display a dependency's info in another
73 PackageNotebook class instance (summary, dependency, changelog,...
74 notebook). That is going to make following the dependency trail a lot
75 easier for those that want to follow it.
76 --
77 Brian <dol-sen@×××××.net>
78
79 --
80 gentoo-portage-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-portage-dev] virtuals and dependencies dispaly Jason Stubbs <jstubbs@g.o>