From: Michał Górny Date: Thu, 8 Jul 2010 10:01:33 +0000 (+0200) Subject: Support repository-wide updates in FakeVartree. X-Git-Tag: v2.2_rc68~440 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=625db715810d0f6742da79d4213a60fc3bf490fa;p=portage.git Support repository-wide updates in FakeVartree. --- 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)