From 3cf984f540e99df61ae24246fe76ed56afb277aa Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 23 Sep 2012 20:00:56 -0700 Subject: [PATCH] env_update: use eroot variable more --- pym/portage/util/env_update.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/pym/portage/util/env_update.py b/pym/portage/util/env_update.py index ac18ad269..4c1fbf891 100644 --- a/pym/portage/util/env_update.py +++ b/pym/portage/util/env_update.py @@ -90,7 +90,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, eprefix = settings.get("EPREFIX", "") eprefix_lstrip = eprefix.lstrip(os.sep) eroot = normalize_path(os.path.join(target_root, eprefix_lstrip)).rstrip(os.sep) + os.sep - envd_dir = os.path.join(target_root, eprefix_lstrip, "etc", "env.d") + envd_dir = os.path.join(eroot, "etc", "env.d") ensure_dirs(envd_dir, mode=0o755) fns = listdir(envd_dir, EmptyOnError=1) fns.sort() @@ -166,8 +166,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, 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") + ldsoconf_path = os.path.join(eroot, "etc", "ld.so.conf") try: myld = io.open(_unicode_encode(ldsoconf_path, encoding=_encodings['fs'], errors='strict'), @@ -198,7 +197,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, # Update prelink.conf if we are prelink-enabled if prelink_capable: newprelink = atomic_ofstream(os.path.join( - target_root, eprefix_lstrip, "etc", "prelink.conf")) + eroot, "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") @@ -234,7 +233,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, potential_lib_dirs = [] for lib_dir_glob in ['usr/lib*', 'lib*']: - x = os.path.join(target_root, eprefix_lstrip, lib_dir_glob) + x = os.path.join(eroot, lib_dir_glob) for y in glob.glob(_unicode_encode(x, encoding=_encodings['fs'], errors='strict')): try: @@ -247,7 +246,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, lib_dirs = set() for lib_dir in set(specials["LDPATH"] + potential_lib_dirs): - x = os.path.join(target_root, eprefix_lstrip, lib_dir.lstrip(os.sep)) + x = os.path.join(eroot, lib_dir.lstrip(os.sep)) try: newldpathtime = os.stat(x)[stat.ST_MTIME] lib_dirs.add(normalize_path(x)) @@ -323,8 +322,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, 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, eprefix_lstrip, "etc", "profile.env")) + outfile = atomic_ofstream(os.path.join(eroot, "etc", "profile.env")) outfile.write(penvnotice) env_keys = [ x for x in env if x != "LDPATH" ] @@ -338,8 +336,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, outfile.close() #create /etc/csh.env for (t)csh support - outfile = atomic_ofstream(os.path.join( - target_root, eprefix_lstrip, "etc", "csh.env")) + outfile = atomic_ofstream(os.path.join(eroot, "etc", "csh.env")) outfile.write(cenvnotice) for x in env_keys: outfile.write("setenv %s '%s'\n" % (x, env[x])) -- 2.26.2