public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH] doebuild: Support finding lib* for ccache/distcc/icecc masquerade dir
Date: Mon, 14 Dec 2015 16:18:01 +0100	[thread overview]
Message-ID: <1450106281-27589-1-git-send-email-mgorny@gentoo.org> (raw)

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



             reply	other threads:[~2015-12-14 15:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14 15:18 Michał Górny [this message]
2015-12-14 16:32 ` [gentoo-portage-dev] [PATCH] doebuild: Support finding lib* for ccache/distcc/icecc masquerade dir Zac Medico
2015-12-20 17:39   ` Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450106281-27589-1-git-send-email-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox