Support repository-wide updates in FakeVartree.
authorMichał Górny <gentoo@mgorny.alt.pl>
Thu, 8 Jul 2010 10:01:33 +0000 (12:01 +0200)
committerZac Medico <zmedico@gentoo.org>
Tue, 27 Jul 2010 23:13:16 +0000 (16:13 -0700)
pym/_emerge/FakeVartree.py

index 4dd6532d89a7b278577b2e2eb0eff44b61fba8b4..afc74457d97f6fc0e3226171e7fb59c06fb8d6bf 100644 (file)
@@ -79,7 +79,7 @@ class FakeVartree(vartree):
                except (KeyError, portage.exception.PortageException):
                        if self._global_updates is None:
                                self._global_updates = \
-                                       grab_global_updates(self._portdb.porttree_root)
+                                       grab_global_updates(self._portdb)
                        perform_global_updates(
                                pkg, self.dbapi, self._global_updates)
                return self._aux_get(pkg, wants)
@@ -179,19 +179,30 @@ class FakeVartree(vartree):
 
                return pkg
 
-def grab_global_updates(portdir):
-       updpath = os.path.join(portdir, "profiles", "updates")
+def grab_global_updates(portdb):
+       retupdates = {}
+
+       for repo_name in portdb.getRepositories():
+               repo = portdb.getRepositoryPath(repo_name)
+               updpath = os.path.join(repo, "profiles", "updates")
+               try:
+                       rawupdates = grab_updates(updpath)
+               except portage.exception.DirectoryNotFound:
+                       rawupdates = []
+               upd_commands = []
+               for mykey, mystat, mycontent in rawupdates:
+                       commands, errors = parse_updates(mycontent)
+                       upd_commands.extend(commands)
+               retupdates[repo_name] = upd_commands
+
+       return retupdates
+
+def perform_global_updates(mycpv, mydb, myupdates):
        try:
-               rawupdates = grab_updates(updpath)
-       except portage.exception.DirectoryNotFound:
-               rawupdates = []
-       upd_commands = []
-       for mykey, mystat, mycontent in rawupdates:
-               commands, errors = parse_updates(mycontent)
-               upd_commands.extend(commands)
-       return upd_commands
-
-def perform_global_updates(mycpv, mydb, mycommands):
+               mycommands = myupdates[mydb.aux_get(mycpv, ['repository'])[0]]
+       except KeyError:
+               return
+
        aux_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
        aux_dict = dict(zip(aux_keys, mydb.aux_get(mycpv, aux_keys)))
        updates = update_dbentries(mycommands, aux_dict)