diff options
author | Julian Ospald <hasufell@gentoo.org> | 2014-08-31 21:28:02 +0000 |
---|---|---|
committer | Julian Ospald <hasufell@gentoo.org> | 2014-08-31 21:28:02 +0000 |
commit | f06107a6334f0590e8758a9d1413ed5a72723deb (patch) | |
tree | 3e94df8f0caeba519723ce53c369ed657322e9af | |
parent | Revision bump for multilib ebuild (diff) | |
download | historical-f06107a6334f0590e8758a9d1413ed5a72723deb.tar.gz historical-f06107a6334f0590e8758a9d1413ed5a72723deb.tar.bz2 historical-f06107a6334f0590e8758a9d1413ed5a72723deb.zip |
revbump to EAPI=5 to fix broken dep calculation wrt #506158, as discussed with mgorny and bernalex
Package-Manager: portage-2.2.12-r1/cvs/Linux x86_64
Manifest-Sign-Key: 0xBDEED020
-rw-r--r-- | sys-apps/portage/ChangeLog | 8 | ||||
-rw-r--r-- | sys-apps/portage/Manifest | 29 | ||||
-rw-r--r-- | sys-apps/portage/portage-2.2.12-r1.ebuild | 572 |
3 files changed, 597 insertions, 12 deletions
diff --git a/sys-apps/portage/ChangeLog b/sys-apps/portage/ChangeLog index dd8a1b707142..0bac167499b1 100644 --- a/sys-apps/portage/ChangeLog +++ b/sys-apps/portage/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for sys-apps/portage # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.1403 2014/08/12 19:54:39 dolsen Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/ChangeLog,v 1.1404 2014/08/31 21:27:58 hasufell Exp $ + +*portage-2.2.12-r1 (31 Aug 2014) + + 31 Aug 2014; Julian Ospald <hasufell@gentoo.org> +portage-2.2.12-r1.ebuild: + revbump to EAPI=5 to fix broken dep calculation wrt #506158, as discussed + with mgorny and bernalex *portage-2.2.12 (12 Aug 2014) diff --git a/sys-apps/portage/Manifest b/sys-apps/portage/Manifest index 35cc2ec64895..11140caa5ffd 100644 --- a/sys-apps/portage/Manifest +++ b/sys-apps/portage/Manifest @@ -18,23 +18,30 @@ EBUILD portage-2.1.6.7_p1.ebuild 8307 SHA256 2b8b33ff1538f26c502e8606044ee18dfe7 EBUILD portage-2.2.1.ebuild 19238 SHA256 4e2e9ccfd1efd3b8965903d77da2c2736d9af1d90dcf883a07ebfbd88357d270 SHA512 c268f45e4e76e4fc46780714dec018fbba66f0b66d068dac6afd50ae8cb8cf335a42aa112716fba9815e516b6ad06eeaa4a967a8c247fac39dc7c3703c214181 WHIRLPOOL de17ddb295aa66b5585ae6957599dec4836ebe56922b70661c024e3a0fcbaffa13c7ace80c428201f82358f068a1bf24b315118aec68d713e28e90619ab8302a EBUILD portage-2.2.10.ebuild 19399 SHA256 2f7eb7e1de38eddf47d149251b86798fdbc2ff428484dc1a9e955cf988bd0474 SHA512 e8ec7297d211de29673036ec98307c69e91535e9099b3ddaf6ded119e8dab3a5e4e6edbf64618b37af8756735e24c677ac2fbd2ea6e3dc5ba7540c58e281ced4 WHIRLPOOL 5cc0ada19a89686ebc8e47cfb5566c93a7b618f591f0d57101c42787af85035d9a194b2ea18521ce17f34b79666ddb9f8be4ce7a332829b7df866e0d292827fd EBUILD portage-2.2.11-r1.ebuild 19047 SHA256 3f00db65cef46585f18bfd9581c39534834c9f9b2b451c4b8434c44a0c4e1c9a SHA512 1f4ae99990f758d82b9b9d9fa988688b9cd3a2ea92bd516857e5ba7b0053d218aee3164fb8c25df0f4752969914fdb86f3d8241329e9d4f91ccdd571d808ce58 WHIRLPOOL a2ae2f5591b20661187c60c183846237ac566334560bcc4b7495b6163254362896fd2cb8a6c908df8a8e2e7b9efd4924f71730b300bbf6c1a51dee1f9a745b95 +EBUILD portage-2.2.12-r1.ebuild 19014 SHA256 d01f6248ad500adc91df1561c47589a954751c64537bcd6aea4e28e6482ae428 SHA512 f6ae0d6ccf8667533acb7d33ab0d8ffe60dc8b7a87c823e287da607aba082606944ea02a1f9bead1e1c58b1395cd65623f3f8055bf0228a91e84cb47807c02f1 WHIRLPOOL 841739c6ea205169a12ba00c24194987f7708fb829813f13c7c3b39b06bbb53fb069cff3a22b888420713c134bb3700c5a27e1dc9608d191ceac847b8858da49 EBUILD portage-2.2.12.ebuild 19009 SHA256 820aed7f219c712121eb56211a620e4a7ec2c1b64c813dad18a5ec6e3cefc14c SHA512 86136d2e27f2ad6b7820d29f92bed86559638355c5560618c78fe2dcc9e25b98bc4a7d78f20c0dc601fd7f33b9bbd12be4a8b9ebf5ac099166ae8c480b56d7eb WHIRLPOOL 8284303e34766d2338884dfc328882f959747ce1fefd6436461298b48284703fb857333f76b29936b71f03e8362859c6e218631073b247b68d75da93e4cbcb2a EBUILD portage-2.2.7.ebuild 19244 SHA256 f4f40a7da1d0312dcd3bc2f45e88092458f05e65c8ea3d5b08b86a8a06aa68f5 SHA512 db283aff6267f3990d3750ef6bd1e2e8e4bf3591225f5855f83e6662794b0f2dd58f65bec5d14e216e92ac81df7842d83ed3b56eb05f0f4ccd5466dee722817c WHIRLPOOL a152ba0faa2b853b8ed7244a6aa12971105cc90039adc76cd200d350b69f3ca97ff91613cdcf46e3f8a9157052d9f3161ba85a662b3c6c29a8b79d4b8aa2b9e6 EBUILD portage-2.2.8-r1.ebuild 19344 SHA256 35ab2aa38ca4dd77373cebdfe04a47291601790dbef63be5bb2ec74866bf5f1e SHA512 4e6133e4792423bd426fba0fb951d08ba56866ac0942aa572892bbb6654853ab6ba10c22c209ebc4126af99aaf253aab7647342e984ac5cd41ed5e179e129add WHIRLPOOL 10cf3d7c4c5b4c3e19a0ab459d260779e7f82ce9fe81932b65da0f855450dbe83f0a9d87eb4bb1d735aab4d78a50d3df0c4e911bd19e054f5728cd2f2cc067a2 EBUILD portage-9999.ebuild 13392 SHA256 86723f61fa51872305c9cc987a16a93148111e1dcf39d234d1c8f15b040a91de SHA512 0f91bc77efdf59e9e0d906024c5ea6d49c4a62e167b37b0d674efdda06594218ffebcb5f7a5263e1c6ece4e6fba7bdc13c01b56289e47bd43ca69cd6109538af WHIRLPOOL d26ed25b8002b764e4ca66d9dc674322500015a6a930da8a9137732f713fb481b280471a87179645c89e6635a7c6d9c7cb2999725f2407dc82ce0e6c54bc4a9e -MISC ChangeLog 57775 SHA256 dce9cf1bf7422823a8119f2843e1692a68067194078b540afebe7e1dc020865b SHA512 f24f142f6b789fd2ee9ede4e6a23eaf7e0fd67cf062a139f65fc7ab4ea62b1a524d5a4ab8fc5115b7ebce4715036105543d6fb187a4e2225e53c77ca46b7fb64 WHIRLPOOL 48999eaf1efcbb9d1ae69e9bf5ba37f7d6ba69602b8f9a11d3f8a13ddaea9186acadf353265e5aec2a0ce5404661b654755e64c0726bbd3cb5de988a42a583e0 +MISC ChangeLog 57993 SHA256 e8ed8c2521e4bae90e933f191521f4936f65e7056341c002f471fb3896fc1f56 SHA512 4a88b5b9c6497cbbcde1e5ddccecdb95f81c3dc165f580fc6ee19a909ad2cc4f2b4bd110cb96521987a6655ae8654291efe8a4b13453b4554a0c06125633e38a WHIRLPOOL 5d2d49279c0f36f576c44cea4860e4c1828264c05c3f3509d38596409edcc0efaff49d6cd49794a218e449bee460591e4d10f4a25ed7ba3dc0e0bb65f057d6ee MISC ChangeLog-2012 133873 SHA256 157a7eb13d4cf2e2c94bfcb7e91f218af1ea88f5ff20c24a50546950a9839c94 SHA512 1241f4ccd7b31bdd340649417257b0e95202992feb66e0cd4d41fc2d35bf0baeac19680f34a831d2fefce0c0fec03aa6e7a191f783e59cf9b93aaf266f010a3f WHIRLPOOL b027bdba0f5ccc1b3a2dc18df92d82b473af5e55536816b7177071c1ae1a89e4d50d42c2093fa1bbe28b92a42014fbefbfc9e7daa4e6426ebecbd5bffc3d479f MISC metadata.xml 1170 SHA256 15c6872c40d2c334c6c7bb2d020f5486296e1727c02254257ed5bba0c58af955 SHA512 ca57a95360f6becef6c622d8a5c384d864bd6118776b43d88b7deb1b058dc46b47019813d7e2606b6d4665bd1bed113eae5445ddb948f939954172b5fe859d74 WHIRLPOOL 77e420267361675e733e8364d1fde83d7b2833d6e28823599078f1d771aeb592d0e9146019a45268696b05709e56880e7707e0240f843015e17a82930bac5cf2 -----BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.22 (GNU/Linux) +Version: GnuPG v2.0 -iQF8BAEBCABmBQJT6nDDXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w -ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ4Njg4RkQxQ0M3MUMxQzA0RUFFQTQyMzcy -MjE0RDkwQTAxNEYxN0NCAAoJECIU2QoBTxfLeLcH/1ZBc4B+P6Mt7sbKVN6fXKY9 -bJOG6BOgPoMhCv6J2hY9XoESdOhxTm/v4N/ZQcx4BtqKw39Flshz3MNJvICFnjEm -ynlA3m9Pg59dI38qlMFaMSBDlpMrEpLr6nPq+QdpJgOqFvonVkgVYrAPMCuSCnIm -WZZ07RGPV+Lr72riY2N6HVWwulYKiXyDEKd2sPucHgtD9bNQ/w+E++9HyKauyTz+ -ohm4ljaw0YEi4UAiZnD5RwyQZhhAsBTrUvHtbkglPz1PImG3ogWr8OPuUXbFps2m -L2RscXoHLgMrD6CSilb1mTR0BFsmaM+HqkmEh1nY9cELr8LpnG1GxC07v1AfJfg= -=2DL5 +iQJ8BAEBCABmBQJUA5NiXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w +ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQzMDlCNDQ4NjEyNDI4NjA5REVEMDI3MzIy +MjBDRDFDNUJERUVEMDIwAAoJECIM0cW97tAgr4IP/1dFabZqxIIUYTYEy4T44ksN +xBDkia65hhYMZEN03uqaS0rL60jCtHSOWVZJTQETU5JjyZ1FDwFWPP34ecB1Ww2p +9DPToNbU2s3yh+hd97k2PNbr1dz1Y48z2t06I0ekjfkj4PyOS7nu8pjZQPU2R8zM +1G1hZQF/ulGF77gony5PiqmI++1Uz26iH9Adp3RpCOx6zLgNBCMqlipCIC+rsbuA +0FvHBqFp4FrqcsMg7LD6pbUpGxigxyINcKMLJzNXcOdg2TJFbynQlYs8nDDKDU5b +X+YcEWOGrsfnaxSS+KbRSmxin0CMALXfxdALlvXND91KTYeLakDIpaDVTlpjCMWQ +XW16qS0Gs5w7y/nazzeD6wl/rr8FXTPDD34EL940r8Aa8blMPX87GDj4zSgtu8pa +S6MJ7DHuD+FalNZVnK4DLwUVKZjaEK4mZMwTMTxpUfteGQf2eO5XV+H/XDU1FDgZ +YIC1+YsD3xTHtR4cFdJInOdAYzQXhcRHA5aFFLP9Ccao6/EhhR25UzaoQ0XpV9qY +Gyv8P0ZWTnxr0pK3oSlqExJsUwV7XoN9JlxeL9Rdo4c2RYr/4WvOX6jSa4F4k7wv +JBJAjxWtDFV72N2lMKeNw4LKjitnsEyikfa+DMvYkLM8a4FT2vl9hbHjdI4m7otz +Kf+eRFLfo8/oku4AifZZ +=fZNS -----END PGP SIGNATURE----- diff --git a/sys-apps/portage/portage-2.2.12-r1.ebuild b/sys-apps/portage/portage-2.2.12-r1.ebuild new file mode 100644 index 000000000000..537f290aef60 --- /dev/null +++ b/sys-apps/portage/portage-2.2.12-r1.ebuild @@ -0,0 +1,572 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.2.12-r1.ebuild,v 1.1 2014/08/31 21:27:58 hasufell Exp $ + +# Require EAPI 2 since we now require at least python-2.6 (for python 3 +# syntax support) which also requires EAPI 2. +EAPI=5 +PYTHON_COMPAT=( + pypy + python3_2 python3_3 python3_4 + python2_7 +) +inherit eutils multilib + +DESCRIPTION="Portage is the package management and distribution system for Gentoo" +HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml" +LICENSE="GPL-2" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" +SLOT="0" +IUSE="build doc epydoc +ipc linguas_ru pypy python2 python3 selinux xattr" + +for _pyimpl in ${PYTHON_COMPAT[@]} ; do + IUSE+=" python_targets_${_pyimpl}" +done +unset _pyimpl + +python_dep_ssl="python3? ( =dev-lang/python-3*[ssl] ) + !pypy? ( !python2? ( !python3? ( + >=dev-lang/python-2.7[ssl] + ) ) ) + pypy? ( !python2? ( !python3? ( virtual/pypy:0[bzip2] ) ) ) + python2? ( !python3? ( dev-lang/python:2.7[ssl] ) )" +python_dep="${python_dep_ssl//\[ssl\]}" +python_dep="${python_dep//,ssl}" +python_dep="${python_dep//ssl,}" + +python_dep="${python_dep} + python_targets_pypy? ( virtual/pypy:0 ) + python_targets_python2_7? ( dev-lang/python:2.7 ) + python_targets_python3_2? ( dev-lang/python:3.2 ) + python_targets_python3_3? ( dev-lang/python:3.3 ) + python_targets_python3_4? ( dev-lang/python:3.4 ) +" + +# The pysqlite blocker is for bug #282760. +# make-3.82 is for bug #455858 +DEPEND="${python_dep} + >=sys-devel/make-3.82 + >=sys-apps/sed-4.0.5 sys-devel/patch + doc? ( app-text/xmlto ~app-text/docbook-xml-dtd-4.4 ) + epydoc? ( >=dev-python/epydoc-2.0 !<=dev-python/pysqlite-2.4.1 )" +# Require sandbox-2.2 for bug #288863. +# For xattr, we can spawn getfattr and setfattr from sys-apps/attr, but that's +# quite slow, so it's not considered in the dependencies as an alternative to +# to python-3.3 / pyxattr. Also, xattr support is only tested with Linux, so +# for now, don't pull in xattr deps for other kernels. +# For whirlpool hash, require python[ssl] or python-mhash (bug #425046). +# For compgen, require bash[readline] (bug #445576). +RDEPEND="${python_dep} + !build? ( >=sys-apps/sed-4.0.5 + || ( >=app-shells/bash-4.2_p37[readline] ( <app-shells/bash-4.2_p37 >=app-shells/bash-3.2_p17 ) ) + >=app-admin/eselect-1.2 + || ( ${python_dep_ssl} dev-python/python-mhash ) + ) + elibc_FreeBSD? ( sys-freebsd/freebsd-bin ) + elibc_glibc? ( >=sys-apps/sandbox-2.2 ) + elibc_uclibc? ( >=sys-apps/sandbox-2.2 ) + >=app-misc/pax-utils-0.1.17 + selinux? ( >=sys-libs/libselinux-2.0.94[python] ) + xattr? ( kernel_linux? ( + >=sys-apps/install-xattr-0.3 + $(for python_impl in python{2_7,3_2} pypy; do + echo "python_targets_${python_impl}? ( dev-python/pyxattr[python_targets_${python_impl}] )" + done) ) ) + !<app-shells/bash-3.2_p17 + !<app-admin/logrotate-3.8.0" +PDEPEND=" + !build? ( + >=net-misc/rsync-2.6.4 + userland_GNU? ( >=sys-apps/coreutils-6.4 ) + )" +# coreutils-6.4 rdep is for date format in emerge-webrsync #164532 +# NOTE: FEATURES=installsources requires debugedit and rsync + +SRC_ARCHIVES="http://dev.gentoo.org/~dolsen/releases/portage" + +prefix_src_archives() { + local x y + for x in ${@}; do + for y in ${SRC_ARCHIVES}; do + echo ${y}/${x} + done + done +} + +PV_PL="2.1.2" +PATCHVER_PL="" +TARBALL_PV=${PV} +SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2 + $(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)" + +PATCHVER= +[[ $TARBALL_PV = $PV ]] || PATCHVER=$PV +if [ -n "${PATCHVER}" ]; then + SRC_URI="${SRC_URI} mirror://gentoo/${PN}-${PATCHVER}.patch.bz2 + $(prefix_src_archives ${PN}-${PATCHVER}.patch.bz2)" +fi + +S="${WORKDIR}"/${PN}-${TARBALL_PV} +S_PL="${WORKDIR}"/${PN}-${PV_PL} + +compatible_python_is_selected() { + [[ $("${EPREFIX}/usr/bin/python" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x2060000 and "good" or "bad")') = good ]] +} + +current_python_has_xattr() { + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' + local PYTHON=${EPREFIX}/usr/bin/${EPYTHON} + [[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \ + "${PYTHON}" -c 'import xattr' 2>/dev/null +} + +call_with_python_impl() { + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' + env EPYTHON=${EPYTHON} "$@" +} + +get_python_interpreter() { + [ $# -eq 1 ] || die "expected 1 argument, got $#: $*" + local impl=$1 python + case "${impl}" in + python*) + python=${impl/_/.} + ;; + pypy) + python=${impl} + ;; + *) + die "Unrecognized python target: ${impl}" + esac + echo ${python} +} + +get_python_sitedir() { + [ $# -eq 1 ] || die "expected 1 argument, got $#: $*" + local impl=$1 + local site_dir=usr/$(get_libdir)/${impl/_/.}/site-packages + [[ -d ${EROOT:-${ROOT}}${site_dir} ]] || \ + ewarn "site-packages dir missing for ${impl}: ${EROOT:-${ROOT}}${site_dir}" + echo "/${site_dir}" +} + +python_compileall() { + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' + local d=${EPREFIX}$1 PYTHON=${EPREFIX}/usr/bin/${EPYTHON} + local d_image=${D}${d#/} + [[ -d ${d_image} ]] || die "directory does not exist: ${d_image}" + case "${EPYTHON}" in + python*) + "${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die + # Note: Using -OO breaks emaint, since it requires __doc__, + # and __doc__ is None when -OO is used. + "${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die + ;; + pypy) + "${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die + ;; + *) + die "Unrecognized EPYTHON value: ${EPYTHON}" + esac +} + +pkg_setup() { + if use python2 && use python3 ; then + ewarn "Both python2 and python3 USE flags are enabled, but only one" + ewarn "can be in the shebangs. Using python3." + fi + if use pypy && use python3 ; then + ewarn "Both pypy and python3 USE flags are enabled, but only one" + ewarn "can be in the shebangs. Using python3." + fi + if use pypy && use python2 ; then + ewarn "Both pypy and python2 USE flags are enabled, but only one" + ewarn "can be in the shebangs. Using python2" + fi + if ! use pypy && ! use python2 && ! use python3 && \ + ! compatible_python_is_selected ; then + ewarn "Attempting to select a compatible default python interpreter" + local x success=0 + for x in "${EPREFIX}"/usr/bin/python2.* ; do + x=${x#${EPREFIX}/usr/bin/python2.} + if [[ $x -ge 6 ]] 2>/dev/null ; then + eselect python set python2.$x + if compatible_python_is_selected ; then + elog "Default python interpreter is now set to python-2.$x" + success=1 + break + fi + fi + done + if [ $success != 1 ] ; then + eerror "Unable to select a compatible default python interpreter!" + die "This version of portage requires at least python-2.6 to be selected as the default python interpreter (see \`eselect python --help\`)." + fi + fi + + # We use EPYTHON to designate the active python interpreter, + # but we only export when needed, via call_with_python_impl. + EPYTHON=python + export -n EPYTHON + if use python3; then + EPYTHON=python3 + elif use python2; then + EPYTHON=python2 + elif use pypy; then + EPYTHON=pypy + fi +} + +src_prepare() { + if [ -n "${PATCHVER}" ] ; then + if [[ -L $S/bin/ebuild-helpers/portageq ]] ; then + rm "$S/bin/ebuild-helpers/portageq" \ + || die "failed to remove portageq helper symlink" + fi + epatch "${WORKDIR}/${PN}-${PATCHVER}.patch" + fi + einfo "Setting portage.VERSION to ${PVR} ..." + sed -e "s/^VERSION = .*/VERSION = \"${PVR}\"/" -i pym/portage/__init__.py || \ + die "Failed to patch portage.VERSION" + sed -e "1s/VERSION/${PVR}/" -i doc/fragment/version || \ + die "Failed to patch VERSION in doc/fragment/version" + sed -e "1s/VERSION/${PVR}/" -i $(find man -type f) || \ + die "Failed to patch VERSION in man page headers" + + if ! use ipc ; then + einfo "Disabling ipc..." + sed -e "s:_enable_ipc_daemon = True:_enable_ipc_daemon = False:" \ + -i pym/_emerge/AbstractEbuildProcess.py || \ + die "failed to patch AbstractEbuildProcess.py" + fi + + if use xattr && use kernel_linux ; then + einfo "Adding FEATURES=xattr to make.globals ..." + echo -e '\nFEATURES="${FEATURES} xattr"' >> cnf/make.globals \ + || die "failed to append to make.globals" + fi + + local set_shebang= + if use python3; then + set_shebang=python3 + elif use python2; then + set_shebang=python2 + elif use pypy; then + set_shebang=pypy + fi + if [[ -n ${set_shebang} ]] ; then + einfo "Converting shebangs for ${set_shebang}..." + while read -r -d $'\0' ; do + local shebang=$(head -n1 "$REPLY") + if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then + sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \ + die "sed failed" + fi + done < <(find . -type f -print0) + fi + + if [[ -n ${EPREFIX} ]] ; then + einfo "Setting portage.const.EPREFIX ..." + sed -e "s|^\(SANDBOX_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/sandbox\"\)|\\1${EPREFIX}\\2|" \ + -e "s|^\(FAKEROOT_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/bin/fakeroot\"\)|\\1${EPREFIX}\\2|" \ + -e "s|^\(BASH_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/bash\"\)|\\1${EPREFIX}\\2|" \ + -e "s|^\(MOVE_BINARY[[:space:]]*=[[:space:]]*\"\)\(/bin/mv\"\)|\\1${EPREFIX}\\2|" \ + -e "s|^\(PRELINK_BINARY[[:space:]]*=[[:space:]]*\"\)\(/usr/sbin/prelink\"\)|\\1${EPREFIX}\\2|" \ + -e "s|^\(EPREFIX[[:space:]]*=[[:space:]]*\"\).*|\\1${EPREFIX}\"|" \ + -i pym/portage/const.py || \ + die "Failed to patch portage.const.EPREFIX" + + einfo "Prefixing shebangs ..." + while read -r -d $'\0' ; do + local shebang=$(head -n1 "$REPLY") + if [[ ${shebang} == "#!"* && ! ${shebang} == "#!${EPREFIX}/"* ]] ; then + sed -i -e "1s:.*:#!${EPREFIX}${shebang:2}:" "$REPLY" || \ + die "sed failed" + fi + done < <(find . -type f -print0) + + einfo "Adjusting make.globals ..." + sed -e "s|\(/usr/portage\)|${EPREFIX}\\1|" \ + -e "s|^\(PORTAGE_TMPDIR=\"\)\(/var/tmp\"\)|\\1${EPREFIX}\\2|" \ + -i cnf/make.globals || die "sed failed" + + einfo "Adjusting repos.conf ..." + sed -e "s|^\(main-repo = \).*|\\1gentoo_prefix|" \ + -e "s|^\\[gentoo\\]|[gentoo_prefix]|" \ + -e "s|^\(location = \)\(/usr/portage\)|\\1${EPREFIX}\\2|" \ + -e "s|^\(sync-uri = \).*|\\1rsync://prefix.gentooexperimental.org/gentoo-portage-prefix|" \ + -i cnf/repos.conf || die "sed failed" + + einfo "Adding FEATURES=force-prefix to make.globals ..." + echo -e '\nFEATURES="${FEATURES} force-prefix"' >> cnf/make.globals \ + || die "failed to append to make.globals" + fi + + cd "${S}/cnf" || die + if [ -f "make.conf.example.${ARCH}".diff ]; then + patch make.conf.example "make.conf.example.${ARCH}".diff || \ + die "Failed to patch make.conf.example" + else + eerror "" + eerror "Portage does not have an arch-specific configuration for this arch." + eerror "Please notify the arch maintainer about this issue. Using generic." + eerror "" + fi +} + +src_compile() { + if use doc; then + call_with_python_impl \ + emake docbook || die + fi + + if use epydoc; then + einfo "Generating api docs" + call_with_python_impl \ + emake epydoc || die + fi +} + +src_test() { + # make files executable, in case they were created by patch + find bin -type f | xargs chmod +x + call_with_python_impl \ + emake test || die +} + +src_install() { + call_with_python_impl \ + emake DESTDIR="${D}" \ + sysconfdir="${EPREFIX}/etc" \ + prefix="${EPREFIX}/usr" \ + install || die + + # Use dodoc for compression, since the Makefile doesn't do that. + dodoc "${S}"/{ChangeLog,NEWS,RELEASE-NOTES} || die + + # Allow external portage API consumers to import portage python modules + # (this used to be done with PYTHONPATH setting in /etc/env.d). + # For each of PYTHON_TARGETS, install a tree of *.py symlinks in + # site-packages, and compile with the corresponding interpreter. + local impl files mod_dir dest_mod_dir python relative_path x + for impl in "${PYTHON_COMPAT[@]}" ; do + use "python_targets_${impl}" || continue + if use build && [[ ${ROOT} == / && + ! -x ${EPREFIX}/usr/bin/$(get_python_interpreter ${impl}) ]] ; then + # Tolerate --nodeps at beginning of stage1 for catalyst + ewarn "skipping python_targets_${impl}, interpreter not found" + continue + fi + while read -r mod_dir ; do + cd "${ED:-${D}}usr/lib/portage/pym/${mod_dir}" || die + files=$(echo *.py) + if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then + # __pycache__ directories contain no py files + continue + fi + dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir} + dodir "${dest_mod_dir}" || die + relative_path=../../../lib/portage/pym/${mod_dir} + x=/${mod_dir} + while [ -n "${x}" ] ; do + relative_path=../${relative_path} + x=${x%/*} + done + for x in ${files} ; do + dosym "${relative_path}/${x}" \ + "${dest_mod_dir}/${x}" || die + done + done < <(cd "${ED:-${D}}"usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*") + cd "${S}" || die + EPYTHON=$(get_python_interpreter ${impl}) \ + python_compileall "$(get_python_sitedir ${impl})" + done + + # Compile /usr/lib/portage/pym with the active interpreter, since portage + # internal commands force this directory to the beginning of sys.path. + python_compileall /usr/lib/portage/pym +} + +pkg_preinst() { + if [[ $ROOT == / ]] ; then + # Run some minimal tests as a sanity check. + local test_runner=$(find "${ED:-${D}}" -name runTests) + if [[ -n $test_runner && -x $test_runner ]] ; then + einfo "Running preinst sanity tests..." + "$test_runner" || die "preinst sanity tests failed" + fi + fi + + if use xattr && ! current_python_has_xattr ; then + ewarn "For optimal performance in xattr handling, install" + ewarn "dev-python/pyxattr, or install >=dev-lang/python-3.3 and" + ewarn "enable USE=python3 for $CATEGORY/$PN." + fi + + # elog dir must exist to avoid logrotate error for bug #415911. + # This code runs in preinst in order to bypass the mapping of + # portage:portage to root:root which happens after src_install. + keepdir /var/log/portage/elog + # This is allowed to fail if the user/group are invalid for prefix users. + if chown portage:portage "${ED:-${D}}"var/log/portage{,/elog} 2>/dev/null ; then + chmod g+s,ug+rwx "${ED:-${D}}"var/log/portage{,/elog} + fi + + # If portage-2.1.6 is installed and the preserved_libs_registry exists, + # assume that the NEEDED.ELF.2 files have already been generated. + has_version "<=${CATEGORY}/${PN}-2.2_pre7" && \ + ! { [ -e "${EROOT:-${ROOT}}"var/lib/portage/preserved_libs_registry ] && \ + has_version ">=${CATEGORY}/${PN}-2.1.6_rc" ; } \ + && NEEDED_REBUILD_UPGRADE=true || NEEDED_REBUILD_UPGRADE=false + + if has_version "<${CATEGORY}/${PN}-2.1.13" || \ + { + has_version ">=${CATEGORY}/${PN}-2.2_rc0" && \ + has_version "<${CATEGORY}/${PN}-2.2.0_alpha189" + } ; then + USERPRIV_UPGRADE=true + USERSYNC_UPGRADE=true + REPOS_CONF_UPGRADE=true + REPOS_CONF_SYNC= + type -P portageq >/dev/null 2>&1 && \ + REPOS_CONF_SYNC=$("$(type -P portageq)" envvar SYNC) + else + USERPRIV_UPGRADE=false + USERSYNC_UPGRADE=false + REPOS_CONF_UPGRADE=false + fi +} + +get_ownership() { + case ${USERLAND} in + BSD) + stat -f '%Su:%Sg' "${1}" + ;; + *) + stat -c '%U:%G' "${1}" + ;; + esac +} + +new_config_protect() { + # Generate a ._cfg file even if the target file + # does not exist, ensuring that the user will + # notice the config change. + local basename=${1##*/} + local dirname=${1%/*} + local i=0 + while true ; do + local filename=$( + echo -n "${dirname}/._cfg" + printf "%04d" ${i} + echo -n "_${basename}" + ) + [[ -e ${filename} ]] || break + (( i++ )) + done + echo "${filename}" +} + +pkg_postinst() { + + if ${REPOS_CONF_UPGRADE} ; then + einfo "Generating repos.conf" + local repo_name= + [[ -f ${PORTDIR}/profiles/repo_name ]] && \ + repo_name=$(< "${PORTDIR}/profiles/repo_name") + if [[ -z ${REPOS_CONF_SYNC} ]] ; then + REPOS_CONF_SYNC=$(grep "^sync-uri =" "${EROOT:-${ROOT}}usr/share/portage/config/repos.conf") + REPOS_CONF_SYNC=${REPOS_CONF_SYNC##* } + fi + local sync_type= + [[ ${REPOS_CONF_SYNC} == git://* ]] && sync_type=git + + if [[ ${REPOS_CONF_SYNC} == cvs://* ]]; then + sync_type=cvs + REPOS_CONF_SYNC=${REPOS_CONF_SYNC#cvs://} + fi + + cat <<-EOF > "${T}/repos.conf" + [DEFAULT] + main-repo = ${repo_name:-gentoo} + + [${repo_name:-gentoo}] + location = ${PORTDIR:-${EPREFIX}/usr/portage} + sync-type = ${sync_type:-rsync} + sync-uri = ${REPOS_CONF_SYNC} + EOF + + [[ ${sync_type} == cvs ]] && echo "sync-cvs-repo = $(<"${PORTDIR}/CVS/Repository")" >> "${T}/repos.conf" + + local dest=${EROOT:-${ROOT}}etc/portage/repos.conf + if [[ ! -f ${dest} ]] && mkdir -p "${dest}" 2>/dev/null ; then + dest=${EROOT:-${ROOT}}etc/portage/repos.conf/${repo_name:-gentoo}.conf + fi + # Don't install the config update if the desired repos.conf directory + # and config file exist, since users may accept it blindly and break + # their config (bug #478726). + [[ -e ${EROOT:-${ROOT}}etc/portage/repos.conf/${repo_name:-gentoo}.conf ]] || \ + mv "${T}/repos.conf" "$(new_config_protect "${dest}")" + + if [[ ${PORTDIR} == ${EPREFIX}/usr/portage ]] ; then + einfo "Generating make.conf PORTDIR setting for backward compatibility" + for dest in "${EROOT:-${ROOT}}etc/make.conf" "${EROOT:-${ROOT}}etc/portage/make.conf" ; do + [[ -e ${dest} ]] && break + done + [[ -d ${dest} ]] && dest=${dest}/portdir.conf + rm -rf "${T}/make.conf" + [[ -f ${dest} ]] && cat "${dest}" > "${T}/make.conf" + cat <<-EOF >> "${T}/make.conf" + + # Set PORTDIR for backward compatibility with various tools: + # gentoo-bashcomp - bug #478444 + # euse - bug #474574 + # euses and ufed - bug #478318 + PORTDIR="${EPREFIX}/usr/portage" + EOF + mkdir -p "${dest%/*}" + mv "${T}/make.conf" "$(new_config_protect "${dest}")" + fi + fi + + if ${NEEDED_REBUILD_UPGRADE} ; then + einfo "rebuilding NEEDED.ELF.2 files" + local cpv filename line newline + for cpv in "${EROOT:-${ROOT}}var/db/pkg"/*/*; do + [[ -f "${cpv}/NEEDED" && ! -f "${cpv}/NEEDED.ELF.2" ]] || continue + while read -r line; do + filename=${line% *} + newline=$(scanelf -BF "%a;%F;%S;%r;%n" "${ROOT%/}${filename}") + newline=${newline// - } + [[ ${#ROOT} -gt 1 ]] && newline=${newline/${ROOT%/}} + echo "${newline:3}" >> "${cpv}/NEEDED.ELF.2" + done < "${cpv}/NEEDED" + done + fi + + local distdir=${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}} + + if ${USERSYNC_UPGRADE} && \ + [[ -d ${PORTDIR} && -w ${PORTDIR} ]] ; then + local ownership=$(get_ownership "${PORTDIR}") + if [[ -n ${ownership} ]] ; then + einfo "Adjusting PORTDIR permissions for usersync" + find "${PORTDIR}" -path "${distdir%/}" -prune -o \ + ! \( -user "${ownership%:*}" -a -group "${ownership#*:}" \) \ + -exec chown "${ownership}" {} + + fi + fi + + # Do this last, since it could take a long time if there + # are lots of live sources, and the user may be tempted + # to kill emerge while it is running. + if ${USERPRIV_UPGRADE} && \ + [[ -d ${distdir} && -w ${distdir} ]] ; then + local ownership=$(get_ownership "${distdir}") + if [[ ${ownership#*:} == portage ]] ; then + einfo "Adjusting DISTDIR permissions for userpriv" + find "${distdir}" -mindepth 1 -maxdepth 1 -type d -uid 0 \ + -exec chown -R portage:portage {} + + fi + fi +} |