Gentoo Archives: gentoo-commits

From: "Arfrever Frehtes Taifersar Arahesis (arfrever)" <arfrever@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/python: ChangeLog python-2.6.6-r2.ebuild
Date: Mon, 21 Feb 2011 22:13:56
Message-Id: 20110221221345.7BDAB20054@flycatcher.gentoo.org
1 arfrever 11/02/21 22:13:45
2
3 Modified: ChangeLog
4 Added: python-2.6.6-r2.ebuild
5 Log:
6 Fix DoS vulnerability in smtpd (Python issue #9129). Fix regression in unicodedata.normalize() (Python issue #10254). Don't skip test_ctypes tests on hardened/PAX (Gentoo bug #348745).
7
8 (Portage version: 2.2.0_alpha24_p17/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.517 dev-lang/python/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?rev=1.517&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?rev=1.517&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?r1=1.516&r2=1.517
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v
20 retrieving revision 1.516
21 retrieving revision 1.517
22 diff -u -r1.516 -r1.517
23 --- ChangeLog 20 Feb 2011 12:27:45 -0000 1.516
24 +++ ChangeLog 21 Feb 2011 22:13:45 -0000 1.517
25 @@ -1,6 +1,14 @@
26 # ChangeLog for dev-lang/python
27 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.516 2011/02/20 12:27:45 armin76 Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.517 2011/02/21 22:13:45 arfrever Exp $
30 +
31 +*python-2.6.6-r2 (21 Feb 2011)
32 +
33 + 21 Feb 2011; Arfrever Frehtes Taifersar Arahesis <arfrever@g.o>
34 + +python-2.6.6-r2.ebuild:
35 + Fix DoS vulnerability in smtpd (Python issue #9129). Fix regression in
36 + unicodedata.normalize() (Python issue #10254). Don't skip test_ctypes tests
37 + on hardened/PAX (Gentoo bug #348745).
38
39 20 Feb 2011; Raúl Porcel <armin76@g.o> python-2.6.6-r1.ebuild:
40 ia64/m68k/s390/sh/sparc stable wrt #342927
41
42
43
44 1.1 dev-lang/python/python-2.6.6-r2.ebuild
45
46 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.6.6-r2.ebuild?rev=1.1&view=markup
47 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.6.6-r2.ebuild?rev=1.1&content-type=text/plain
48
49 Index: python-2.6.6-r2.ebuild
50 ===================================================================
51 # Copyright 1999-2011 Gentoo Foundation
52 # Distributed under the terms of the GNU General Public License v2
53 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.6.6-r2.ebuild,v 1.1 2011/02/21 22:13:45 arfrever Exp $
54
55 EAPI="2"
56 WANT_AUTOMAKE="none"
57
58 inherit autotools eutils flag-o-matic multilib python toolchain-funcs
59
60 if [[ "${PV}" == *_pre* ]]; then
61 inherit subversion
62
63 ESVN_PROJECT="python"
64 ESVN_REPO_URI="http://svn.python.org/projects/python/branches/release26-maint"
65 ESVN_REVISION=""
66 else
67 MY_PV="${PV%_p*}"
68 MY_P="Python-${MY_PV}"
69 fi
70
71 PATCHSET_REVISION="2"
72
73 DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
74 HOMEPAGE="http://www.python.org/"
75 if [[ "${PV}" == *_pre* ]]; then
76 SRC_URI=""
77 else
78 SRC_URI="http://www.python.org/ftp/python/${MY_PV}/${MY_P}.tar.bz2
79 mirror://gentoo/python-gentoo-patches-${MY_PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2"
80 fi
81
82 LICENSE="PSF-2.2"
83 SLOT="2.6"
84 PYTHON_ABI="${SLOT}"
85 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
86 IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
87
88 RDEPEND=">=app-admin/eselect-python-20091230
89 >=sys-libs/zlib-1.1.3
90 virtual/libffi
91 virtual/libintl
92 !build? (
93 berkdb? ( || (
94 sys-libs/db:4.7
95 sys-libs/db:4.6
96 sys-libs/db:4.5
97 sys-libs/db:4.4
98 sys-libs/db:4.3
99 sys-libs/db:4.2
100 ) )
101 gdbm? ( sys-libs/gdbm )
102 ncurses? (
103 >=sys-libs/ncurses-5.2
104 readline? ( >=sys-libs/readline-4.1 )
105 )
106 sqlite? ( >=dev-db/sqlite-3 )
107 ssl? ( dev-libs/openssl )
108 tk? ( >=dev-lang/tk-8.0 )
109 xml? ( >=dev-libs/expat-2 )
110 )
111 !!<sys-apps/portage-2.1.9"
112 DEPEND="${RDEPEND}
113 $([[ "${PV}" == *_pre* ]] && echo "=${CATEGORY}/${PN}-${PV%%.*}*")
114 dev-util/pkgconfig
115 $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] && echo "doc? ( dev-python/sphinx )")
116 !sys-devel/gcc[libffi]"
117 RDEPEND+=" !build? ( app-misc/mime-types )
118 $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] || echo "doc? ( dev-python/python-docs:${SLOT} )")"
119 PDEPEND="app-admin/python-updater"
120
121 PROVIDE="virtual/python"
122
123 if [[ "${PV}" != *_pre* ]]; then
124 S="${WORKDIR}/${MY_P}"
125 fi
126
127 pkg_setup() {
128 python_pkg_setup
129
130 if use berkdb; then
131 ewarn "\"bsddb\" module is out-of-date and no longer maintained inside dev-lang/python. It has"
132 ewarn "been additionally removed in Python 3. You should use external, still maintained \"bsddb3\""
133 ewarn "module provided by dev-python/bsddb3 which supports both Python 2 and Python 3."
134 fi
135 }
136
137 src_prepare() {
138 # Ensure that internal copies of expat, libffi and zlib are not used.
139 rm -fr Modules/expat
140 rm -fr Modules/_ctypes/libffi*
141 rm -fr Modules/zlib
142
143 if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+_pre ]]; then
144 if grep -Eq '#define PY_RELEASE_LEVEL[[:space:]]+PY_RELEASE_LEVEL_FINAL' Include/patchlevel.h; then
145 # Update micro version, release level and version string.
146 local micro_version="${PV%_pre*}"
147 micro_version="${micro_version##*.}"
148 local version_string="${PV%.*}.$((${micro_version} - 1))+"
149 sed \
150 -e "s/\(#define PY_MICRO_VERSION[[:space:]]\+\)[^[:space:]]\+/\1${micro_version}/" \
151 -e "s/\(#define PY_RELEASE_LEVEL[[:space:]]\+\)[^[:space:]]\+/\1PY_RELEASE_LEVEL_ALPHA/" \
152 -e "s/\(#define PY_VERSION[[:space:]]\+\"\)[^\"]\+\(\"\)/\1${version_string}\2/" \
153 -i Include/patchlevel.h || die "sed failed"
154 fi
155 fi
156
157 local excluded_patches
158 if ! tc-is-cross-compiler; then
159 excluded_patches="*_all_crosscompile.patch"
160 fi
161
162 local patchset_dir
163 if [[ "${PV}" == *_pre* ]]; then
164 patchset_dir="${FILESDIR}/${SLOT}-${PATCHSET_REVISION}"
165 else
166 patchset_dir="${WORKDIR}/${MY_PV}"
167 fi
168
169 EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" epatch "${patchset_dir}"
170
171 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
172 Lib/distutils/command/install.py \
173 Lib/distutils/sysconfig.py \
174 Lib/site.py \
175 Makefile.pre.in \
176 Modules/Setup.dist \
177 Modules/getpath.c \
178 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
179
180 if ! use wininst; then
181 # Remove Microsoft Windows executables.
182 rm Lib/distutils/command/wininst-*.exe
183 fi
184
185 eautoreconf
186 }
187
188 src_configure() {
189 if use build; then
190 # Disable extraneous modules with extra dependencies.
191 export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
192 export PYTHON_DISABLE_SSL="1"
193 else
194 # dbm module can be linked against berkdb or gdbm.
195 # Defaults to gdbm when both are enabled, #204343.
196 local disable
197 use berkdb || use gdbm || disable+=" dbm"
198 use berkdb || disable+=" _bsddb"
199 use gdbm || disable+=" gdbm"
200 use ncurses || disable+=" _curses _curses_panel"
201 use readline || disable+=" readline"
202 use sqlite || disable+=" _sqlite3"
203 use ssl || export PYTHON_DISABLE_SSL="1"
204 use tk || disable+=" _tkinter"
205 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
206 export PYTHON_DISABLE_MODULES="${disable}"
207
208 if ! use xml; then
209 ewarn "You have configured Python without XML support."
210 ewarn "This is NOT a recommended configuration as you"
211 ewarn "may face problems parsing any XML documents."
212 fi
213 fi
214
215 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
216 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
217 fi
218
219 if [[ "$(gcc-major-version)" -ge 4 ]]; then
220 append-flags -fwrapv
221 fi
222
223 filter-flags -malign-double
224
225 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
226
227 # https://bugs.gentoo.org/show_bug.cgi?id=50309
228 if is-flagq -O3; then
229 is-flagq -fstack-protector-all && replace-flags -O3 -O2
230 use hardened && replace-flags -O3 -O2
231 fi
232
233 if tc-is-cross-compiler; then
234 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
235 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
236 emake python Parser/pgen || die "cross-make failed"
237 mv python hostpython
238 mv Parser/pgen Parser/hostpgen
239 make distclean
240 sed -i \
241 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
242 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
243 Makefile.pre.in || die "sed failed"
244 fi
245
246 # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
247 tc-export CXX
248
249 # Set LDFLAGS so we link modules with -lpython2.6 correctly.
250 # Needed on FreeBSD unless Python 2.6 is already installed.
251 # Please query BSD team before removing this!
252 append-ldflags "-L."
253
254 OPT="" econf \
255 --with-fpectl \
256 --enable-shared \
257 $(use_enable ipv6) \
258 $(use_with threads) \
259 $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
260 --infodir='${prefix}/share/info' \
261 --mandir='${prefix}/share/man' \
262 --with-libc="" \
263 --with-system-ffi
264 }
265
266 src_compile() {
267 emake EPYTHON="python${PV%%.*}" || die "emake failed"
268 }
269
270 src_test() {
271 # Tests will not work when cross compiling.
272 if tc-is-cross-compiler; then
273 elog "Disabling tests due to crosscompiling."
274 return
275 fi
276
277 # Byte compiling should be enabled here.
278 # Otherwise test_import fails.
279 python_enable_pyc
280
281 # Skip failing tests.
282 local skip_tests="distutils httpservers minidom pyexpat sax tcl"
283
284 for test in ${skip_tests}; do
285 mv "${S}/Lib/test/test_${test}.py" "${T}"
286 done
287
288 # Rerun failed tests in verbose mode (regrtest -w).
289 emake test EXTRATESTOPTS="-w" < /dev/tty
290 local result="$?"
291
292 for test in ${skip_tests}; do
293 mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py"
294 done
295
296 elog "The following tests have been skipped:"
297 for test in ${skip_tests}; do
298 elog "test_${test}.py"
299 done
300
301 elog "If you would like to run them, you may:"
302 elog "cd '${EPREFIX}$(python_get_libdir)/test'"
303 elog "and run the tests separately."
304
305 python_disable_pyc
306
307 if [[ "${result}" -ne 0 ]]; then
308 die "emake test failed"
309 fi
310 }
311
312 src_install() {
313 [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/"
314
315 emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
316 python_clean_installation_image -q
317
318 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
319
320 # Fix collisions between different slots of Python.
321 mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
322 mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
323 mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
324 mv "${ED}usr/share/man/man1/python.1" "${ED}usr/share/man/man1/python${SLOT}.1"
325 rm -f "${ED}usr/bin/smtpd.py"
326
327 if use build; then
328 rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{bsddb,idlelib,lib-tk,sqlite3,test}
329 else
330 use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/"{bsddb/test,test}
331 use berkdb || rm -fr "${ED}$(python_get_libdir)/"{bsddb,test/test_bsddb*}
332 use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
333 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,lib-tk}
334 fi
335
336 use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing"
337
338 prep_ml_includes $(python_get_includedir)
339
340 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
341
342 if use examples; then
343 insinto /usr/share/doc/${PF}/examples
344 doins -r "${S}/Tools" || die "doins failed"
345 fi
346
347 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
348 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
349
350 # Do not install empty directory.
351 rmdir "${ED}$(python_get_libdir)/lib-old"
352 }
353
354 pkg_preinst() {
355 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.6" && ! has_version "${CATEGORY}/${PN}:2.7"; then
356 python_updater_warning="1"
357 fi
358 }
359
360 eselect_python_update() {
361 [[ -z "${EROOT}" ]] && EROOT="${ROOT%/}${EPREFIX}/"
362
363 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
364 eselect python update
365 fi
366
367 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
368 eselect python update --python${PV%%.*}
369 fi
370 }
371
372 pkg_postinst() {
373 eselect_python_update
374
375 python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir)
376
377 if [[ "${python_updater_warning}" == "1" ]]; then
378 ewarn
379 ewarn "\e[1;31m************************************************************************\e[0m"
380 ewarn
381 ewarn "You have just upgraded from an older version of Python."
382 ewarn "You should run 'python-updater \${options}' to rebuild Python modules."
383 ewarn
384 ewarn "\e[1;31m************************************************************************\e[0m"
385 ewarn
386 ebeep 12
387 fi
388 }
389
390 pkg_postrm() {
391 eselect_python_update
392
393 python_mod_cleanup $(python_get_libdir)
394 }