commit:     b752f3f004bb909bf29823cffb019a352a747745
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 19 18:59:08 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Apr 19 18:59:48 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b752f3f0

dev-util/scons: improve PATH fix for Prefix

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 .../scons/files/scons-2.5.1-respect-path.patch     | 34 ++++++++++++++++++++++
 dev-util/scons/scons-2.5.1.ebuild                  |  9 ++++--
 dev-util/scons/scons-3.0.0.ebuild                  | 11 ++++---
 3 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/dev-util/scons/files/scons-2.5.1-respect-path.patch 
b/dev-util/scons/files/scons-2.5.1-respect-path.patch
new file mode 100644
index 00000000000..d5da07bc980
--- /dev/null
+++ b/dev-util/scons/files/scons-2.5.1-respect-path.patch
@@ -0,0 +1,34 @@
+Clang/LLVM is installed in an "odd" location (/usr/lib/llvm/<ver>/bin/)
+which is added to PATH.  Since we cannot know <ver> upfront, it's wrong
+to hardcode the PATH at the time of installation else we'd break after a
+Clang update.  Since Clang is the primary compiler on Darwin, just
+extract the relevant path on each invocation.
+
+--- a/engine/SCons/Platform/posix.py
++++ b/engine/SCons/Platform/posix.py
+@@ -87,9 +87,15 @@
+     pspawn = piped_env_spawn
+     # Note that this means that 'escape' is no longer used
+ 
++    with open('@GENTOO_PORTAGE_EPREFIX@/etc/profile.env', 'r') as f:
++        for l in f:
++            if "export PATH=" in l:
++                path = l.split('=')[1].strip("'")
++                break
++
+     if 'ENV' not in env:
+         env['ENV']        = {}
+-    env['ENV']['PATH']    = '/usr/local/bin:/opt/bin:/bin:/usr/bin'
++    env['ENV']['PATH']    = path
+     env['OBJPREFIX']      = ''
+     env['OBJSUFFIX']      = '.o'
+     env['SHOBJPREFIX']    = '$OBJPREFIX'
+@@ -104,7 +110,7 @@
+     env['LIBSUFFIXES']    = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ]
+     env['PSPAWN']         = pspawn
+     env['SPAWN']          = spawn
+-    env['SHELL']          = 'sh'
++    env['SHELL']          = '@GENTOO_PORTAGE_EPREFIX@/bin/sh'
+     env['ESCAPE']         = escape
+     env['TEMPFILE']       = TempFileMunge
+     env['TEMPFILEPREFIX'] = '@'

diff --git a/dev-util/scons/scons-2.5.1.ebuild 
b/dev-util/scons/scons-2.5.1.ebuild
index fda9ae0c18f..658b0ecb5c8 100644
--- a/dev-util/scons/scons-2.5.1.ebuild
+++ b/dev-util/scons/scons-2.5.1.ebuild
@@ -5,7 +5,7 @@ EAPI=6
 PYTHON_COMPAT=( python2_7 pypy )
 PYTHON_REQ_USE="threads(+)"
 
-inherit distutils-r1
+inherit distutils-r1 prefix
 
 DESCRIPTION="Extensible Python-based build utility"
 HOMEPAGE="http://www.scons.org/";
@@ -21,8 +21,11 @@ IUSE="doc"
 #PATCHES=(  )
 
 python_prepare_all() {
-       # https://bugs.gentoo.org/show_bug.cgi?id=361061
-       sed -i -e 
"s|/usr/local/bin:/opt/bin:/bin:/usr/bin|${EPREFIX}/usr/local/bin:${EPREFIX}/opt/bin:${EPREFIX}/bin:${EPREFIX}/usr/bin:/usr/local/bin:/opt/bin:/bin:/usr/bin|g"
 engine/SCons/Platform/posix.py || die
+       # bug #361061
+       if use prefix ; then
+               eapply "${FILESDIR}"/scons-2.5.1-respect-path.patch
+               eprefixify engine/SCons/Platform/posix.py
+       fi
        # and make sure the build system doesn't "force" /usr/local/ :(
        sed -i -e "s/'darwin'/'NOWAYdarwinWAYNO'/" setup.py || die
 

diff --git a/dev-util/scons/scons-3.0.0.ebuild 
b/dev-util/scons/scons-3.0.0.ebuild
index 976a1a92deb..48fee1a5c38 100644
--- a/dev-util/scons/scons-3.0.0.ebuild
+++ b/dev-util/scons/scons-3.0.0.ebuild
@@ -1,11 +1,11 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
 PYTHON_COMPAT=( python2_7 python3_5 python3_6 pypy )
 PYTHON_REQ_USE="threads(+)"
 
-inherit distutils-r1
+inherit distutils-r1 prefix
 
 DESCRIPTION="Extensible Python-based build utility"
 HOMEPAGE="http://www.scons.org/";
@@ -21,8 +21,11 @@ IUSE="doc"
 #PATCHES=(  )
 
 python_prepare_all() {
-       # https://bugs.gentoo.org/show_bug.cgi?id=361061
-       sed -i -e 
"s|/usr/local/bin:/opt/bin:/bin:/usr/bin|${EPREFIX}/usr/local/bin:${EPREFIX}/opt/bin:${EPREFIX}/bin:${EPREFIX}/usr/bin:/usr/local/bin:/opt/bin:/bin:/usr/bin|g"
 engine/SCons/Platform/posix.py || die
+       # bug #361061
+       if use prefix ; then
+               eapply "${FILESDIR}"/scons-2.5.1-respect-path.patch
+               eprefixify engine/SCons/Platform/posix.py
+       fi
        # and make sure the build system doesn't "force" /usr/local/ :(
        sed -i -e "s/'darwin'/'NOWAYdarwinWAYNO'/" setup.py || die
 

Reply via email to