From 625db715810d0f6742da79d4213a60fc3bf490fa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 8 Jul 2010 12:01:33 +0200 Subject: [PATCH] Support repository-wide updates in FakeVartree. --- pym/_emerge/FakeVartree.py | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py index 4dd6532d8..afc74457d 100644 --- a/pym/_emerge/FakeVartree.py +++ b/pym/_emerge/FakeVartree.py @@ -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) -- 2.26.2