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