diff options
author | Michał Górny <gentoo@mgorny.alt.pl> | 2010-07-08 12:01:33 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-07-27 16:13:16 -0700 |
commit | 625db715810d0f6742da79d4213a60fc3bf490fa (patch) | |
tree | 266ff7ddbd7d75b6855e4cd91acedd9aa5ce45e2 | |
parent | b32efe2d1eb1a9a7c52f3ec18abd3d5db4ab8767 (diff) | |
download | portage-625db715810d0f6742da79d4213a60fc3bf490fa.tar.gz portage-625db715810d0f6742da79d4213a60fc3bf490fa.tar.bz2 portage-625db715810d0f6742da79d4213a60fc3bf490fa.zip |
Support repository-wide updates in FakeVartree.
-rw-r--r-- | pym/_emerge/FakeVartree.py | 37 |
1 files 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) |