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