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