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