diff options
author | Michał Górny <mgorny@gentoo.org> | 2018-05-09 17:22:55 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2018-05-09 17:25:51 +0200 |
commit | ee2d9260e1f7cf0ad202cd29616f298ae7c0726d (patch) | |
tree | 6b92af5417fa4b284cad54c396d81d1c58e38dbe /dev-util | |
parent | dev-util/scons: Use git directory structure for workdir (diff) | |
download | gentoo-ee2d9260e1f7cf0ad202cd29616f298ae7c0726d.tar.gz gentoo-ee2d9260e1f7cf0ad202cd29616f298ae7c0726d.tar.bz2 gentoo-ee2d9260e1f7cf0ad202cd29616f298ae7c0726d.zip |
dev-util/scons: Support envvar pass-through override
Add a Gentoo-specific envvar that can be used to force passing through
of (ebuild) environment. This can be used to disable the bad default
of wiping the entire environment and lets us restore sanity without
having to patch every SCons-using project out there. Also should solve
Prefix problems without conditional patching.
Closes: https://bugs.gentoo.org/655322
Diffstat (limited to 'dev-util')
-rw-r--r-- | dev-util/scons/files/scons-3.0.1-env-passthrough.patch | 40 | ||||
-rw-r--r-- | dev-util/scons/scons-3.0.1-r1.ebuild | 71 |
2 files changed, 111 insertions, 0 deletions
diff --git a/dev-util/scons/files/scons-3.0.1-env-passthrough.patch b/dev-util/scons/files/scons-3.0.1-env-passthrough.patch new file mode 100644 index 000000000000..16de316766b1 --- /dev/null +++ b/dev-util/scons/files/scons-3.0.1-env-passthrough.patch @@ -0,0 +1,40 @@ +From f2f8536be12f1d095382e7598060c1eb51eb5337 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Wed, 9 May 2018 17:04:49 +0200 +Subject: [PATCH] posix: Support GENTOO_SCONS_ENV_PASSTHROUGH=1 + +Support GENTOO_SCONS_ENV_PASSTHROUGH=1 variable to override the default +of wiping the environment and resetting PATH to default, and instead +pass all variables through. +--- + src/engine/SCons/Platform/posix.py | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py +index 8db08db1..af34650c 100644 +--- a/src/engine/SCons/Platform/posix.py ++++ b/src/engine/SCons/Platform/posix.py +@@ -87,9 +87,17 @@ def generate(env): + pspawn = piped_env_spawn + # Note that this means that 'escape' is no longer used + +- if 'ENV' not in env: +- env['ENV'] = {} +- env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin' ++ # Force pass-through of environment variables in Gentoo builds ++ if os.environ.get('GENTOO_SCONS_ENV_PASSTHROUGH', False): ++ new_env = os.environ.copy() ++ if 'ENV' in env: ++ new_env.update(env['ENV']) ++ env['ENV'] = new_env ++ else: ++ if 'ENV' not in env: ++ env['ENV'] = {} ++ env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin' ++ + env['OBJPREFIX'] = '' + env['OBJSUFFIX'] = '.o' + env['SHOBJPREFIX'] = '$OBJPREFIX' +-- +2.17.0 + diff --git a/dev-util/scons/scons-3.0.1-r1.ebuild b/dev-util/scons/scons-3.0.1-r1.ebuild new file mode 100644 index 000000000000..27ba6fa1e888 --- /dev/null +++ b/dev-util/scons/scons-3.0.1-r1.ebuild @@ -0,0 +1,71 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +PYTHON_COMPAT=( python2_7 ) +PYTHON_REQ_USE="threads(+)" + +inherit distutils-r1 + +DESCRIPTION="Extensible Python-based build utility" +HOMEPAGE="http://www.scons.org/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz + doc? ( + http://www.scons.org/doc/${PV}/PDF/${PN}-user.pdf -> ${P}-user.pdf + http://www.scons.org/doc/${PV}/HTML/${PN}-user.html -> ${P}-user.html + ) + test? ( https://github.com/scons/scons/archive/${PV}.tar.gz -> ${P}.gh.tar.gz )" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" +IUSE="doc test" + +S=${WORKDIR}/${P}/src + +PATCHES=( + # support env passthrough for Gentoo ebuilds + "${FILESDIR}"/scons-3.0.1-env-passthrough.patch +) + +src_unpack() { + # use the git directory structure, but put pregenerated release + # inside src/ subdirectory to make our life easier + if use test; then + unpack "${P}.gh.tar.gz" + rm -r "${P}/src" || die + else + mkdir "${P}" || die + fi + + cd "${P}" || die + unpack "${P}.tar.gz" + mv "${P}" src || die +} + +src_prepare() { + # apply patches relatively to top directory + cd "${WORKDIR}/${P}" || die + distutils-r1_src_prepare + + # remove half-broken, useless custom commands + # and fix manpage install location + sed -i -e '/cmdclass/,/}$/d' \ + -e '/data_files/s:man/:share/man/:' "${S}"/setup.py || die +} + +python_test() { + cd "${WORKDIR}/${P}" || die + "${EPYTHON}" runtest.py -as \ + -j "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")" \ + --builddir "${BUILD_DIR}/lib" || + die "Tests fail with ${EPYTHON}" +} + +python_install_all() { + local DOCS=( {CHANGES,README,RELEASE}.txt ) + distutils-r1_python_install_all + rm "${ED%/}/usr/bin/scons.bat" || die + + use doc && dodoc "${DISTDIR}"/${P}-user.{pdf,html} +} |