commit:     7ff8f85350ad3bf35cfdac1c471e399a04220ed1
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  1 09:15:50 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Mon Oct  2 21:33:21 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7ff8f853

env_update: Write prefixed paths to files and terminal where appropriate

This change is entirely cosmetic as it only affects comments and
informational messages.

I wasn't sure what to do in the FreeBSD/DragonFly case because
/var/run/ld-elf.so.hints probably isn't prefixed, so I left it alone.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 lib/portage/util/env_update.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/portage/util/env_update.py b/lib/portage/util/env_update.py
index a827963ab4..04fde5a52c 100644
--- a/lib/portage/util/env_update.py
+++ b/lib/portage/util/env_update.py
@@ -216,7 +216,7 @@ def _env_update(makelinks, target_root, prev_mtimes, 
contents, env, writemsg_lev
         # 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 /etc/env.d directory\n")
+        myfd.write(f"# contents of {eprefix}/etc/env.d directory.\n")
         for x in specials["LDPATH"]:
             myfd.write(x + "\n")
         myfd.close()
@@ -242,7 +242,7 @@ def _env_update(makelinks, target_root, prev_mtimes, 
contents, env, writemsg_lev
         newprelink.write(
             "# prelink.conf autogenerated by env-update; make all changes to\n"
         )
-        newprelink.write("# contents of /etc/env.d directory\n")
+        newprelink.write(f"# contents of {eprefix}/etc/env.d directory\n")
 
         for x in sorted(potential_lib_dirs) + ["bin", "sbin"]:
             newprelink.write(f"-l /{x}\n")
@@ -286,7 +286,7 @@ def _env_update(makelinks, target_root, prev_mtimes, 
contents, env, writemsg_lev
                     == b"# prelink.conf autogenerated by env-update; make all 
changes to\n"
                 ):
                     f = atomic_ofstream(prelink_conf)
-                    f.write("-c /etc/prelink.conf.d/*.conf\n")
+                    f.write(f"-c {eprefix}/etc/prelink.conf.d/*.conf\n")
                     f.close()
         except OSError as e:
             if e.errno != errno.ENOENT:
@@ -361,7 +361,7 @@ def _env_update(makelinks, target_root, prev_mtimes, 
contents, env, writemsg_lev
             # an older package installed ON TOP of a newer version will cause 
ldconfig
             # to overwrite the symlinks we just made. -X means no links. After 
'clean'
             # we can safely create links.
-            writemsg_level(_(f">>> Regenerating 
{target_root}etc/ld.so.cache...\n"))
+            writemsg_level(_(f">>> Regenerating {eroot}etc/ld.so.cache...\n"))
             ret = subprocess.run(
                 [ldconfig, "-X", "-r", target_root], cwd="/"
             ).returncode
@@ -392,8 +392,8 @@ def _env_update(makelinks, target_root, prev_mtimes, 
contents, env, writemsg_lev
     notice += "# DO NOT EDIT THIS FILE."
     penvnotice = notice + " CHANGES TO STARTUP PROFILES\n"
     cenvnotice = penvnotice[:]
-    penvnotice += "# GO INTO /etc/profile NOT /etc/profile.env\n\n"
-    cenvnotice += "# GO INTO /etc/csh.cshrc NOT /etc/csh.env\n\n"
+    penvnotice += f"# GO INTO {eprefix}/etc/profile NOT 
{eprefix}/etc/profile.env\n\n"
+    cenvnotice += f"# GO INTO {eprefix}/etc/csh.cshrc NOT 
{eprefix}/etc/csh.env\n\n"
 
     # create /etc/profile.env for bash support
     profile_env_path = os.path.join(eroot, "etc", "profile.env")

Reply via email to