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