1 |
commit: 7cb7196fe8aa668e76437a8a4500a7bcb9fd3c75 |
2 |
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org> |
3 |
AuthorDate: Mon Sep 2 05:32:09 2019 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 2 20:11:26 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7cb7196f |
7 |
|
8 |
_doebuild_path: Optimize PATH in ebuild environment. |
9 |
|
10 |
Canonicalize paths of directories in PATH. |
11 |
Avoid duplicates when some directories (e.g. bin and sbin) are merged. |
12 |
|
13 |
Bug: https://bugs.gentoo.org/693306 |
14 |
Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org> |
15 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
16 |
|
17 |
lib/portage/package/ebuild/doebuild.py | 10 +++++++++- |
18 |
1 file changed, 9 insertions(+), 1 deletion(-) |
19 |
|
20 |
diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py |
21 |
index 584ff798b..66e294d51 100644 |
22 |
--- a/lib/portage/package/ebuild/doebuild.py |
23 |
+++ b/lib/portage/package/ebuild/doebuild.py |
24 |
@@ -5,6 +5,7 @@ from __future__ import unicode_literals |
25 |
|
26 |
__all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild'] |
27 |
|
28 |
+import collections |
29 |
import grp |
30 |
import gzip |
31 |
import errno |
32 |
@@ -254,7 +255,14 @@ def _doebuild_path(settings, eapi=None): |
33 |
path.append(x_abs) |
34 |
|
35 |
path.extend(rootpath) |
36 |
- settings["PATH"] = ":".join(path) |
37 |
+ |
38 |
+ # Canonicalize paths and avoid duplicates when some directories |
39 |
+ # (e.g. bin and sbin) are merged. |
40 |
+ real_path = collections.OrderedDict() |
41 |
+ for x in path: |
42 |
+ real_path.setdefault(os.path.realpath(x), None) |
43 |
+ |
44 |
+ settings["PATH"] = ":".join(real_path) |
45 |
|
46 |
def doebuild_environment(myebuild, mydo, myroot=None, settings=None, |
47 |
debug=False, use_cache=None, db=None): |