summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-09-18 16:45:20 -0700
committerZac Medico <zmedico@gentoo.org>2011-09-18 16:45:20 -0700
commit89664c0c4280372be5b593880c2ac5ccc695f688 (patch)
treefc38020ea36ae6502138cce36d9ce01d2bae1662
parent1a5a662780f7a4401a89f0939a9180872f36f05f (diff)
downloadportage-89664c0c4280372be5b593880c2ac5ccc695f688.tar.gz
portage-89664c0c4280372be5b593880c2ac5ccc695f688.tar.bz2
portage-89664c0c4280372be5b593880c2ac5ccc695f688.zip
env_update: add more vardbapi fallback code
For API consumers that call this function without the vardbapi parameter, it whould continue to work correctly in all the cases that worked before the vardbapi was added.
-rw-r--r--pym/portage/util/env_update.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 78bef82fa..65ed2dbe1 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -47,7 +47,15 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
else:
if target_root is None:
target_root = portage.settings["ROOT"]
- vardbapi = portage.db[target_root]["vartree"].dbapi
+ if hasattr(portage, "db") and target_root in portage.db:
+ vardbapi = portage.db[target_root]["vartree"].dbapi
+ else:
+ settings = config(config_root=target_root,
+ target_root=target_root)
+ target_root = settings["ROOT"]
+ if env is None:
+ env = settings
+ vardbapi = vartree(settings=settings).dbapi
# Lock the config memory file to prevent symlink creation
# in merge_contents from overlapping with env-update.