Gentoo Archives: gentoo-commits

From: "Brian Dolbec (dolsen)" <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-apps/portage: portage-2.2.14_rc1.ebuild portage-2.2.8-r2.ebuild portage-9999.ebuild ChangeLog portage-2.1.12.2.ebuild portage-2.2.8-r1.ebuild
Date: Fri, 26 Sep 2014 20:32:10
Message-Id: 20140926203203.E835A659C@oystercatcher.gentoo.org
1 dolsen 14/09/26 20:32:03
2
3 Modified: portage-2.2.14_rc1.ebuild portage-9999.ebuild
4 ChangeLog
5 Added: portage-2.2.8-r2.ebuild
6 Removed: portage-2.1.12.2.ebuild portage-2.2.8-r1.ebuild
7 Log:
8 Update bash dep, bug 523768, remove 1 more old version
9
10 (Portage version: 2.2.14_rc1/cvs/Linux x86_64, RepoMan options: --force, signed Manifest commit with key 0x65E309F2189DB0B8)
11
12 Revision Changes Path
13 1.2 sys-apps/portage/portage-2.2.14_rc1.ebuild
14
15 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.2.14_rc1.ebuild?rev=1.2&view=markup
16 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.2.14_rc1.ebuild?rev=1.2&content-type=text/plain
17 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.2.14_rc1.ebuild?r1=1.1&r2=1.2
18
19 Index: portage-2.2.14_rc1.ebuild
20 ===================================================================
21 RCS file: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.14_rc1.ebuild,v
22 retrieving revision 1.1
23 retrieving revision 1.2
24 diff -u -r1.1 -r1.2
25 --- portage-2.2.14_rc1.ebuild 26 Sep 2014 18:58:45 -0000 1.1
26 +++ portage-2.2.14_rc1.ebuild 26 Sep 2014 20:32:03 -0000 1.2
27 @@ -1,6 +1,6 @@
28 # Copyright 1999-2014 Gentoo Foundation
29 # Distributed under the terms of the GNU General Public License v2
30 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.14_rc1.ebuild,v 1.1 2014/09/26 18:58:45 dolsen Exp $
31 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.14_rc1.ebuild,v 1.2 2014/09/26 20:32:03 dolsen Exp $
32
33 EAPI=5
34
35 @@ -38,7 +38,7 @@
36 dev-lang/python-exec:2
37 !build? (
38 >=sys-apps/sed-4.0.5
39 - || ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
40 + app-shells/bash:0[readline]
41 >=app-admin/eselect-1.2
42 )
43 elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
44 @@ -51,7 +51,6 @@
45 $(python_gen_cond_dep 'dev-python/pyxattr[${PYTHON_USEDEP}]' \
46 python{2_7,3_2} pypy)
47 ) )
48 - !<app-shells/bash-3.2_p17
49 !<app-admin/logrotate-3.8.0"
50 PDEPEND="
51 !build? (
52
53
54
55 1.105 sys-apps/portage/portage-9999.ebuild
56
57 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-9999.ebuild?rev=1.105&view=markup
58 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-9999.ebuild?rev=1.105&content-type=text/plain
59 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-9999.ebuild?r1=1.104&r2=1.105
60
61 Index: portage-9999.ebuild
62 ===================================================================
63 RCS file: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-9999.ebuild,v
64 retrieving revision 1.104
65 retrieving revision 1.105
66 diff -u -r1.104 -r1.105
67 --- portage-9999.ebuild 26 Sep 2014 18:58:45 -0000 1.104
68 +++ portage-9999.ebuild 26 Sep 2014 20:32:03 -0000 1.105
69 @@ -1,6 +1,6 @@
70 # Copyright 1999-2014 Gentoo Foundation
71 # Distributed under the terms of the GNU General Public License v2
72 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-9999.ebuild,v 1.104 2014/09/26 18:58:45 dolsen Exp $
73 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-9999.ebuild,v 1.105 2014/09/26 20:32:03 dolsen Exp $
74
75 EAPI=5
76
77 @@ -38,7 +38,7 @@
78 dev-lang/python-exec:2
79 !build? (
80 >=sys-apps/sed-4.0.5
81 - || ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) )
82 + app-shells/bash:0[readline]
83 >=app-admin/eselect-1.2
84 )
85 elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
86 @@ -51,7 +51,6 @@
87 $(python_gen_cond_dep 'dev-python/pyxattr[${PYTHON_USEDEP}]' \
88 python{2_7,3_2} pypy)
89 ) )
90 - !<app-shells/bash-3.2_p17
91 !<app-admin/logrotate-3.8.0"
92 PDEPEND="
93 !build? (
94
95
96
97 1.1413 sys-apps/portage/ChangeLog
98
99 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/ChangeLog?rev=1.1413&view=markup
100 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/ChangeLog?rev=1.1413&content-type=text/plain
101 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/ChangeLog?r1=1.1412&r2=1.1413
102
103 Index: ChangeLog
104 ===================================================================
105 RCS file: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v
106 retrieving revision 1.1412
107 retrieving revision 1.1413
108 diff -u -r1.1412 -r1.1413
109 --- ChangeLog 26 Sep 2014 18:58:45 -0000 1.1412
110 +++ ChangeLog 26 Sep 2014 20:32:03 -0000 1.1413
111 @@ -1,6 +1,13 @@
112 # ChangeLog for sys-apps/portage
113 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
114 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.1412 2014/09/26 18:58:45 dolsen Exp $
115 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.1413 2014/09/26 20:32:03 dolsen Exp $
116 +
117 +*portage-2.2.8-r2 (26 Sep 2014)
118 +
119 + 26 Sep 2014; Brian Dolbec <dolsen@g.o> -portage-2.1.12.2.ebuild,
120 + -portage-2.2.8-r1.ebuild, +portage-2.2.8-r2.ebuild,
121 + portage-2.2.14_rc1.ebuild, portage-9999.ebuild:
122 + Update the bash dep bug # 523768, remove 1 more old version
123
124 *portage-2.2.14_rc1 (26 Sep 2014)
125
126
127
128
129 1.1 sys-apps/portage/portage-2.2.8-r2.ebuild
130
131 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.2.8-r2.ebuild?rev=1.1&view=markup
132 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.2.8-r2.ebuild?rev=1.1&content-type=text/plain
133
134 Index: portage-2.2.8-r2.ebuild
135 ===================================================================
136 # Copyright 1999-2014 Gentoo Foundation
137 # Distributed under the terms of the GNU General Public License v2
138 # $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.8-r2.ebuild,v 1.1 2014/09/26 20:32:03 dolsen Exp $
139
140 # Require EAPI 2 since we now require at least python-2.6 (for python 3
141 # syntax support) which also requires EAPI 2.
142 EAPI=2
143 PYTHON_COMPAT=(
144 pypy2_0
145 python3_2 python3_3 python3_4
146 python2_6 python2_7
147 )
148 inherit eutils multilib
149
150 DESCRIPTION="Portage is the package management and distribution system for Gentoo"
151 HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
152 LICENSE="GPL-2"
153 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
154 SLOT="0"
155 IUSE="build doc epydoc +ipc linguas_ru pypy2_0 python2 python3 selinux xattr"
156
157 for _pyimpl in ${PYTHON_COMPAT[@]} ; do
158 IUSE+=" python_targets_${_pyimpl}"
159 done
160 unset _pyimpl
161
162 # Import of the io module in python-2.6 raises ImportError for the
163 # thread module if threading is disabled.
164 python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] )
165 !pypy2_0? ( !python2? ( !python3? (
166 || ( >=dev-lang/python-2.7[ssl] dev-lang/python:2.6[threads,ssl] )
167 ) ) )
168 pypy2_0? ( !python2? ( !python3? ( virtual/pypy:2.0[bzip2] ) ) )
169 python2? ( !python3? ( || ( dev-lang/python:2.7[ssl] dev-lang/python:2.6[ssl,threads] ) ) )"
170 python_dep="${python_dep_ssl//\[ssl\]}"
171 python_dep="${python_dep//,ssl}"
172 python_dep="${python_dep//ssl,}"
173
174 python_dep="${python_dep}
175 python_targets_pypy2_0? ( virtual/pypy:2.0 )
176 python_targets_python2_6? ( dev-lang/python:2.6 )
177 python_targets_python2_7? ( dev-lang/python:2.7 )
178 python_targets_python3_2? ( dev-lang/python:3.2 )
179 python_targets_python3_3? ( dev-lang/python:3.3 )
180 python_targets_python3_4? ( dev-lang/python:3.4 )
181 "
182
183 # The pysqlite blocker is for bug #282760.
184 # make-3.82 is for bug #455858
185 DEPEND="${python_dep}
186 >=sys-devel/make-3.82
187 >=sys-apps/sed-4.0.5 sys-devel/patch
188 doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
189 epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
190 # Require sandbox-2.2 for bug #288863.
191 # For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's
192 # quite slow, so it's not considered in the dependencies as an alternative to
193 # to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so
194 # for now, don't pull in xattr deps for other kernels.
195 # For whirlpool hash, require python[ssl] or python-mhash (bug #425046).
196 # For compgen, require bash[readline] (bug #445576).
197 RDEPEND="${python_dep}
198 !build? ( >=sys-apps/sed-4.0.5
199 app-shells/bash:0[readline]
200 >=app-admin/eselect-1.2
201 || ( ${python_dep_ssl} dev-python/python-mhash )
202 )
203 elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
204 elibc_glibc? ( >=sys-apps/sandbox-2.2 )
205 elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
206 >=app-misc/pax-utils-0.1.17
207 selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
208 xattr? ( kernel_linux? (
209 $(for python_impl in python{2_6,2_7,3_2} pypy2_0; do
210 echo "python_targets_${python_impl}? ( dev-python/pyxattr[python_targets_${python_impl}] )"
211 done) ) )
212 !<app-admin/logrotate-3.8.0"
213 PDEPEND="
214 !build? (
215 >=net-misc/rsync-2.6.4
216 userland_GNU? ( >=sys-apps/coreutils-6.4 )
217 )"
218 # coreutils-6.4 rdep is for date format in emerge-webrsync #164532
219 # NOTE: FEATURES=installsources requires debugedit and rsync
220
221 SRC_ARCHIVES="http://dev.gentoo.org/~dolsen/releases/portage"
222
223 prefix_src_archives() {
224 local x y
225 for x in ${@}; do
226 for y in ${SRC_ARCHIVES}; do
227 echo ${y}/${x}
228 done
229 done
230 }
231
232 PV_PL="2.1.2"
233 PATCHVER_PL=""
234 TARBALL_PV=${PV}
235 SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
236 $(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)"
237
238 PATCHVER=
239 [[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
240 if [ -n "${PATCHVER}" ]; then
241 SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
242 $(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
243 fi
244
245 S="${WORKDIR}"/${PN}-${TARBALL_PV}
246 S_PL="${WORKDIR}"/${PN}-${PV_PL}
247
248 compatible_python_is_selected() {
249 [[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
250 }
251
252 current_python_has_xattr() {
253 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
254 local PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
255 [[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
256 "${PYTHON}" -c 'import xattr' 2>/dev/null
257 }
258
259 call_with_python_impl() {
260 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
261 env EPYTHON=${EPYTHON} "$@"
262 }
263
264 get_python_interpreter() {
265 [ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
266 local impl=$1 python
267 case "${impl}" in
268 python*)
269 python=${impl/_/.}
270 ;;
271 pypy*)
272 python=${impl/_/.}
273 python=${python/pypy/pypy-c}
274 ;;
275 *)
276 die "Unrecognized python target: ${impl}"
277 esac
278 echo ${python}
279 }
280
281 get_python_sitedir() {
282 [ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
283 local impl=$1
284 local site_dir=usr/$(get_libdir)/${impl/_/.}/site-packages
285 [[ -d ${EROOT:-${ROOT}}${site_dir} ]] || \
286 ewarn "site-packages dir missing for ${impl}: ${EROOT:-${ROOT}}${site_dir}"
287 echo "/${site_dir}"
288 }
289
290 python_compileall() {
291 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
292 local d=${EPREFIX}$1 PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
293 local d_image=${D}${d#/}
294 [[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
295 case "${EPYTHON}" in
296 python*)
297 "${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
298 # Note: Using -OO breaks emaint, since it requires __doc__,
299 # and __doc__ is None when -OO is used.
300 "${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
301 ;;
302 pypy*)
303 "${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
304 ;;
305 *)
306 die "Unrecognized EPYTHON value: ${EPYTHON}"
307 esac
308 }
309
310 pkg_setup() {
311 if use python2 && use python3 ; then
312 ewarn "Both python2 and python3 USE flags are enabled, but only one"
313 ewarn "can be in the shebangs. Using python3."
314 fi
315 if use pypy2_0 && use python3 ; then
316 ewarn "Both pypy2_0 and python3 USE flags are enabled, but only one"
317 ewarn "can be in the shebangs. Using python3."
318 fi
319 if use pypy2_0 && use python2 ; then
320 ewarn "Both pypy2_0 and python2 USE flags are enabled, but only one"
321 ewarn "can be in the shebangs. Using python2"
322 fi
323 if ! use pypy2_0 && ! use python2 && ! use python3 && \
324 ! compatible_python_is_selected ; then
325 ewarn "Attempting to select a compatible default python interpreter"
326 local x success=0
327 for x in "${EPREFIX}"/usr/bin/python2.* ; do
328 x=${x#${EPREFIX}/usr/bin/python2.}
329 if [[ $x -ge 6 ]] 2>/dev/null ; then
330 eselect python set python2.$x
331 if compatible_python_is_selected ; then
332 elog "Default python interpreter is now set to python-2.$x"
333 success=1
334 break
335 fi
336 fi
337 done
338 if [ $success != 1 ] ; then
339 eerror "Unable to select a compatible default python interpreter!"
340 die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
341 fi
342 fi
343
344 # We use EPYTHON to designate the active python interpreter,
345 # but we only export when needed, via call_with_python_impl.
346 EPYTHON=python
347 export -n EPYTHON
348 if use python3; then
349 EPYTHON=python3
350 elif use python2; then
351 EPYTHON=python2
352 elif use pypy2_0; then
353 EPYTHON=pypy-c2.0
354 fi
355 }
356
357 src_prepare() {
358 if [ -n "${PATCHVER}" ] ; then
359 if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
360 rm "$S/bin/ebuild-helpers/portageq" \
361 || die "failed to remove portageq helper symlink"
362 fi
363 epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
364 fi
365 einfo "Setting portage.VERSION to ${PVR} ..."
366 sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
367 die "Failed to patch portage.VERSION"
368 sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
369 die "Failed to patch VERSION in doc/fragment/version"
370 sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \
371 die "Failed to patch VERSION in man page headers"
372
373 if ! use ipc ; then
374 einfo "Disabling ipc..."
375 sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
376 -i pym/_emerge/AbstractEbuildProcess.py || \
377 die "failed to patch AbstractEbuildProcess.py"
378 fi
379
380 if use xattr && use kernel_linux ; then
381 einfo "Adding FEATURES=xattr to make.globals ..."
382 echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \
383 || die "failed to append to make.globals"
384 fi
385
386 local set_shebang=
387 if use python3; then
388 set_shebang=python3
389 elif use python2; then
390 set_shebang=python2
391 elif use pypy2_0; then
392 set_shebang=pypy-c2.0
393 fi
394 if [[ -n ${set_shebang} ]] ; then
395 einfo "Converting shebangs for ${set_shebang}..."
396 while read -r -d $'\0' ; do
397 local shebang=$(head -n1 "$REPLY")
398 if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
399 sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
400 die "sed failed"
401 fi
402 done < <(find . -type f -print0)
403 fi
404
405 if [[ -n ${EPREFIX} ]] ; then
406 einfo "Setting portage.const.EPREFIX ..."
407 sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \
408 -e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \
409 -e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \
410 -e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \
411 -e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \
412 -e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \
413 -i pym/portage/const.py || \
414 die "Failed to patch portage.const.EPREFIX"
415
416 einfo "Prefixing shebangs ..."
417 while read -r -d $'\0' ; do
418 local shebang=$(head -n1 "$REPLY")
419 if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then
420 sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \
421 die "sed failed"
422 fi
423 done < <(find . -type f -print0)
424
425 einfo "Adjusting make.globals ..."
426 sed -e "s|\(/usr/portage\)|${EPREFIX}\\1|" \
427 -e "s|^\(PORTAGE_TMPDIR=\"\)\(/var/tmp\"\)|\\1${EPREFIX}\\2|" \
428 -i cnf/make.globals || die "sed failed"
429
430 einfo "Adjusting repos.conf ..."
431 sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \
432 -e "s|^\\[gentoo\\]|[gentoo_prefix]|" \
433 -e "s|^\(location = \)\(/usr/portage\)|\\1${EPREFIX}\\2|" \
434 -e "s|^\(sync-uri = \).*|\\1rsync://prefix.gentooexperimental.org/gentoo-portage-prefix|" \
435 -i cnf/repos.conf || die "sed failed"
436
437 einfo "Adding FEATURES=force-prefix to make.globals ..."
438 echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \
439 || die "failed to append to make.globals"
440 fi
441
442 cd "${S}/cnf" || die
443 if [ -f "make.conf.example.${ARCH}".diff ]; then
444 patch make.conf.example "make.conf.example.${ARCH}".diff || \
445 die "Failed to patch make.conf.example"
446 else
447 eerror ""
448 eerror "Portage does not have an arch-specific configuration for this arch."
449 eerror "Please notify the arch maintainer about this issue. Using generic."
450 eerror ""
451 fi
452 }
453
454 src_compile() {
455 if use doc; then
456 call_with_python_impl \
457 emake docbook || die
458 fi
459
460 if use epydoc; then
461 einfo "Generating api docs"
462 call_with_python_impl \
463 emake epydoc || die
464 fi
465 }
466
467 src_test() {
468 # make files executable, in case they were created by patch
469 find bin -type f | xargs chmod +x
470 call_with_python_impl \
471 emake test || die
472 }
473
474 src_install() {
475 call_with_python_impl \
476 emake DESTDIR="${D}" \
477 sysconfdir="${EPREFIX}/etc" \
478 prefix="${EPREFIX}/usr" \
479 install || die
480
481 # Use dodoc for compression, since the Makefile doesn't do that.
482 dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die
483
484 # Allow external portage API consumers to import portage python modules
485 # (this used to be done with PYTHONPATH setting in /etc/env.d).
486 # For each of PYTHON_TARGETS, install a tree of *.py symlinks in
487 # site-packages, and compile with the corresponding interpreter.
488 local impl files mod_dir dest_mod_dir python relative_path x
489 for impl in "${PYTHON_COMPAT[@]}" ; do
490 use "python_targets_${impl}" || continue
491 if use build && [[ ${ROOT} == / &&
492 ! -x ${EPREFIX}/usr/bin/$(get_python_interpreter ${impl}) ]] ; then
493 # Tolerate --nodeps at beginning of stage1 for catalyst
494 ewarn "skipping python_targets_${impl}, interpreter not found"
495 continue
496 fi
497 while read -r mod_dir ; do
498 cd "${ED:-${D}}usr/lib/portage/pym/${mod_dir}" || die
499 files=$(echo *.py)
500 if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
501 # __pycache__ directories contain no py files
502 continue
503 fi
504 dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
505 dodir "${dest_mod_dir}" || die
506 relative_path=../../../lib/portage/pym/${mod_dir}
507 x=/${mod_dir}
508 while [ -n "${x}" ] ; do
509 relative_path=../${relative_path}
510 x=${x%/*}
511 done
512 for x in ${files} ; do
513 dosym "${relative_path}/${x}" \
514 "${dest_mod_dir}/${x}" || die
515 done
516 done < <(cd "${ED:-${D}}"usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
517 cd "${S}" || die
518 EPYTHON=$(get_python_interpreter ${impl}) \
519 python_compileall "$(get_python_sitedir ${impl})"
520 done
521
522 # Compile /usr/lib/portage/pym with the active interpreter, since portage
523 # internal commands force this directory to the beginning of sys.path.
524 python_compileall /usr/lib/portage/pym
525 }
526
527 pkg_preinst() {
528 if [[ $ROOT == / ]] ; then
529 # Run some minimal tests as a sanity check.
530 local test_runner=$(find "${ED:-${D}}" -name runTests)
531 if [[ -n $test_runner && -x $test_runner ]] ; then
532 einfo "Running preinst sanity tests..."
533 "$test_runner" || die "preinst sanity tests failed"
534 fi
535 fi
536
537 if use xattr && ! current_python_has_xattr ; then
538 ewarn "For optimal performance in xattr handling, install"
539 ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and"
540 ewarn "enable USE=python3 for $CATEGORY/$PN."
541 fi
542
543 # elog dir must exist to avoid logrotate error for bug #415911.
544 # This code runs in preinst in order to bypass the mapping of
545 # portage:portage to root:root which happens after src_install.
546 keepdir /var/log/portage/elog
547 # This is allowed to fail if the user/group are invalid for prefix users.
548 if chown portage:portage "${ED:-${D}}"var/log/portage{,/elog} 2>/dev/null ; then
549 chmod g+s,ug+rwx "${ED:-${D}}"var/log/portage{,/elog}
550 fi
551
552 # If portage-2.1.6 is installed and the preserved_libs_registry exists,
553 # assume that the NEEDED.ELF.2 files have already been generated.
554 has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
555 ! { [ -e "${EROOT:-${ROOT}}"var/lib/portage/preserved_libs_registry ] && \
556 has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ; } \
557 && NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false
558
559 if has_version "<${CATEGORY}/${PN}-2.1.13" || \
560 {
561 has_version ">=${CATEGORY}/${PN}-2.2_rc0" && \
562 has_version "<${CATEGORY}/${PN}-2.2.0_alpha189"
563 } ; then
564 USERPRIV_UPGRADE=true
565 USERSYNC_UPGRADE=true
566 REPOS_CONF_UPGRADE=true
567 REPOS_CONF_SYNC=
568 type -P portageq >/dev/null 2>&1 && \
569 REPOS_CONF_SYNC=$("$(type -P portageq)" envvar SYNC)
570 else
571 USERPRIV_UPGRADE=false
572 USERSYNC_UPGRADE=false
573 REPOS_CONF_UPGRADE=false
574 fi
575 }
576
577 get_ownership() {
578 case ${USERLAND} in
579 BSD)
580 stat -f '%Su:%Sg' "${1}"
581 ;;
582 *)
583 stat -c '%U:%G' "${1}"
584 ;;
585 esac
586 }
587
588 new_config_protect() {
589 # Generate a ._cfg file even if the target file
590 # does not exist, ensuring that the user will
591 # notice the config change.
592 local basename=${1##*/}
593 local dirname=${1%/*}
594 local i=0
595 while true ; do
596 local filename=$(
597 echo -n "${dirname}/._cfg"
598 printf "%04d" ${i}
599 echo -n "_${basename}"
600 )
601 [[ -e ${filename} ]] || break
602 (( i++ ))
603 done
604 echo "${filename}"
605 }
606
607 pkg_postinst() {
608
609 if ${REPOS_CONF_UPGRADE} ; then
610 einfo "Generating repos.conf"
611 local repo_name=
612 [[ -f ${PORTDIR}/profiles/repo_name ]] && \
613 repo_name=$(< "${PORTDIR}/profiles/repo_name")
614 if [[ -z ${REPOS_CONF_SYNC} ]] ; then
615 REPOS_CONF_SYNC=$(grep "^sync-uri =" "${EROOT:-${ROOT}}usr/share/portage/config/repos.conf")
616 REPOS_CONF_SYNC=${REPOS_CONF_SYNC##* }
617 fi
618 local sync_type=
619 [[ ${REPOS_CONF_SYNC} == git://* ]] && sync_type=git
620
621 if [[ ${REPOS_CONF_SYNC} == cvs://* ]]; then
622 sync_type=cvs
623 REPOS_CONF_SYNC=${REPOS_CONF_SYNC#cvs://}
624 fi
625
626 cat <<-EOF > "${T}/repos.conf"
627 [DEFAULT]
628 main-repo = ${repo_name:-gentoo}
629
630 [${repo_name:-gentoo}]
631 location = ${PORTDIR:-${EPREFIX}/usr/portage}
632 sync-type = ${sync_type:-rsync}
633 sync-uri = ${REPOS_CONF_SYNC}
634 EOF
635
636 [[ ${sync_type} == cvs ]] && echo "sync-cvs-repo = $(<"${PORTDIR}/CVS/Repository")" >> "${T}/repos.conf"
637
638 local dest=${EROOT:-${ROOT}}etc/portage/repos.conf
639 if [[ ! -f ${dest} ]] && mkdir -p "${dest}" 2>/dev/null ; then
640 dest=${EROOT:-${ROOT}}etc/portage/repos.conf/${repo_name:-gentoo}.conf
641 fi
642 # Don't install the config update if the desired repos.conf directory
643 # and config file exist, since users may accept it blindly and break
644 # their config (bug #478726).
645 [[ -e ${EROOT:-${ROOT}}etc/portage/repos.conf/${repo_name:-gentoo}.conf ]] || \
646 mv "${T}/repos.conf" "$(new_config_protect "${dest}")"
647
648 if [[ ${PORTDIR} == ${EPREFIX}/usr/portage ]] ; then
649 einfo "Generating make.conf PORTDIR setting for backward compatibility"
650 for dest in "${EROOT:-${ROOT}}etc/make.conf" "${EROOT:-${ROOT}}etc/portage/make.conf" ; do
651 [[ -e ${dest} ]] && break
652 done
653 [[ -d ${dest} ]] && dest=${dest}/portdir.conf
654 rm -rf "${T}/make.conf"
655 [[ -f ${dest} ]] && cat "${dest}" > "${T}/make.conf"
656 cat <<-EOF >> "${T}/make.conf"
657
658 # Set PORTDIR for backward compatibility with various tools:
659 # gentoo-bashcomp - bug #478444
660 # euse - bug #474574
661 # euses and ufed - bug #478318
662 PORTDIR="${EPREFIX}/usr/portage"
663 EOF
664 mkdir -p "${dest%/*}"
665 mv "${T}/make.conf" "$(new_config_protect "${dest}")"
666 fi
667 fi
668
669 if ${NEEDED_REBUILD_UPGRADE} ; then
670 einfo "rebuilding NEEDED.ELF.2 files"
671 local cpv filename line newline
672 for cpv in "${EROOT:-${ROOT}}var/db/pkg"/*/*; do
673 [[ -f "${cpv}/NEEDED" && ! -f "${cpv}/NEEDED.ELF.2" ]] || continue
674 while read -r line; do
675 filename=${line% *}
676 newline=$(scanelf -BF "%a;%F;%S;%r;%n" "${ROOT%/}${filename}")
677 newline=${newline// - }
678 [[ ${#ROOT} -gt 1 ]] && newline=${newline/${ROOT%/}}
679 echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
680 done < "${cpv}/NEEDED"
681 done
682 fi
683
684 local distdir=${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}
685
686 if ${USERSYNC_UPGRADE} && \
687 [[ -d ${PORTDIR} && -w ${PORTDIR} ]] ; then
688 local ownership=$(get_ownership "${PORTDIR}")
689 if [[ -n ${ownership} ]] ; then
690 einfo "Adjusting PORTDIR permissions for usersync"
691 find "${PORTDIR}" -path "${distdir%/}" -prune -o \
692 ! \( -user "${ownership%:*}" -a -group "${ownership#*:}" \) \
693 -exec chown "${ownership}" {} +
694 fi
695 fi
696
697 # Do this last, since it could take a long time if there
698 # are lots of live sources, and the user may be tempted
699 # to kill emerge while it is running.
700 if ${USERPRIV_UPGRADE} && \
701 [[ -d ${distdir} && -w ${distdir} ]] ; then
702 local ownership=$(get_ownership "${distdir}")
703 if [[ ${ownership#*:} == portage ]] ; then
704 einfo "Adjusting DISTDIR permissions for userpriv"
705 find "${distdir}" -mindepth 1 -maxdepth 1 -type d -uid 0 \
706 -exec chown -R portage:portage {} +
707 fi
708 fi
709 }