From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 708B3158094 for ; Tue, 26 Jul 2022 19:14:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5D2C2E0E7C; Tue, 26 Jul 2022 19:14:05 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0899CE0E7C for ; Tue, 26 Jul 2022 19:14:04 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C205A340E37 for ; Tue, 26 Jul 2022 19:14:03 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 21F2D448 for ; Tue, 26 Jul 2022 19:14:02 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1658862584.e15db890808f276f1b4283bd3b12d153a0239fc6.grobian@gentoo> Subject: [gentoo-commits] proj/portage:prefix commit in: lib/portage/util/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/util/__init__.py X-VCS-Directories: lib/portage/util/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: e15db890808f276f1b4283bd3b12d153a0239fc6 X-VCS-Branch: prefix Date: Tue, 26 Jul 2022 19:14:02 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: d474ff5a-00c6-4dfd-a17c-f521a2c2049e X-Archives-Hash: 431f5176b14143345bd5f5ae9f75f5cd commit: e15db890808f276f1b4283bd3b12d153a0239fc6 Author: Fabian Groffen gentoo org> AuthorDate: Tue Jul 26 19:09:44 2022 +0000 Commit: Fabian Groffen gentoo 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 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]