summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/dbapi/vartree.py30
-rw-r--r--pym/portage/util/env_update.py17
2 files changed, 25 insertions, 22 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 4d0a6dd4c..f146adecd 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1842,16 +1842,10 @@ class dblink(object):
else:
self.settings.pop("PORTAGE_LOG_FILE", None)
- # Lock the config memory file to prevent symlink creation
- # in merge_contents from overlapping with env-update.
- self.vartree.dbapi._fs_lock()
- try:
- env_update(target_root=self.settings['ROOT'],
- prev_mtimes=ldpath_mtimes,
- contents=contents, env=self.settings,
- writemsg_level=self._display_merge)
- finally:
- self.vartree.dbapi._fs_unlock()
+ env_update(target_root=self.settings['ROOT'],
+ prev_mtimes=ldpath_mtimes,
+ contents=contents, env=self.settings,
+ writemsg_level=self._display_merge, vardbapi=self.vartree.dbapi)
return os.EX_OK
@@ -3811,17 +3805,11 @@ class dblink(object):
showMessage(_("!!! FAILED postinst: ")+str(a)+"\n",
level=logging.ERROR, noiselevel=-1)
- # Lock the config memory file to prevent symlink creation
- # in merge_contents from overlapping with env-update.
- self.vartree.dbapi._fs_lock()
- try:
- #update environment settings, library paths. DO NOT change symlinks.
- env_update(
- target_root=self.settings['ROOT'], prev_mtimes=prev_mtimes,
- contents=contents, env=self.settings,
- writemsg_level=self._display_merge)
- finally:
- self.vartree.dbapi._fs_unlock()
+ #update environment settings, library paths. DO NOT change symlinks.
+ env_update(
+ target_root=self.settings['ROOT'], prev_mtimes=prev_mtimes,
+ contents=contents, env=self.settings,
+ writemsg_level=self._display_merge, vardbapi=self.vartree.dbapi)
# For gcc upgrades, preserved libs have to be removed after the
# the library path has been updated.
diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py
index 19c7666b9..71dcf376a 100644
--- a/pym/portage/util/env_update.py
+++ b/pym/portage/util/env_update.py
@@ -19,12 +19,13 @@ from portage.process import find_binary
from portage.util import atomic_ofstream, ensure_dirs, getconfig, \
normalize_path, writemsg
from portage.util.listdir import listdir
+from portage.dbapi.vartree import vartree
if sys.hexversion >= 0x3000000:
long = int
def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
- env=None, writemsg_level=None):
+ env=None, writemsg_level=None, vardbapi=None):
"""
Parse /etc/env.d and use it to generate /etc/profile.env, csh.env,
ld.so.conf, and prelink.conf. Finally, run ldconfig. When ldconfig is
@@ -39,6 +40,20 @@ def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
defaults to portage.settings["ROOT"].
@type target_root: String (Path)
"""
+ if vardbapi is None:
+ vardbapi = vartree(settings=portage.settings).dbapi
+
+ # Lock the config memory file to prevent symlink creation
+ # in merge_contents from overlapping with env-update.
+ vardbapi._fs_lock()
+ try:
+ return _env_update(makelinks, target_root, prev_mtimes, contents,
+ env, writemsg_level)
+ finally:
+ vardbapi._fs_unlock()
+
+def _env_update(makelinks, target_root, prev_mtimes, contents, env,
+ writemsg_level):
if writemsg_level is None:
writemsg_level = portage.util.writemsg_level
if target_root is None: