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