env_update: use eroot variable more
authorZac Medico <zmedico@gentoo.org>
Mon, 24 Sep 2012 03:00:56 +0000 (20:00 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 24 Sep 2012 03:00:56 +0000 (20:00 -0700)
pym/portage/util/env_update.py

index ac18ad269626439c16572ef83c2852b8874d0c42..4c1fbf8915f6ed9c677e28c2cce2397156deb0aa 100644 (file)
@@ -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]))