Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-apps/portage: ChangeLog portage-2.1.9.48.ebuild portage-2.2.0_alpha32.ebuild
Date: Sun, 08 May 2011 22:25:33
Message-Id: 20110508222523.34B3A20054@flycatcher.gentoo.org
1 zmedico 11/05/08 22:25:23
2
3 Modified: ChangeLog
4 Added: portage-2.1.9.48.ebuild
5 portage-2.2.0_alpha32.ebuild
6 Log:
7 *portage-2.2.0_alpha32 (08 May 2011)
8
9 08 May 2011; Zac Medico <zmedico@g.o> +portage-2.2.0_alpha32.ebuild:
10 2.2.0_alpha32 version bump. This fixes bug #366061 (preserved-libs not
11 garbage collected when appropriate), and includes all of the fixes in
12 portage-2.1.9.48. This also includes support for FEATURES=parallel-install,
13 which can greatly improve performance when installing large numbers of
14 binary packages. Bug #210077 tracks all bugs fixed since portage-2.1.x.
15
16 *portage-2.1.9.48 (08 May 2011)
17
18 08 May 2011; Zac Medico <zmedico@g.o> +portage-2.1.9.48.ebuild:
19 2.1.9.48 version bump. This fixes a regression in 2.1.9.47 which causes
20 "AttributeError: 'vardbapi' object has no attribute 'match_pkgs'" errors
21 with emerge --resume and --keep-going. Bug #358927 tracks all bugs fixed
22 since portage-2.1.9.42.
23
24 (Portage version: 2.2.0_alpha32/cvs/Linux i686)
25
26 Revision Changes Path
27 1.824 sys-apps/portage/ChangeLog
28
29 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/ChangeLog?rev=1.824&view=markup
30 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/ChangeLog?rev=1.824&content-type=text/plain
31 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/ChangeLog?r1=1.823&r2=1.824
32
33 Index: ChangeLog
34 ===================================================================
35 RCS file: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v
36 retrieving revision 1.823
37 retrieving revision 1.824
38 diff -u -r1.823 -r1.824
39 --- ChangeLog 6 May 2011 04:21:51 -0000 1.823
40 +++ ChangeLog 8 May 2011 22:25:23 -0000 1.824
41 @@ -1,6 +1,23 @@
42 # ChangeLog for sys-apps/portage
43 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
44 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.823 2011/05/06 04:21:51 zmedico Exp $
45 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.824 2011/05/08 22:25:23 zmedico Exp $
46 +
47 +*portage-2.2.0_alpha32 (08 May 2011)
48 +
49 + 08 May 2011; Zac Medico <zmedico@g.o> +portage-2.2.0_alpha32.ebuild:
50 + 2.2.0_alpha32 version bump. This fixes bug #366061 (preserved-libs not
51 + garbage collected when appropriate), and includes all of the fixes in
52 + portage-2.1.9.48. This also includes support for FEATURES=parallel-install,
53 + which can greatly improve performance when installing large numbers of
54 + binary packages. Bug #210077 tracks all bugs fixed since portage-2.1.x.
55 +
56 +*portage-2.1.9.48 (08 May 2011)
57 +
58 + 08 May 2011; Zac Medico <zmedico@g.o> +portage-2.1.9.48.ebuild:
59 + 2.1.9.48 version bump. This fixes a regression in 2.1.9.47 which causes
60 + "AttributeError: 'vardbapi' object has no attribute 'match_pkgs'" errors
61 + with emerge --resume and --keep-going. Bug #358927 tracks all bugs fixed
62 + since portage-2.1.9.42.
63
64 06 May 2011; Zac Medico <zmedico@g.o> portage-9999.ebuild:
65 Migrate to git-2.eclass.
66
67
68
69 1.1 sys-apps/portage/portage-2.1.9.48.ebuild
70
71 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.1.9.48.ebuild?rev=1.1&view=markup
72 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.1.9.48.ebuild?rev=1.1&content-type=text/plain
73
74 Index: portage-2.1.9.48.ebuild
75 ===================================================================
76 # Copyright 1999-2011 Gentoo Foundation
77 # Distributed under the terms of the GNU General Public License v2
78 # $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.9.48.ebuild,v 1.1 2011/05/08 22:25:23 zmedico Exp $
79
80 # Require EAPI 2 since we now require at least python-2.6 (for python 3
81 # syntax support) which also requires EAPI 2.
82 EAPI=2
83 inherit eutils multilib python
84
85 DESCRIPTION="Portage is the package management and distribution system for Gentoo"
86 HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
87 LICENSE="GPL-2"
88 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
89 SLOT="0"
90 IUSE="build doc epydoc +ipc linguas_pl python2 python3 selinux"
91
92 python_dep="python3? ( =dev-lang/python-3* )
93 !python2? ( !python3? (
94 build? ( || ( dev-lang/python:2.7 dev-lang/python:2.6 ) )
95 !build? ( || ( dev-lang/python:2.7 dev-lang/python:2.6 >=dev-lang/python-3 ) )
96 ) )
97 python2? ( !python3? ( || ( dev-lang/python:2.7 dev-lang/python:2.6 ) ) )"
98
99 # The pysqlite blocker is for bug #282760.
100 DEPEND="${python_dep}
101 !build? ( >=sys-apps/sed-4.0.5 )
102 doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
103 epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
104
105 RDEPEND="${python_dep}
106 !build? ( >=sys-apps/sed-4.0.5
107 >=app-shells/bash-3.2_p17
108 >=app-admin/eselect-1.2 )
109 elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
110 elibc_glibc? ( >=sys-apps/sandbox-1.6 )
111 elibc_uclibc? ( >=sys-apps/sandbox-1.6 )
112 >=app-misc/pax-utils-0.1.17
113 selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
114 !<app-shells/bash-3.2_p17"
115 PDEPEND="
116 !build? (
117 >=net-misc/rsync-2.6.4
118 userland_GNU? ( >=sys-apps/coreutils-6.4 )
119 )"
120 # coreutils-6.4 rdep is for date format in emerge-webrsync #164532
121 # rsync-2.6.4 rdep is for the --filter option #167668
122
123 SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
124
125 prefix_src_archives() {
126 local x y
127 for x in ${@}; do
128 for y in ${SRC_ARCHIVES}; do
129 echo ${y}/${x}
130 done
131 done
132 }
133
134 PV_PL="2.1.2"
135 PATCHVER_PL=""
136 TARBALL_PV=$PV
137 SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
138 $(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
139 linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
140 $(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
141
142 PATCHVER=
143 [[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
144 if [ -n "${PATCHVER}" ]; then
145 SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
146 $(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
147 fi
148
149 S="${WORKDIR}"/${PN}-${TARBALL_PV}
150 S_PL="${WORKDIR}"/${PN}-${PV_PL}
151
152 compatible_python_is_selected() {
153 [[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
154 }
155
156 pkg_setup() {
157 # Bug #359731 - Die early if get_libdir fails.
158 [[ -z $(get_libdir) ]] && \
159 die "get_libdir returned an empty string"
160
161 if use python2 && use python3 ; then
162 ewarn "Both python2 and python3 USE flags are enabled, but only one"
163 ewarn "can be in the shebangs. Using python3."
164 fi
165 if ! use python2 && ! use python3 && ! compatible_python_is_selected ; then
166 ewarn "Attempting to select a compatible default python interpreter"
167 local x success=0
168 for x in /usr/bin/python2.* ; do
169 x=${x#/usr/bin/python2.}
170 if [[ $x -ge 6 ]] 2>/dev/null ; then
171 eselect python set python2.$x
172 if compatible_python_is_selected ; then
173 elog "Default python interpreter is now set to python-2.$x"
174 success=1
175 break
176 fi
177 fi
178 done
179 if [ $success != 1 ] ; then
180 eerror "Unable to select a compatible default python interpreter!"
181 die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
182 fi
183 fi
184
185 if use python3; then
186 python_set_active_version 3
187 elif use python2; then
188 python_set_active_version 2
189 fi
190 }
191
192 src_prepare() {
193 if [ -n "${PATCHVER}" ] ; then
194 if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
195 rm "$S/bin/ebuild-helpers/portageq" \
196 || die "failed to remove portageq helper symlink"
197 fi
198 epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
199 fi
200 einfo "Setting portage.VERSION to ${PVR} ..."
201 sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
202 die "Failed to patch portage.VERSION"
203 sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
204 die "Failed to patch VERSION in doc/fragment/version"
205 sed -e "1s/VERSION/${PVR}/" -i man/* || \
206 die "Failed to patch VERSION in man page headers"
207
208 if ! use ipc ; then
209 einfo "Disabling ipc..."
210 sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
211 -i pym/_emerge/AbstractEbuildProcess.py || \
212 die "failed to patch AbstractEbuildProcess.py"
213 fi
214
215 if use python3; then
216 einfo "Converting shebangs for python3..."
217 python_convert_shebangs -r 3 .
218 elif use python2; then
219 einfo "Converting shebangs for python2..."
220 python_convert_shebangs -r 2 .
221 fi
222 }
223
224 src_compile() {
225 if use doc; then
226 cd "${S}"/doc
227 touch fragment/date
228 make xhtml xhtml-nochunks || die "failed to make docs"
229 fi
230
231 if use epydoc; then
232 einfo "Generating api docs"
233 mkdir "${WORKDIR}"/api
234 local my_modules epydoc_opts=""
235 my_modules="$(find "${S}/pym" -name "*.py" \
236 | sed -e 's:/__init__.py$::' -e 's:\.py$::' -e "s:^${S}/pym/::" \
237 -e 's:/:.:g' | sort)" || die "error listing modules"
238 # workaround for bug 282760
239 > "$S/pym/pysqlite2.py"
240 PYTHONPATH=${S}/pym:${PYTHONPATH:+:}${PYTHONPATH} \
241 epydoc -o "${WORKDIR}"/api \
242 -qqqqq --no-frames --show-imports $epydoc_opts \
243 --name "${PN}" --url "${HOMEPAGE}" \
244 ${my_modules} || die "epydoc failed"
245 rm "$S/pym/pysqlite2.py"
246 fi
247 }
248
249 src_test() {
250 # make files executable, in case they were created by patch
251 find bin -type f | xargs chmod +x
252 PYTHONPATH=${S}/pym:${PYTHONPATH:+:}${PYTHONPATH} \
253 ./pym/portage/tests/runTests || die "test(s) failed"
254 }
255
256 src_install() {
257 local libdir=$(get_libdir)
258 local portage_base="/usr/${libdir}/portage"
259 local portage_share_config=/usr/share/portage/config
260
261 cd "${S}"/cnf
262 insinto /etc
263 doins etc-update.conf dispatch-conf.conf || die
264
265 insinto "$portage_share_config"
266 doins "$S/cnf/make.globals" || die
267 if [ -f "make.conf.${ARCH}".diff ]; then
268 patch make.conf "make.conf.${ARCH}".diff || \
269 die "Failed to patch make.conf.example"
270 newins make.conf make.conf.example || die
271 else
272 eerror ""
273 eerror "Portage does not have an arch-specific configuration for this arch."
274 eerror "Please notify the arch maintainer about this issue. Using generic."
275 eerror ""
276 newins make.conf make.conf.example || die
277 fi
278
279 dosym ..${portage_share_config}/make.globals /etc/make.globals
280
281 insinto /etc/logrotate.d
282 doins "${S}"/cnf/logrotate.d/elog-save-summary || die
283
284 # BSD and OSX need a sed wrapper so that find/xargs work properly
285 if use userland_GNU; then
286 rm "${S}"/bin/ebuild-helpers/sed || die "Failed to remove sed wrapper"
287 fi
288
289 local x symlinks files
290
291 cd "$S" || die "cd failed"
292 for x in $(find bin -type d) ; do
293 exeinto $portage_base/$x || die "exeinto failed"
294 cd "$S"/$x || die "cd failed"
295 files=$(find . -mindepth 1 -maxdepth 1 -type f ! -type l)
296 if [ -n "$files" ] ; then
297 doexe $files || die "doexe failed"
298 fi
299 symlinks=$(find . -mindepth 1 -maxdepth 1 -type l)
300 if [ -n "$symlinks" ] ; then
301 cp -P $symlinks "$D$portage_base/$x" || die "cp failed"
302 fi
303 done
304
305 cd "$S" || die "cd failed"
306 for x in $(find pym/* -type d) ; do
307 insinto $portage_base/$x || die "insinto failed"
308 cd "$S"/$x || die "cd failed"
309 # __pycache__ directories contain no py files
310 [[ "*.py" != $(echo *.py) ]] || continue
311 doins *.py || die "doins failed"
312 symlinks=$(find . -mindepth 1 -maxdepth 1 -type l)
313 if [ -n "$symlinks" ] ; then
314 cp -P $symlinks "$D$portage_base/$x" || die "cp failed"
315 fi
316 done
317
318 # Symlinks to directories cause up/downgrade issues and the use of these
319 # modules outside of portage is probably negligible.
320 for x in "${D}${portage_base}/pym/"{cache,elog_modules} ; do
321 [ ! -L "${x}" ] && continue
322 die "symlink to directory will cause upgrade/downgrade issues: '${x}'"
323 done
324
325 exeinto ${portage_base}/pym/portage/tests
326 doexe "${S}"/pym/portage/tests/runTests
327
328 doman "${S}"/man/*.[0-9]
329 if use linguas_pl; then
330 doman -i18n=pl "${S_PL}"/man/pl/*.[0-9]
331 doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9]
332 fi
333
334 dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES}
335 use doc && dohtml -r "${S}"/doc/*
336 use epydoc && dohtml -r "${WORKDIR}"/api
337
338 dodir /usr/bin
339 for x in ebuild egencache emerge portageq quickpkg repoman ; do
340 dosym ../${libdir}/portage/bin/${x} /usr/bin/${x}
341 done
342
343 dodir /usr/sbin
344 local my_syms="archive-conf
345 dispatch-conf
346 emaint
347 emerge-webrsync
348 env-update
349 etc-update
350 fixpackages
351 regenworld"
352 local x
353 for x in ${my_syms}; do
354 dosym ../${libdir}/portage/bin/${x} /usr/sbin/${x}
355 done
356 dosym env-update /usr/sbin/update-env
357 dosym etc-update /usr/sbin/update-etc
358
359 dodir /etc/portage
360 keepdir /etc/portage
361 }
362
363 pkg_preinst() {
364 if ! use build && ! has_version dev-python/pycrypto && \
365 ! has_version '>=dev-lang/python-2.6[ssl]' ; then
366 ewarn "If you are an ebuild developer and you plan to commit ebuilds"
367 ewarn "with this system then please install dev-python/pycrypto or"
368 ewarn "enable the ssl USE flag for >=dev-lang/python-2.6 in order"
369 ewarn "to enable RMD160 hash support."
370 ewarn "See bug #198398 for more information."
371 fi
372 if [ -f "${ROOT}/etc/make.globals" ]; then
373 rm "${ROOT}/etc/make.globals"
374 fi
375
376 [[ -n $PORTDIR_OVERLAY ]] && has_version "<${CATEGORY}/${PN}-2.1.6.12"
377 REPO_LAYOUT_CONF_WARN=$?
378 }
379
380 pkg_postinst() {
381 # Compile all source files recursively. Any orphans
382 # will be identified and removed in postrm.
383 python_mod_optimize /usr/$(get_libdir)/portage/pym
384
385 if [ $REPO_LAYOUT_CONF_WARN = 0 ] ; then
386 ewarn
387 echo "If you want overlay eclasses to override eclasses from" \
388 "other repos then see the portage(5) man page" \
389 "for information about the new layout.conf and repos.conf" \
390 "configuration files." \
391 | fmt -w 75 | while read -r ; do ewarn "$REPLY" ; done
392 ewarn
393 fi
394
395 einfo
396 einfo "For help with using portage please consult the Gentoo Handbook"
397 einfo "at http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3"
398 einfo
399 }
400
401 pkg_postrm() {
402 python_mod_cleanup /usr/$(get_libdir)/portage/pym
403 }
404
405
406
407 1.1 sys-apps/portage/portage-2.2.0_alpha32.ebuild
408
409 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha32.ebuild?rev=1.1&view=markup
410 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha32.ebuild?rev=1.1&content-type=text/plain
411
412 Index: portage-2.2.0_alpha32.ebuild
413 ===================================================================
414 # Copyright 1999-2011 Gentoo Foundation
415 # Distributed under the terms of the GNU General Public License v2
416 # $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.0_alpha32.ebuild,v 1.1 2011/05/08 22:25:23 zmedico Exp $
417
418 # Require EAPI 2 since we now require at least python-2.6 (for python 3
419 # syntax support) which also requires EAPI 2.
420 EAPI=2
421 inherit eutils multilib python
422
423 DESCRIPTION="Portage is the package management and distribution system for Gentoo"
424 HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
425 LICENSE="GPL-2"
426 KEYWORDS="~sparc-fbsd ~x86-fbsd"
427 SLOT="0"
428 IUSE="build doc epydoc +ipc linguas_pl python2 python3 selinux"
429
430 python_dep="python3? ( =dev-lang/python-3* )
431 !python2? ( !python3? (
432 build? ( || ( dev-lang/python:2.7 dev-lang/python:2.6 ) )
433 !build? ( || ( dev-lang/python:2.7 dev-lang/python:2.6 >=dev-lang/python-3 ) )
434 ) )
435 python2? ( !python3? ( || ( dev-lang/python:2.7 dev-lang/python:2.6 ) ) )"
436
437 # The pysqlite blocker is for bug #282760.
438 DEPEND="${python_dep}
439 !build? ( >=sys-apps/sed-4.0.5 )
440 doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 )
441 epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )"
442 # Require sandbox-2.2 for bug #288863.
443 RDEPEND="${python_dep}
444 !build? ( >=sys-apps/sed-4.0.5
445 >=app-shells/bash-3.2_p17
446 >=app-admin/eselect-1.2 )
447 elibc_FreeBSD? ( sys-freebsd/freebsd-bin )
448 elibc_glibc? ( >=sys-apps/sandbox-2.2 )
449 elibc_uclibc? ( >=sys-apps/sandbox-2.2 )
450 >=app-misc/pax-utils-0.1.17
451 selinux? ( || ( >=sys-libs/libselinux-2.0.94[python] <sys-libs/libselinux-2.0.94 ) )
452 !<app-shells/bash-3.2_p17"
453 PDEPEND="
454 !build? (
455 >=net-misc/rsync-2.6.4
456 userland_GNU? ( >=sys-apps/coreutils-6.4 )
457 )"
458 # coreutils-6.4 rdep is for date format in emerge-webrsync #164532
459 # rsync-2.6.4 rdep is for the --filter option #167668
460
461 SRC_ARCHIVES="http://dev.gentoo.org/~zmedico/portage/archives"
462
463 prefix_src_archives() {
464 local x y
465 for x in ${@}; do
466 for y in ${SRC_ARCHIVES}; do
467 echo ${y}/${x}
468 done
469 done
470 }
471
472 PV_PL="2.1.2"
473 PATCHVER_PL=""
474 TARBALL_PV=2.2.0_alpha31
475 SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2
476 $(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)
477 linguas_pl? ( mirror://gentoo/${PN}-man-pl-${PV_PL}.tar.bz2
478 $(prefix_src_archives ${PN}-man-pl-${PV_PL}.tar.bz2) )"
479
480 PATCHVER=
481 [[ $TARBALL_PV = $PV ]] || PATCHVER=$PV
482 if [ -n "${PATCHVER}" ]; then
483 SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2
484 $(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)"
485 fi
486
487 S="${WORKDIR}"/${PN}-${TARBALL_PV}
488 S_PL="${WORKDIR}"/${PN}-${PV_PL}
489
490 compatible_python_is_selected() {
491 [[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]]
492 }
493
494 pkg_setup() {
495 # Bug #359731 - Die early if get_libdir fails.
496 [[ -z $(get_libdir) ]] && \
497 die "get_libdir returned an empty string"
498
499 if use python2 && use python3 ; then
500 ewarn "Both python2 and python3 USE flags are enabled, but only one"
501 ewarn "can be in the shebangs. Using python3."
502 fi
503 if ! use python2 && ! use python3 && ! compatible_python_is_selected ; then
504 ewarn "Attempting to select a compatible default python interpreter"
505 local x success=0
506 for x in /usr/bin/python2.* ; do
507 x=${x#/usr/bin/python2.}
508 if [[ $x -ge 6 ]] 2>/dev/null ; then
509 eselect python set python2.$x
510 if compatible_python_is_selected ; then
511 elog "Default python interpreter is now set to python-2.$x"
512 success=1
513 break
514 fi
515 fi
516 done
517 if [ $success != 1 ] ; then
518 eerror "Unable to select a compatible default python interpreter!"
519 die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)."
520 fi
521 fi
522
523 if use python3; then
524 python_set_active_version 3
525 elif use python2; then
526 python_set_active_version 2
527 fi
528 }
529
530 src_prepare() {
531 if [ -n "${PATCHVER}" ] ; then
532 if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then
533 rm "$S/bin/ebuild-helpers/portageq" \
534 || die "failed to remove portageq helper symlink"
535 fi
536 epatch "${WORKDIR}/${PN}-${PATCHVER}.patch"
537 fi
538 einfo "Setting portage.VERSION to ${PVR} ..."
539 sed -e "s/^VERSION=.*/VERSION=\"${PVR}\"/" -i pym/portage/__init__.py || \
540 die "Failed to patch portage.VERSION"
541 sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \
542 die "Failed to patch VERSION in doc/fragment/version"
543 sed -e "1s/VERSION/${PVR}/" -i man/* || \
544 die "Failed to patch VERSION in man page headers"
545
546 if ! use ipc ; then
547 einfo "Disabling ipc..."
548 sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \
549 -i pym/_emerge/AbstractEbuildProcess.py || \
550 die "failed to patch AbstractEbuildProcess.py"
551 fi
552
553 if use python3; then
554 einfo "Converting shebangs for python3..."
555 python_convert_shebangs -r 3 .
556 elif use python2; then
557 einfo "Converting shebangs for python2..."
558 python_convert_shebangs -r 2 .
559 fi
560 }
561
562 src_compile() {
563 if use doc; then
564 cd "${S}"/doc
565 touch fragment/date
566 make xhtml xhtml-nochunks || die "failed to make docs"
567 fi
568
569 if use epydoc; then
570 einfo "Generating api docs"
571 mkdir "${WORKDIR}"/api
572 local my_modules epydoc_opts=""
573 my_modules="$(find "${S}/pym" -name "*.py" \
574 | sed -e 's:/__init__.py$::' -e 's:\.py$::' -e "s:^${S}/pym/::" \
575 -e 's:/:.:g' | sort)" || die "error listing modules"
576 # workaround for bug 282760
577 > "$S/pym/pysqlite2.py"
578 PYTHONPATH=${S}/pym:${PYTHONPATH:+:}${PYTHONPATH} \
579 epydoc -o "${WORKDIR}"/api \
580 -qqqqq --no-frames --show-imports $epydoc_opts \
581 --name "${PN}" --url "${HOMEPAGE}" \
582 ${my_modules} || die "epydoc failed"
583 rm "$S/pym/pysqlite2.py"
584 fi
585 }
586
587 src_test() {
588 # make files executable, in case they were created by patch
589 find bin -type f | xargs chmod +x
590 PYTHONPATH=${S}/pym:${PYTHONPATH:+:}${PYTHONPATH} \
591 ./pym/portage/tests/runTests || die "test(s) failed"
592 }
593
594 src_install() {
595 local libdir=$(get_libdir)
596 local portage_base="/usr/${libdir}/portage"
597 local portage_share_config=/usr/share/portage/config
598
599 cd "${S}"/cnf
600 insinto /etc
601 doins etc-update.conf dispatch-conf.conf || die
602
603 insinto "$portage_share_config/sets"
604 doins "$S"/cnf/sets/*.conf || die
605 insinto "$portage_share_config"
606 doins "$S/cnf/make.globals" || die
607 if [ -f "make.conf.${ARCH}".diff ]; then
608 patch make.conf "make.conf.${ARCH}".diff || \
609 die "Failed to patch make.conf.example"
610 newins make.conf make.conf.example || die
611 else
612 eerror ""
613 eerror "Portage does not have an arch-specific configuration for this arch."
614 eerror "Please notify the arch maintainer about this issue. Using generic."
615 eerror ""
616 newins make.conf make.conf.example || die
617 fi
618
619 dosym ..${portage_share_config}/make.globals /etc/make.globals
620
621 insinto /etc/logrotate.d
622 doins "${S}"/cnf/logrotate.d/elog-save-summary || die
623
624 # BSD and OSX need a sed wrapper so that find/xargs work properly
625 if use userland_GNU; then
626 rm "${S}"/bin/ebuild-helpers/sed || die "Failed to remove sed wrapper"
627 fi
628
629 local x symlinks files
630
631 cd "$S" || die "cd failed"
632 for x in $(find bin -type d) ; do
633 exeinto $portage_base/$x || die "exeinto failed"
634 cd "$S"/$x || die "cd failed"
635 files=$(find . -mindepth 1 -maxdepth 1 -type f ! -type l)
636 if [ -n "$files" ] ; then
637 doexe $files || die "doexe failed"
638 fi
639 symlinks=$(find . -mindepth 1 -maxdepth 1 -type l)
640 if [ -n "$symlinks" ] ; then
641 cp -P $symlinks "$D$portage_base/$x" || die "cp failed"
642 fi
643 done
644
645 cd "$S" || die "cd failed"
646 for x in $(find pym/* -type d) ; do
647 insinto $portage_base/$x || die "insinto failed"
648 cd "$S"/$x || die "cd failed"
649 # __pycache__ directories contain no py files
650 [[ "*.py" != $(echo *.py) ]] || continue
651 doins *.py || die "doins failed"
652 symlinks=$(find . -mindepth 1 -maxdepth 1 -type l)
653 if [ -n "$symlinks" ] ; then
654 cp -P $symlinks "$D$portage_base/$x" || die "cp failed"
655 fi
656 done
657
658 # Symlinks to directories cause up/downgrade issues and the use of these
659 # modules outside of portage is probably negligible.
660 for x in "${D}${portage_base}/pym/"{cache,elog_modules} ; do
661 [ ! -L "${x}" ] && continue
662 die "symlink to directory will cause upgrade/downgrade issues: '${x}'"
663 done
664
665 exeinto ${portage_base}/pym/portage/tests
666 doexe "${S}"/pym/portage/tests/runTests
667
668 doman "${S}"/man/*.[0-9]
669 if use linguas_pl; then
670 doman -i18n=pl "${S_PL}"/man/pl/*.[0-9]
671 doman -i18n=pl_PL.UTF-8 "${S_PL}"/man/pl_PL.UTF-8/*.[0-9]
672 fi
673
674 dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES}
675 use doc && dohtml -r "${S}"/doc/*
676 use epydoc && dohtml -r "${WORKDIR}"/api
677
678 dodir /usr/bin
679 for x in ebuild egencache emerge portageq quickpkg repoman ; do
680 dosym ../${libdir}/portage/bin/${x} /usr/bin/${x}
681 done
682
683 dodir /usr/sbin
684 local my_syms="archive-conf
685 dispatch-conf
686 emaint
687 emerge-webrsync
688 env-update
689 etc-update
690 fixpackages
691 regenworld"
692 local x
693 for x in ${my_syms}; do
694 dosym ../${libdir}/portage/bin/${x} /usr/sbin/${x}
695 done
696 dosym env-update /usr/sbin/update-env
697 dosym etc-update /usr/sbin/update-etc
698
699 dodir /etc/portage
700 keepdir /etc/portage
701 }
702
703 pkg_preinst() {
704 if ! use build && ! has_version dev-python/pycrypto && \
705 ! has_version '>=dev-lang/python-2.6[ssl]' ; then
706 ewarn "If you are an ebuild developer and you plan to commit ebuilds"
707 ewarn "with this system then please install dev-python/pycrypto or"
708 ewarn "enable the ssl USE flag for >=dev-lang/python-2.6 in order"
709 ewarn "to enable RMD160 hash support."
710 ewarn "See bug #198398 for more information."
711 fi
712 if [ -f "${ROOT}/etc/make.globals" ]; then
713 rm "${ROOT}/etc/make.globals"
714 fi
715
716 has_version "<${CATEGORY}/${PN}-2.2_alpha"
717 MINOR_UPGRADE=$?
718
719 has_version "<=${CATEGORY}/${PN}-2.2_pre5"
720 WORLD_MIGRATION_UPGRADE=$?
721
722 # If portage-2.1.6 is installed and the preserved_libs_registry exists,
723 # assume that the NEEDED.ELF.2 files have already been generated.
724 has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \
725 ! ( [ -e "$ROOT"var/lib/portage/preserved_libs_registry ] && \
726 has_version ">=${CATEGORY}/${PN}-2.1.6_rc" )
727 NEEDED_REBUILD_UPGRADE=$?
728
729 [[ -n $PORTDIR_OVERLAY ]] && has_version "<${CATEGORY}/${PN}-2.1.6.12"
730 REPO_LAYOUT_CONF_WARN=$?
731 }
732
733 pkg_postinst() {
734 # Compile all source files recursively. Any orphans
735 # will be identified and removed in postrm.
736 python_mod_optimize /usr/$(get_libdir)/portage/pym
737
738 if [ $WORLD_MIGRATION_UPGRADE = 0 ] ; then
739 einfo "moving set references from the worldfile into world_sets"
740 cd "${ROOT}/var/lib/portage/"
741 grep "^@" world >> world_sets
742 sed -i -e '/^@/d' world
743 fi
744
745 if [ $NEEDED_REBUILD_UPGRADE = 0 ] ; then
746 einfo "rebuilding NEEDED.ELF.2 files"
747 for cpv in "${ROOT}/var/db/pkg"/*/*; do
748 if [ -f "${cpv}/NEEDED" ]; then
749 rm -f "${cpv}/NEEDED.ELF.2"
750 while read line; do
751 filename=${line% *}
752 needed=${line#* }
753 needed=${needed//+/++}
754 needed=${needed//#/##}
755 needed=${needed//%/%%}
756 newline=$(scanelf -BF "%a;%F;%S;%r;${needed}" $filename)
757 newline=${newline// - }
758 echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2"
759 done < "${cpv}/NEEDED"
760 fi
761 done
762 fi
763
764 if [ $REPO_LAYOUT_CONF_WARN = 0 ] ; then
765 ewarn
766 echo "If you want overlay eclasses to override eclasses from" \
767 "other repos then see the portage(5) man page" \
768 "for information about the new layout.conf and repos.conf" \
769 "configuration files." \
770 | fmt -w 75 | while read -r ; do ewarn "$REPLY" ; done
771 ewarn
772 fi
773
774 einfo
775 einfo "For help with using portage please consult the Gentoo Handbook"
776 einfo "at http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3"
777 einfo
778
779 if [ $MINOR_UPGRADE = 0 ] ; then
780 elog "If you're upgrading from a pre-2.2 version of portage you might"
781 elog "want to remerge world (emerge -e world) to take full advantage"
782 elog "of some of the new features in 2.2."
783 elog "This is not required however for portage to function properly."
784 elog
785 fi
786
787 if [ -z "${PV/*_alpha*}" ]; then
788 elog "If you always want to use the latest development version of portage"
789 elog "please read http://www.gentoo.org/proj/en/portage/doc/testing.xml"
790 elog
791 fi
792 }
793
794 pkg_postrm() {
795 python_mod_cleanup /usr/$(get_libdir)/portage/pym
796 }