1 |
commit: ee2d9260e1f7cf0ad202cd29616f298ae7c0726d |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 9 15:22:55 2018 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 9 15:25:51 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee2d9260 |
7 |
|
8 |
dev-util/scons: Support envvar pass-through override |
9 |
|
10 |
Add a Gentoo-specific envvar that can be used to force passing through |
11 |
of (ebuild) environment. This can be used to disable the bad default |
12 |
of wiping the entire environment and lets us restore sanity without |
13 |
having to patch every SCons-using project out there. Also should solve |
14 |
Prefix problems without conditional patching. |
15 |
|
16 |
Closes: https://bugs.gentoo.org/655322 |
17 |
|
18 |
.../scons/files/scons-3.0.1-env-passthrough.patch | 40 ++++++++++++ |
19 |
dev-util/scons/scons-3.0.1-r1.ebuild | 71 ++++++++++++++++++++++ |
20 |
2 files changed, 111 insertions(+) |
21 |
|
22 |
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 |
23 |
new file mode 100644 |
24 |
index 00000000000..16de316766b |
25 |
--- /dev/null |
26 |
+++ b/dev-util/scons/files/scons-3.0.1-env-passthrough.patch |
27 |
@@ -0,0 +1,40 @@ |
28 |
+From f2f8536be12f1d095382e7598060c1eb51eb5337 Mon Sep 17 00:00:00 2001 |
29 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
30 |
+Date: Wed, 9 May 2018 17:04:49 +0200 |
31 |
+Subject: [PATCH] posix: Support GENTOO_SCONS_ENV_PASSTHROUGH=1 |
32 |
+ |
33 |
+Support GENTOO_SCONS_ENV_PASSTHROUGH=1 variable to override the default |
34 |
+of wiping the environment and resetting PATH to default, and instead |
35 |
+pass all variables through. |
36 |
+--- |
37 |
+ src/engine/SCons/Platform/posix.py | 14 +++++++++++--- |
38 |
+ 1 file changed, 11 insertions(+), 3 deletions(-) |
39 |
+ |
40 |
+diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py |
41 |
+index 8db08db1..af34650c 100644 |
42 |
+--- a/src/engine/SCons/Platform/posix.py |
43 |
++++ b/src/engine/SCons/Platform/posix.py |
44 |
+@@ -87,9 +87,17 @@ def generate(env): |
45 |
+ pspawn = piped_env_spawn |
46 |
+ # Note that this means that 'escape' is no longer used |
47 |
+ |
48 |
+- if 'ENV' not in env: |
49 |
+- env['ENV'] = {} |
50 |
+- env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin' |
51 |
++ # Force pass-through of environment variables in Gentoo builds |
52 |
++ if os.environ.get('GENTOO_SCONS_ENV_PASSTHROUGH', False): |
53 |
++ new_env = os.environ.copy() |
54 |
++ if 'ENV' in env: |
55 |
++ new_env.update(env['ENV']) |
56 |
++ env['ENV'] = new_env |
57 |
++ else: |
58 |
++ if 'ENV' not in env: |
59 |
++ env['ENV'] = {} |
60 |
++ env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin' |
61 |
++ |
62 |
+ env['OBJPREFIX'] = '' |
63 |
+ env['OBJSUFFIX'] = '.o' |
64 |
+ env['SHOBJPREFIX'] = '$OBJPREFIX' |
65 |
+-- |
66 |
+2.17.0 |
67 |
+ |
68 |
|
69 |
diff --git a/dev-util/scons/scons-3.0.1-r1.ebuild b/dev-util/scons/scons-3.0.1-r1.ebuild |
70 |
new file mode 100644 |
71 |
index 00000000000..27ba6fa1e88 |
72 |
--- /dev/null |
73 |
+++ b/dev-util/scons/scons-3.0.1-r1.ebuild |
74 |
@@ -0,0 +1,71 @@ |
75 |
+# Copyright 1999-2018 Gentoo Foundation |
76 |
+# Distributed under the terms of the GNU General Public License v2 |
77 |
+ |
78 |
+EAPI=6 |
79 |
+PYTHON_COMPAT=( python2_7 ) |
80 |
+PYTHON_REQ_USE="threads(+)" |
81 |
+ |
82 |
+inherit distutils-r1 |
83 |
+ |
84 |
+DESCRIPTION="Extensible Python-based build utility" |
85 |
+HOMEPAGE="http://www.scons.org/" |
86 |
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz |
87 |
+ doc? ( |
88 |
+ http://www.scons.org/doc/${PV}/PDF/${PN}-user.pdf -> ${P}-user.pdf |
89 |
+ http://www.scons.org/doc/${PV}/HTML/${PN}-user.html -> ${P}-user.html |
90 |
+ ) |
91 |
+ test? ( https://github.com/scons/scons/archive/${PV}.tar.gz -> ${P}.gh.tar.gz )" |
92 |
+ |
93 |
+LICENSE="MIT" |
94 |
+SLOT="0" |
95 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" |
96 |
+IUSE="doc test" |
97 |
+ |
98 |
+S=${WORKDIR}/${P}/src |
99 |
+ |
100 |
+PATCHES=( |
101 |
+ # support env passthrough for Gentoo ebuilds |
102 |
+ "${FILESDIR}"/scons-3.0.1-env-passthrough.patch |
103 |
+) |
104 |
+ |
105 |
+src_unpack() { |
106 |
+ # use the git directory structure, but put pregenerated release |
107 |
+ # inside src/ subdirectory to make our life easier |
108 |
+ if use test; then |
109 |
+ unpack "${P}.gh.tar.gz" |
110 |
+ rm -r "${P}/src" || die |
111 |
+ else |
112 |
+ mkdir "${P}" || die |
113 |
+ fi |
114 |
+ |
115 |
+ cd "${P}" || die |
116 |
+ unpack "${P}.tar.gz" |
117 |
+ mv "${P}" src || die |
118 |
+} |
119 |
+ |
120 |
+src_prepare() { |
121 |
+ # apply patches relatively to top directory |
122 |
+ cd "${WORKDIR}/${P}" || die |
123 |
+ distutils-r1_src_prepare |
124 |
+ |
125 |
+ # remove half-broken, useless custom commands |
126 |
+ # and fix manpage install location |
127 |
+ sed -i -e '/cmdclass/,/}$/d' \ |
128 |
+ -e '/data_files/s:man/:share/man/:' "${S}"/setup.py || die |
129 |
+} |
130 |
+ |
131 |
+python_test() { |
132 |
+ cd "${WORKDIR}/${P}" || die |
133 |
+ "${EPYTHON}" runtest.py -as \ |
134 |
+ -j "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")" \ |
135 |
+ --builddir "${BUILD_DIR}/lib" || |
136 |
+ die "Tests fail with ${EPYTHON}" |
137 |
+} |
138 |
+ |
139 |
+python_install_all() { |
140 |
+ local DOCS=( {CHANGES,README,RELEASE}.txt ) |
141 |
+ distutils-r1_python_install_all |
142 |
+ rm "${ED%/}/usr/bin/scons.bat" || die |
143 |
+ |
144 |
+ use doc && dodoc "${DISTDIR}"/${P}-user.{pdf,html} |
145 |
+} |