try:
env_update(target_root=self.settings['ROOT'],
prev_mtimes=ldpath_mtimes,
- contents=contents, env=self.settings.environ(),
+ 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(makelinks=(not downgrade),
target_root=self.settings['ROOT'], prev_mtimes=prev_mtimes,
- contents=contents, env=self.settings.environ(),
+ contents=contents, env=self.settings,
writemsg_level=self._display_merge)
finally:
self.vartree.dbapi._fs_unlock()
prev_mtimes = portage.mtimedb["ldpath"]
if env is None:
env = os.environ
- envd_dir = os.path.join(target_root, "etc", "env.d")
+
+ eprefix = env.get("EPREFIX", "")
+ eprefix_lstrip = eprefix.lstrip(os.sep)
+ envd_dir = os.path.join(target_root, eprefix_lstrip, "etc", "env.d")
ensure_dirs(envd_dir, mode=0o755)
fns = listdir(envd_dir, EmptyOnError=1)
fns.sort()
they won't be overwritten by this dict.update call."""
env.update(myconfig)
- ldsoconf_path = os.path.join(target_root, "etc", "ld.so.conf")
+ ldsoconf_path = os.path.join(
+ target_root, eprefix_lstrip, "etc", "ld.so.conf")
try:
myld = io.open(_unicode_encode(ldsoconf_path,
encoding=_encodings['fs'], errors='strict'),
# Update prelink.conf if we are prelink-enabled
if prelink_capable:
- newprelink = atomic_ofstream(
- os.path.join(target_root, "etc", "prelink.conf"))
+ newprelink = atomic_ofstream(os.path.join(
+ target_root, eprefix_lstrip, "etc", "prelink.conf"))
newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
newprelink.write("# contents of /etc/env.d directory\n")
lib_dirs = set()
for lib_dir in set(specials["LDPATH"] + \
['usr/lib','usr/lib64','usr/lib32','lib','lib64','lib32']):
- x = os.path.join(target_root, lib_dir.lstrip(os.sep))
+ x = os.path.join(target_root, eprefix_lstrip, lib_dir.lstrip(os.sep))
try:
newldpathtime = os.stat(x)[stat.ST_MTIME]
lib_dirs.add(normalize_path(x))
ldconfig = find_binary("%s-ldconfig" % env["CHOST"])
# Only run ldconfig as needed
- if (ld_cache_update or makelinks) and ldconfig:
+ if (ld_cache_update or makelinks) and ldconfig and not eprefix:
# ldconfig has very different behaviour between FreeBSD and Linux
if ostype == "Linux" or ostype.lower().endswith("gnu"):
# We can't update links if we haven't cleaned other versions first, as
cenvnotice += "# GO INTO /etc/csh.cshrc NOT /etc/csh.env\n\n"
#create /etc/profile.env for bash support
- outfile = atomic_ofstream(os.path.join(target_root, "etc", "profile.env"))
+ outfile = atomic_ofstream(os.path.join(
+ target_root, eprefix_lstrip, "etc", "profile.env"))
outfile.write(penvnotice)
env_keys = [ x for x in env if x != "LDPATH" ]
outfile.close()
#create /etc/csh.env for (t)csh support
- outfile = atomic_ofstream(os.path.join(target_root, "etc", "csh.env"))
+ outfile = atomic_ofstream(os.path.join(
+ target_root, eprefix_lstrip, "etc", "csh.env"))
outfile.write(cenvnotice)
for x in env_keys:
outfile.write("setenv %s '%s'\n" % (x, env[x]))