1 |
commit: 7924811a9eb8d58a06f7f466d8352f2609947796 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jun 2 08:35:15 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jun 2 08:47:41 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7924811a |
7 |
|
8 |
dev-lang/python: Backport sec fixes to 3.6.13_p5 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-lang/python/Manifest | 1 + |
13 |
dev-lang/python/python-3.6.13_p5.ebuild | 338 ++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 339 insertions(+) |
15 |
|
16 |
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest |
17 |
index 450819d159e..79ad587f404 100644 |
18 |
--- a/dev-lang/python/Manifest |
19 |
+++ b/dev-lang/python/Manifest |
20 |
@@ -22,6 +22,7 @@ DIST python-gentoo-patches-3.10.0b1.tar.xz 8116 BLAKE2B aba4856d2463e57187680780 |
21 |
DIST python-gentoo-patches-3.10.0b2.tar.xz 8124 BLAKE2B 6b707ef911c0573e6e87792b4ba1d37e5620723c7b22759c78ac20d88414390a7317546c41d867cd9decb6247c004a9df8eb25ab0999db9c7b431b03b64609e9 SHA512 9a95a1f8a6e4461107e9580e6017956ade47be90fbcd94cbb2eb83a871702308058a402c1eafc8e0d54c2a1910b9030edd9f71b051e846b1219e9f7bd11274b6 |
22 |
DIST python-gentoo-patches-3.6.13_p3.tar.xz 17640 BLAKE2B 255e96f61ad8adb7fdf1cc9f11ca99c8368601dfe9bab4c96adf1e77472dfdf365a6ce197ecc72b574849e2a6235063d63558711049e9e7407862871dc0f2f20 SHA512 7b9a39cd65129c495c513e1b8c259a88194b8877b891cedaa5289bedcc44dbcb5e63e3b9922ef085321e7f4db73b5a5090d30725b456491a98d7ef40b85601eb |
23 |
DIST python-gentoo-patches-3.6.13_p4.tar.xz 17896 BLAKE2B 768ed3860766b212d21718d2f83fe2852dd297aaeaa2d76d93357012513b2aa66e8ff8fc8edf7375ae10ecf0864560e7b4df168f916cba06c67e329612d404f8 SHA512 7ec640280244c7fe8e5c5b3e8c7fd396ec37b920fe1a77d99e85bef20bc335cfc0bf818c58b8f203c15ce343f50d4b8c7ab7591ecfd21380c9cb15d87ed81ca4 |
24 |
+DIST python-gentoo-patches-3.6.13_p5.tar.xz 21940 BLAKE2B f6753f2c4383fbf0de0433040dae812f35bf550c60ac4a042c62afcff158619ebdc47d013dfa62d9b3dd446e8401ad50aaaeb212fb048a884a1c436b73b7afe2 SHA512 260d6abb2c24726fcddbe3ae828e96e315f90b6d486c11868066a25635968214a8c25a89737a9737c32ca110892a28f6b12badbeceb5e4d8d4a2a996b3ce7352 |
25 |
DIST python-gentoo-patches-3.7.10_p3.tar.xz 16804 BLAKE2B 1db238e4b928332d459b5f3c36ecb7f3bc3d3b754fd82e4434c91843ef7574306aef044df9a2644749a17b14ce9fefcd3c3dd44cafaa4ace0b7dc62fb66e73c8 SHA512 61a262a05d1f8e9b08875285db989160362eec66123a15345dd16b8c1f1161aeed31b20df8f69d27ae71902ae2e678328b82e511881d9a5560932619234bbe7d |
26 |
DIST python-gentoo-patches-3.7.10_p4.tar.xz 17076 BLAKE2B 628d82f5fc24ee68b4d529ab6d2fcaf7361d55a99dccd699a2fd027e86a731e641ff1573c7639d3d513b2030f8e8629adab84c13a9dd1ba5e2a84bdb16e92c44 SHA512 856ff2e3a73d56888bc1a3b2a28e2ca284a2a40ac3df4d060616fee47e95052b535e697d1d77c58ed850da105c7accfe3093a41492e63f6642349f7a6c80a3ea |
27 |
DIST python-gentoo-patches-3.7.10_p6.tar.xz 23868 BLAKE2B 3b3786030a461d06a96dbe0987d05c35215bb5e7b0b95e1337a05a311ad6f3c6db68cc7082128c56eea3eff4b98f74d213dde1f48517e07791815b73dcdcd5b8 SHA512 b817a9bc1469675c14555ce50bb004e8c1426465997a72a94859ab10df7c2a036b33b332c9e6b9f49df1addd899a37afd28fe60bf6ce90b4b21f4a28a27aca25 |
28 |
|
29 |
diff --git a/dev-lang/python/python-3.6.13_p5.ebuild b/dev-lang/python/python-3.6.13_p5.ebuild |
30 |
new file mode 100644 |
31 |
index 00000000000..bbce0c2bb3a |
32 |
--- /dev/null |
33 |
+++ b/dev-lang/python/python-3.6.13_p5.ebuild |
34 |
@@ -0,0 +1,338 @@ |
35 |
+# Copyright 1999-2021 Gentoo Authors |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI="7" |
39 |
+WANT_LIBTOOL="none" |
40 |
+ |
41 |
+inherit autotools flag-o-matic multiprocessing pax-utils \ |
42 |
+ python-utils-r1 toolchain-funcs verify-sig |
43 |
+ |
44 |
+MY_P="Python-${PV%_p*}" |
45 |
+PYVER=$(ver_cut 1-2) |
46 |
+PATCHSET="python-gentoo-patches-${PV}" |
47 |
+ |
48 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
49 |
+HOMEPAGE="https://www.python.org/" |
50 |
+SRC_URI="https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz |
51 |
+ https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz |
52 |
+ verify-sig? ( |
53 |
+ https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz.asc |
54 |
+ )" |
55 |
+S="${WORKDIR}/${MY_P}" |
56 |
+ |
57 |
+LICENSE="PSF-2" |
58 |
+SLOT="${PYVER}/${PYVER}m" |
59 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86" |
60 |
+IUSE="bluetooth build examples gdbm hardened ipv6 +ncurses +readline +sqlite +ssl test +threads tk wininst +xml" |
61 |
+RESTRICT="!test? ( test )" |
62 |
+ |
63 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
64 |
+# If you need to apply a patch which requires python for bootstrapping, please |
65 |
+# run the bootstrap code on your dev box and include the results in the |
66 |
+# patchset. See bug 447752. |
67 |
+ |
68 |
+RDEPEND="app-arch/bzip2:= |
69 |
+ app-arch/xz-utils:= |
70 |
+ dev-libs/libffi:= |
71 |
+ >=sys-libs/zlib-1.1.3:= |
72 |
+ virtual/libcrypt:= |
73 |
+ virtual/libintl |
74 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
75 |
+ ncurses? ( >=sys-libs/ncurses-5.2:= ) |
76 |
+ readline? ( >=sys-libs/readline-4.1:= ) |
77 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
78 |
+ ssl? ( dev-libs/openssl:= ) |
79 |
+ tk? ( |
80 |
+ >=dev-lang/tcl-8.0:= |
81 |
+ >=dev-lang/tk-8.0:= |
82 |
+ dev-tcltk/blt:= |
83 |
+ dev-tcltk/tix |
84 |
+ ) |
85 |
+ xml? ( >=dev-libs/expat-2.1:= )" |
86 |
+# bluetooth requires headers from bluez |
87 |
+DEPEND="${RDEPEND} |
88 |
+ bluetooth? ( net-wireless/bluez ) |
89 |
+ test? ( app-arch/xz-utils[extra-filters(+)] )" |
90 |
+BDEPEND=" |
91 |
+ virtual/pkgconfig |
92 |
+ verify-sig? ( app-crypt/openpgp-keys-python ) |
93 |
+ !sys-devel/gcc[libffi(-)]" |
94 |
+PDEPEND="app-eselect/eselect-python" |
95 |
+RDEPEND+=" !build? ( app-misc/mime-types )" |
96 |
+ |
97 |
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/python.org.asc |
98 |
+ |
99 |
+src_unpack() { |
100 |
+ if use verify-sig; then |
101 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} |
102 |
+ fi |
103 |
+ default |
104 |
+} |
105 |
+ |
106 |
+src_prepare() { |
107 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
108 |
+ rm -fr Modules/expat || die |
109 |
+ rm -fr Modules/_ctypes/libffi* || die |
110 |
+ rm -fr Modules/zlib || die |
111 |
+ |
112 |
+ local PATCHES=( |
113 |
+ "${WORKDIR}/${PATCHSET}" |
114 |
+ ) |
115 |
+ |
116 |
+ default |
117 |
+ |
118 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
119 |
+ Lib/distutils/command/install.py \ |
120 |
+ Lib/distutils/sysconfig.py \ |
121 |
+ Lib/site.py \ |
122 |
+ Lib/sysconfig.py \ |
123 |
+ Lib/test/test_site.py \ |
124 |
+ Makefile.pre.in \ |
125 |
+ Modules/Setup.dist \ |
126 |
+ Modules/getpath.c \ |
127 |
+ configure.ac \ |
128 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
129 |
+ |
130 |
+ # force correct number of jobs |
131 |
+ # https://bugs.gentoo.org/737660 |
132 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
133 |
+ sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die |
134 |
+ |
135 |
+ eautoreconf |
136 |
+} |
137 |
+ |
138 |
+src_configure() { |
139 |
+ local disable |
140 |
+ # disable automagic bluetooth headers detection |
141 |
+ use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no |
142 |
+ use gdbm || disable+=" gdbm" |
143 |
+ use ncurses || disable+=" _curses _curses_panel" |
144 |
+ use readline || disable+=" readline" |
145 |
+ use sqlite || disable+=" _sqlite3" |
146 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
147 |
+ use tk || disable+=" _tkinter" |
148 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
149 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
150 |
+ |
151 |
+ if ! use xml; then |
152 |
+ ewarn "You have configured Python without XML support." |
153 |
+ ewarn "This is NOT a recommended configuration as you" |
154 |
+ ewarn "may face problems parsing any XML documents." |
155 |
+ fi |
156 |
+ |
157 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
158 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
159 |
+ fi |
160 |
+ |
161 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
162 |
+ append-flags -fwrapv |
163 |
+ fi |
164 |
+ |
165 |
+ filter-flags -malign-double |
166 |
+ |
167 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
168 |
+ if is-flagq -O3; then |
169 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
170 |
+ use hardened && replace-flags -O3 -O2 |
171 |
+ fi |
172 |
+ |
173 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
174 |
+ tc-export CXX |
175 |
+ |
176 |
+ local dbmliborder |
177 |
+ if use gdbm; then |
178 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
179 |
+ fi |
180 |
+ |
181 |
+ local myeconfargs=( |
182 |
+ # glibc-2.30 removes it; since we can't cleanly force-rebuild |
183 |
+ # Python on glibc upgrade, remove it proactively to give |
184 |
+ # a chance for users rebuilding python before glibc |
185 |
+ ac_cv_header_stropts_h=no |
186 |
+ |
187 |
+ --with-fpectl |
188 |
+ --enable-shared |
189 |
+ $(use_enable ipv6) |
190 |
+ $(use_with threads) |
191 |
+ --infodir='${prefix}/share/info' |
192 |
+ --mandir='${prefix}/share/man' |
193 |
+ --with-computed-gotos |
194 |
+ --with-dbmliborder="${dbmliborder}" |
195 |
+ --with-libc= |
196 |
+ --enable-loadable-sqlite-extensions |
197 |
+ --without-ensurepip |
198 |
+ --with-system-expat |
199 |
+ --with-system-ffi |
200 |
+ ) |
201 |
+ |
202 |
+ OPT="" econf "${myeconfargs[@]}" |
203 |
+ |
204 |
+ if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
205 |
+ eerror "configure has detected that the sem_open function is broken." |
206 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
207 |
+ die "Broken sem_open function (bug 496328)" |
208 |
+ fi |
209 |
+} |
210 |
+ |
211 |
+src_compile() { |
212 |
+ # Ensure sed works as expected |
213 |
+ # https://bugs.gentoo.org/594768 |
214 |
+ local -x LC_ALL=C |
215 |
+ |
216 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
217 |
+ |
218 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
219 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
220 |
+ pax-mark E python |
221 |
+ else |
222 |
+ pax-mark m python |
223 |
+ fi |
224 |
+} |
225 |
+ |
226 |
+src_test() { |
227 |
+ # Tests will not work when cross compiling. |
228 |
+ if tc-is-cross-compiler; then |
229 |
+ elog "Disabling tests due to crosscompiling." |
230 |
+ return |
231 |
+ fi |
232 |
+ |
233 |
+ # Skip failing tests. |
234 |
+ local skipped_tests="gdb faulthandler" |
235 |
+ |
236 |
+ for test in ${skipped_tests}; do |
237 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
238 |
+ done |
239 |
+ |
240 |
+ # bug 660358 |
241 |
+ local -x COLUMNS=80 |
242 |
+ local -x PYTHONDONTWRITEBYTECODE= |
243 |
+ |
244 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
245 |
+ |
246 |
+ emake test EXTRATESTOPTS="-u-network -j${jobs}" \ |
247 |
+ CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
248 |
+ local result=$? |
249 |
+ |
250 |
+ for test in ${skipped_tests}; do |
251 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
252 |
+ done |
253 |
+ |
254 |
+ elog "The following tests have been skipped:" |
255 |
+ for test in ${skipped_tests}; do |
256 |
+ elog "test_${test}.py" |
257 |
+ done |
258 |
+ |
259 |
+ elog "If you would like to run them, you may:" |
260 |
+ elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'" |
261 |
+ elog "and run the tests separately." |
262 |
+ |
263 |
+ if [[ ${result} -ne 0 ]]; then |
264 |
+ die "emake test failed" |
265 |
+ fi |
266 |
+} |
267 |
+ |
268 |
+src_install() { |
269 |
+ local libdir=${ED}/usr/$(get_libdir)/python${PYVER} |
270 |
+ |
271 |
+ emake DESTDIR="${D}" altinstall |
272 |
+ |
273 |
+ # Remove static library |
274 |
+ rm "${ED}"/usr/$(get_libdir)/libpython*.a || die |
275 |
+ |
276 |
+ sed \ |
277 |
+ -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ |
278 |
+ -e "s/\(PY_LDFLAGS=\).*/\1/" \ |
279 |
+ -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" |
280 |
+ |
281 |
+ # Fix collisions between different slots of Python. |
282 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
283 |
+ |
284 |
+ # Cheap hack to get version with ABIFLAGS |
285 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
286 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
287 |
+ # Replace python3.X with a symlink to python3.Xm |
288 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
289 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
290 |
+ # Create python3.X-config symlink |
291 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
292 |
+ # Create python-3.5m.pc symlink |
293 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
294 |
+ fi |
295 |
+ |
296 |
+ # python seems to get rebuilt in src_install (bug 569908) |
297 |
+ # Work around it for now. |
298 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
299 |
+ pax-mark E "${ED}/usr/bin/${abiver}" |
300 |
+ else |
301 |
+ pax-mark m "${ED}/usr/bin/${abiver}" |
302 |
+ fi |
303 |
+ |
304 |
+ use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
305 |
+ use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
306 |
+ |
307 |
+ use threads || rm -r "${libdir}/multiprocessing" || die |
308 |
+ use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die |
309 |
+ |
310 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
311 |
+ |
312 |
+ if use examples; then |
313 |
+ docinto examples |
314 |
+ find Tools -name __pycache__ -exec rm -fr {} + || die |
315 |
+ dodoc -r Tools |
316 |
+ fi |
317 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
318 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
319 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
320 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
321 |
+ |
322 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
323 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
324 |
+ sed \ |
325 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
326 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
327 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
328 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
329 |
+ |
330 |
+ local -x EPYTHON=python${PYVER} |
331 |
+ # if not using a cross-compiler, use the fresh binary |
332 |
+ if ! tc-is-cross-compiler; then |
333 |
+ local -x PYTHON=./python |
334 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} |
335 |
+ else |
336 |
+ local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} |
337 |
+ fi |
338 |
+ |
339 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
340 |
+ python_domodule epython.py |
341 |
+ |
342 |
+ # python-exec wrapping support |
343 |
+ local pymajor=${PYVER%.*} |
344 |
+ local scriptdir=${D}$(python_get_scriptdir) |
345 |
+ mkdir -p "${scriptdir}" || die |
346 |
+ # python and pythonX |
347 |
+ ln -s "../../../bin/${abiver}" \ |
348 |
+ "${scriptdir}/python${pymajor}" || die |
349 |
+ ln -s "python${pymajor}" "${scriptdir}/python" || die |
350 |
+ # python-config and pythonX-config |
351 |
+ # note: we need to create a wrapper rather than symlinking it due |
352 |
+ # to some random dirname(argv[0]) magic performed by python-config |
353 |
+ cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die |
354 |
+ #!/bin/sh |
355 |
+ exec "${abiver}-config" "\${@}" |
356 |
+ EOF |
357 |
+ chmod +x "${scriptdir}/python${pymajor}-config" || die |
358 |
+ ln -s "python${pymajor}-config" \ |
359 |
+ "${scriptdir}/python-config" || die |
360 |
+ # 2to3, pydoc, pyvenv |
361 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
362 |
+ "${scriptdir}/2to3" || die |
363 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
364 |
+ "${scriptdir}/pydoc" || die |
365 |
+ ln -s "../../../bin/pyvenv-${PYVER}" \ |
366 |
+ "${scriptdir}/pyvenv" || die |
367 |
+ # idle |
368 |
+ if use tk; then |
369 |
+ ln -s "../../../bin/idle${PYVER}" \ |
370 |
+ "${scriptdir}/idle" || die |
371 |
+ fi |
372 |
+} |