public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:prefix commit in: lib/portage/util/
@ 2022-07-26 19:14 Fabian Groffen
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Groffen @ 2022-07-26 19:14 UTC (permalink / raw
  To: gentoo-commits

commit:     e15db890808f276f1b4283bd3b12d153a0239fc6
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 26 19:09:44 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 19:09:44 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e15db890

lib/portage/util: make getlibpaths the same for Prefix/non-Prefix

ld.so.conf is available on every platform, and it actually contains the
toolchain path (gcc_s, stdc++, etc.) so much better than using a static
set.  Cater for Darwin although using *_LIBRARY_PATH is questionable.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 lib/portage/util/__init__.py | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/lib/portage/util/__init__.py b/lib/portage/util/__init__.py
index 4e9cef66f..6855a87f1 100644
--- a/lib/portage/util/__init__.py
+++ b/lib/portage/util/__init__.py
@@ -2016,22 +2016,15 @@ def getlibpaths(root, env=None):
     if env is None:
         env = os.environ
     # BEGIN PREFIX LOCAL:
-    # LD_LIBRARY_PATH isn't portable, and considered harmfull, so better
-    # not use it.  We don't need any host OS lib paths either, so do
-    # Prefix case.
-    if EPREFIX != '':
-        rval = []
-        rval.append(EPREFIX + "/usr/lib")
-        rval.append(EPREFIX + "/lib")
-        # we don't know the CHOST here, so it's a bit hard to guess
-        # where GCC's and ld's libs are.  Though, GCC's libs should be
-        # in lib and usr/lib, binutils' libs are rarely used
-    else:
+    # For Darwin, match LD_LIBRARY_PATH with DYLD_LIBRARY_PATH.
+    # We don't need any host OS lib paths in Prefix, so just going with
+    # the prefixed one is fine.
+    # the following is based on the information from ld.so(8)
+    rval = env.get("LD_LIBRARY_PATH", "").split(":")
+    rval.extend(env.get("DYLD_LIBRARY_PATH", "").split(":"))
+    rval.extend(read_ld_so_conf(os.path.join(root, EPREFIX, "etc", "ld.so.conf")))
+    rval.append(f"{EPREFIX}/usr/lib")
+    rval.append(f"{EPREFIX}/lib")
     # END PREFIX LOCAL
-        # the following is based on the information from ld.so(8)
-        rval = env.get("LD_LIBRARY_PATH", "").split(":")
-        rval.extend(read_ld_so_conf(os.path.join(root, "etc", "ld.so.conf")))
-        rval.append("/usr/lib")
-        rval.append("/lib")
 
     return [normalize_path(x) for x in rval if x]


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/portage:prefix commit in: lib/portage/util/
@ 2023-07-12  7:52 Fabian Groffen
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Groffen @ 2023-07-12  7:52 UTC (permalink / raw
  To: gentoo-commits

commit:     bf9e572160ca3ae495ebd767951b31286665fc05
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 12 07:50:17 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Jul 12 07:52:30 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=bf9e5721

lib/portage/util/hooks: default to EPREFIX

Bug: https://bugs.gentoo.org/910228
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 lib/portage/util/hooks.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/portage/util/hooks.py b/lib/portage/util/hooks.py
index cbb15f123..c0a37fff7 100644
--- a/lib/portage/util/hooks.py
+++ b/lib/portage/util/hooks.py
@@ -12,11 +12,15 @@ from portage.output import create_color_func
 from portage.util import writemsg_level, _recursive_file_list
 from warnings import warn
 
+# PREFIX LOCAL
+from portage.const import EPREFIX
+
 bad = create_color_func("BAD")
 warn = create_color_func("WARN")
 
 
-def get_hooks_from_dir(rel_directory, prefix="/"):
+# PREFIX LOCAL: prefix=EPREFIX
+def get_hooks_from_dir(rel_directory, prefix=EPREFIX):
     directory = os.path.join(prefix, portage.USER_CONFIG_PATH, rel_directory)
 
     hooks = OrderedDict()
@@ -39,7 +43,8 @@ def get_hooks_from_dir(rel_directory, prefix="/"):
     return hooks
 
 
-def perform_hooks(rel_directory, *argv, prefix="/"):
+# PREFIX LOCAL: prefix=EPREFIX
+def perform_hooks(rel_directory, *argv, prefix=EPREFIX):
     for filepath, name in get_hooks_from_dir(rel_directory, prefix).items():
         hook_command = filepath + " " + " ".join(map(str, argv))
         retval = portage.process.spawn(hook_command)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-12  7:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-26 19:14 [gentoo-commits] proj/portage:prefix commit in: lib/portage/util/ Fabian Groffen
  -- strict thread matches above, loose matches on Subject: below --
2023-07-12  7:52 Fabian Groffen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox