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
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.
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
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: