public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] doebuild: Support finding lib* for ccache/distcc/icecc masquerade dir
@ 2015-12-14 15:18 Michał Górny
  2015-12-14 16:32 ` Zac Medico
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2015-12-14 15:18 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Gentoo ccache used to historically swap between storing its masquerade
in 'lib' and $(get_libdir). To prevent breakage with any version of it,
and prevent future breakages when other tools change places randomly
try all three of $(get_libdir), 'lib' and 'libexec' looking for
masquerade dir and use the one that's found. Additionally, warn if there
is no masquerade dir.

Fixes: https://bugs.gentoo.org/show_bug.cgi?id=567360
---
 pym/portage/package/ebuild/doebuild.py | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index ff8958e..a4d4d9f 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -466,7 +466,6 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 		icecream = "icecream" in mysettings.features
 
 		if ccache or distcc or icecream:
-			# Use default ABI libdir in accordance with bug #355283.
 			libdir = None
 			default_abi = mysettings.get("DEFAULT_ABI")
 			if default_abi:
@@ -474,17 +473,27 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 			if not libdir:
 				libdir = "lib"
 
+			# The installation locations use to vary between versions...
+			# Safer to look them up rather than assuming
+			possible_libexecdirs = (libdir, "lib", "libexec")
+			masquerades = []
 			if distcc:
-				mysettings["PATH"] = os.path.join(os.sep, eprefix_lstrip,
-					 "usr", libdir, "distcc", "bin") + ":" + mysettings["PATH"]
-
+				masquerades.append("distcc")
 			if icecream:
-				mysettings["PATH"] = os.path.join(os.sep, eprefix_lstrip,
-					"usr", 'libexec', "icecc", "bin") + ":" + mysettings["PATH"]
-
+				masquerades.append("icecc")
 			if ccache:
-				mysettings["PATH"] = os.path.join(os.sep, eprefix_lstrip,
-					 "usr", libdir, "ccache", "bin") + ":" + mysettings["PATH"]
+				masquerades.append("ccache")
+
+			for m in masquerades:
+				for l in possible_libexecdirs:
+					p = os.path.join(os.sep, eprefix_lstrip,
+							"usr", l, m, "bin")
+					if os.path.isdir(p):
+						mysettings["PATH"] = p + ":" + mysettings["PATH"]
+						break
+				else:
+					writemsg(("Warning: %s requested but no masquerade dir"
+						+ "can be found in /usr/lib*/%s/bin\n") % (m, m))
 
 		if 'MAKEOPTS' not in mysettings:
 			nproc = get_cpu_count()
-- 
2.6.4



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

end of thread, other threads:[~2015-12-20 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-14 15:18 [gentoo-portage-dev] [PATCH] doebuild: Support finding lib* for ccache/distcc/icecc masquerade dir Michał Górny
2015-12-14 16:32 ` Zac Medico
2015-12-20 17:39   ` Michał Górny

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