diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-07-06 23:07:01 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-07-06 23:07:01 +0000 |
commit | a39124fb6af38c7bd00f09556490fe8f15e8f84c (patch) | |
tree | f17d23acbbc40e48fcba7388f8ea6f28fe4425ec /pym | |
parent | 36f13a81f93d1d5bf055f78acc2be9f3b70bf122 (diff) | |
download | portage-a39124fb6af38c7bd00f09556490fe8f15e8f84c.tar.gz portage-a39124fb6af38c7bd00f09556490fe8f15e8f84c.tar.bz2 portage-a39124fb6af38c7bd00f09556490fe8f15e8f84c.zip |
When depgraph updates preferences for old-style virtuals, also update them in the global config so that they are consistent everywhere. Optimize config.setinst() to minimize the work done. (trunk r7185)
svn path=/main/branches/2.1.2/; revision=7186
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/pym/portage.py b/pym/portage.py index f651ddc59..ec36ede34 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -1813,22 +1813,29 @@ class config: self.getvirtuals() # Grab the virtuals this package provides and add them into the tree virtuals. provides = mydbapi.aux_get(mycpv, ["PROVIDE"])[0] + if not provides: + return if isinstance(mydbapi, portdbapi): + self.setcpv(mycpv, mydb=mydbapi) myuse = self["USE"] else: myuse = mydbapi.aux_get(mycpv, ["USE"])[0] virts = flatten(portage_dep.use_reduce(portage_dep.paren_reduce(provides), uselist=myuse.split())) + modified = False cp = dep_getkey(mycpv) for virt in virts: virt = dep_getkey(virt) - if not self.treeVirtuals.has_key(virt): - self.treeVirtuals[virt] = [] - # XXX: Is this bad? -- It's a permanent modification - if cp not in self.treeVirtuals[virt]: - self.treeVirtuals[virt].append(cp) - - self.virtuals = self.__getvirtuals_compile() + providers = self.treeVirtuals.get(virt) + if providers is None: + providers = [] + self.treeVirtuals[virt] = providers + if cp not in providers: + providers.append(cp) + modified = True + + if modified: + self.virtuals = self.__getvirtuals_compile() def regenerate(self,useonly=0,use_cache=1): |