"""Cumulative variables have already been deleted from myconfig so that
they won't be overwritten by this dict.update call."""
env.update(myconfig)
-
- ldsoconf_path = os.path.join(target_root, EPREFIX_LSTRIP, "etc", "ld.so.conf")
+
+ if EPREFIX == '':
+ dolinkingstuff()
+ writeshellprofile()
+
+def dolinkingstuff():
+ # updating this stuff will never work in an offset, other than ROOT
+ # (e.g. not in Prefix), hence the EPREFIX is not taken into account
+ # here since this code should never be triggered on an offset install
+ ldsoconf_path = os.path.join(target_root, "etc", "ld.so.conf")
try:
myld = codecs.open(_unicode_encode(ldsoconf_path,
encoding=_encodings['fs'], errors='strict'),
#ld.so.conf needs updating and ldconfig needs to be run
myfd = atomic_ofstream(ldsoconf_path)
myfd.write("# ld.so.conf autogenerated by env-update; make all changes to\n")
- myfd.write("# contents of "+EPREFIX+"/etc/env.d directory\n")
+ myfd.write("# contents of /etc/env.d directory\n")
for x in specials["LDPATH"]:
myfd.write(x+"\n")
myfd.close()
# Update prelink.conf if we are prelink-enabled
if prelink_capable:
newprelink = atomic_ofstream(
- os.path.join(target_root, EPREFIX_LSTRIP, "etc", "prelink.conf"))
+ os.path.join(target_root, "etc", "prelink.conf"))
newprelink.write("# prelink.conf autogenerated by env-update; make all changes to\n")
- newprelink.write("# contents of "+EPREFIX+"/etc/env.d directory\n")
+ newprelink.write("# contents of /etc/env.d directory\n")
- for x in map(lambda x: os.path.join(EPREFIX,x), ["bin","sbin","usr/bin","usr/sbin","lib","usr/lib"]):
+ for x in map(lambda x: x, ["bin","sbin","usr/bin","usr/sbin","lib","usr/lib"]):
newprelink.write("-l "+x+"\n");
for x in specials["LDPATH"]+specials["PATH"]+specials["PRELINK_PATH"]:
if not x:
mtime_changed = False
lib_dirs = set()
for lib_dir in portage.util.unique_array(specials["LDPATH"]+['usr/lib','usr/lib64','usr/lib32','lib','lib64','lib32']):
- x = os.path.join(target_root, EPREFIX_LSTRIP, lib_dir.lstrip(os.sep))
+ x = os.path.join(target_root, lib_dir.lstrip(os.sep))
try:
newldpathtime = long(os.stat(x).st_mtime)
lib_dirs.add(normalize_path(x))
if not libdir_contents_changed:
makelinks = False
- ldconfig = EPREFIX+"/sbin/ldconfig"
+ ldconfig = "/sbin/ldconfig"
if "CHOST" in env and "CBUILD" in env and \
env["CHOST"] != env["CBUILD"]:
from portage.process import find_binary
ldconfig = find_binary("%s-ldconfig" % env["CHOST"])
# Only run ldconfig as needed
- if (ld_cache_update or makelinks) and ldconfig and EPREFIX == '':
+ if (ld_cache_update or makelinks) and ldconfig:
# 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
# to overwrite the symlinks we just made. -X means no links. After 'clean'
# we can safely create links.
writemsg_level(_(">>> Regenerating %setc/ld.so.cache...\n") % \
- (target_root + EPREFIX_LSTRIP,))
+ (target_root,))
if makelinks:
os.system("cd / ; %s -r '%s'" % (ldconfig, target_root))
else:
os.system("cd / ; %s -X -r '%s'" % (ldconfig, target_root))
elif ostype in ("FreeBSD","DragonFly"):
writemsg_level(_(">>> Regenerating %svar/run/ld-elf.so.hints...\n") % \
- target_root + EPREFIX_LSTRIP)
+ target_root)
os.system(("cd / ; %s -elf -i " + \
"-f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'") % \
- (ldconfig, target_root + EPREFIX_LSTRIP, target_root + EPREFIX_LSTRIP))
+ (ldconfig, target_root, target_root))
del specials["LDPATH"]
+def writeshellprofile():
penvnotice = "# THIS FILE IS AUTOMATICALLY GENERATED BY env-update.\n"
penvnotice += "# DO NOT EDIT THIS FILE. CHANGES TO STARTUP PROFILES\n"
cenvnotice = penvnotice[:]