Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] _doebuild_path: Respect order defined in ROOTPATH (bug 667662)
Date: Mon, 08 Oct 2018 04:33:36
Message-Id: 20181008043220.28027-1-zmedico@gentoo.org
1 Respect the order of paths defined in /etc/env.d/*, so that
2 packages like llvm can rely on ordering relative to paths
3 defined in /etc/env.d/50baselayout since baselayout-2.6.
4
5 See: https://gitweb.gentoo.org/proj/baselayout.git/commit/?id=277e5b9e55717873b87eb541a95f4f2ae0c60a4d
6 Bug: https://bugs.gentoo.org/667662
7 Signed-off-by: Zac Medico <zmedico@g.o>
8 ---
9 lib/portage/package/ebuild/doebuild.py | 6 +++++-
10 1 file changed, 5 insertions(+), 1 deletion(-)
11
12 diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
13 index 941a597e2..621fe7360 100644
14 --- a/lib/portage/package/ebuild/doebuild.py
15 +++ b/lib/portage/package/ebuild/doebuild.py
16 @@ -212,6 +212,7 @@ def _doebuild_path(settings, eapi=None):
17 eprefix = portage.const.EPREFIX
18 prerootpath = [x for x in settings.get("PREROOTPATH", "").split(":") if x]
19 rootpath = [x for x in settings.get("ROOTPATH", "").split(":") if x]
20 + rootpath_set = frozenset(rootpath)
21 overrides = [x for x in settings.get(
22 "__PORTAGE_TEST_PATH_OVERRIDE", "").split(":") if x]
23
24 @@ -243,7 +244,10 @@ def _doebuild_path(settings, eapi=None):
25
26 for prefix in prefixes:
27 for x in ("usr/local/sbin", "usr/local/bin", "usr/sbin", "usr/bin", "sbin", "bin"):
28 - path.append(os.path.join(prefix, x))
29 + # Respect order defined in ROOTPATH
30 + x_abs = os.path.join(prefix, x)
31 + if x_abs not in rootpath_set:
32 + path.append(x_abs)
33
34 path.extend(rootpath)
35 settings["PATH"] = ":".join(path)
36 --
37 2.16.4