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