Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH] doebuild: Support finding lib* for ccache/distcc/icecc masquerade dir
Date: Mon, 14 Dec 2015 15:18:15
Message-Id: 1450106281-27589-1-git-send-email-mgorny@gentoo.org
1 Gentoo ccache used to historically swap between storing its masquerade
2 in 'lib' and $(get_libdir). To prevent breakage with any version of it,
3 and prevent future breakages when other tools change places randomly
4 try all three of $(get_libdir), 'lib' and 'libexec' looking for
5 masquerade dir and use the one that's found. Additionally, warn if there
6 is no masquerade dir.
7
8 Fixes: https://bugs.gentoo.org/show_bug.cgi?id=567360
9 ---
10 pym/portage/package/ebuild/doebuild.py | 27 ++++++++++++++++++---------
11 1 file changed, 18 insertions(+), 9 deletions(-)
12
13 diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
14 index ff8958e..a4d4d9f 100644
15 --- a/pym/portage/package/ebuild/doebuild.py
16 +++ b/pym/portage/package/ebuild/doebuild.py
17 @@ -466,7 +466,6 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
18 icecream = "icecream" in mysettings.features
19
20 if ccache or distcc or icecream:
21 - # Use default ABI libdir in accordance with bug #355283.
22 libdir = None
23 default_abi = mysettings.get("DEFAULT_ABI")
24 if default_abi:
25 @@ -474,17 +473,27 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
26 if not libdir:
27 libdir = "lib"
28
29 + # The installation locations use to vary between versions...
30 + # Safer to look them up rather than assuming
31 + possible_libexecdirs = (libdir, "lib", "libexec")
32 + masquerades = []
33 if distcc:
34 - mysettings["PATH"] = os.path.join(os.sep, eprefix_lstrip,
35 - "usr", libdir, "distcc", "bin") + ":" + mysettings["PATH"]
36 -
37 + masquerades.append("distcc")
38 if icecream:
39 - mysettings["PATH"] = os.path.join(os.sep, eprefix_lstrip,
40 - "usr", 'libexec', "icecc", "bin") + ":" + mysettings["PATH"]
41 -
42 + masquerades.append("icecc")
43 if ccache:
44 - mysettings["PATH"] = os.path.join(os.sep, eprefix_lstrip,
45 - "usr", libdir, "ccache", "bin") + ":" + mysettings["PATH"]
46 + masquerades.append("ccache")
47 +
48 + for m in masquerades:
49 + for l in possible_libexecdirs:
50 + p = os.path.join(os.sep, eprefix_lstrip,
51 + "usr", l, m, "bin")
52 + if os.path.isdir(p):
53 + mysettings["PATH"] = p + ":" + mysettings["PATH"]
54 + break
55 + else:
56 + writemsg(("Warning: %s requested but no masquerade dir"
57 + + "can be found in /usr/lib*/%s/bin\n") % (m, m))
58
59 if 'MAKEOPTS' not in mysettings:
60 nproc = get_cpu_count()
61 --
62 2.6.4

Replies