summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-09-18 15:47:45 -0700
committerZac Medico <zmedico@gentoo.org>2011-09-18 15:47:45 -0700
commit1a5a662780f7a4401a89f0939a9180872f36f05f (patch)
tree0ae7c375433eb288f532fdcda54d9cfbc90607ca
parent7307975a8f4ee465a27ed7cd28fde5db22607248 (diff)
downloadportage-1a5a662780f7a4401a89f0939a9180872f36f05f.tar.gz
portage-1a5a662780f7a4401a89f0939a9180872f36f05f.tar.bz2
portage-1a5a662780f7a4401a89f0939a9180872f36f05f.zip
env_update: use global vardbapi as fallback
-rw-r--r--pym/portage/util/env_update.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 71dcf376a..78bef82fa 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -20,6 +20,7 @@ from portage.util import atomic_ofstream, ensure_dirs, getconfig, \
normalize_path, writemsg
from portage.util.listdir import listdir
from portage.dbapi.vartree import vartree
+from portage.package.ebuild.config import config
if sys.hexversion >= 0x3000000:
long = int
@@ -41,7 +42,12 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
@type target_root: String (Path)
"""
if vardbapi is None:
- vardbapi = vartree(settings=portage.settings).dbapi
+ if isinstance(env, config):
+ vardbapi = vartree(settings=env).dbapi
+ else:
+ if target_root is None:
+ target_root = portage.settings["ROOT"]
+ vardbapi = portage.db[target_root]["vartree"].dbapi
# Lock the config memory file to prevent symlink creation
# in merge_contents from overlapping with env-update.