From: Fabian Groffen Date: Sun, 15 Aug 2010 09:43:15 +0000 (+0200) Subject: Merge remote branch 'overlays-gentoo-org/master' into prefix X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=f17de73d0cbedad35501669d12bd6cf50bcc9d06;p=portage.git Merge remote branch 'overlays-gentoo-org/master' into prefix Conflicts: bin/ebuild-helpers/die bin/ebuild-helpers/dobin bin/ebuild-helpers/dodir bin/ebuild-helpers/dodoc bin/ebuild-helpers/dohtml bin/ebuild-helpers/doinfo bin/ebuild-helpers/dosbin bin/ebuild-helpers/dosym bin/ebuild-helpers/ecompressdir bin/ebuild-helpers/emake bin/ebuild-helpers/fowners bin/ebuild-helpers/fperms bin/ebuild-helpers/portageq bin/ebuild.sh bin/misc-functions.sh bin/repoman pym/_emerge/Package.py pym/_emerge/depgraph.py pym/portage/_deprecated.py pym/portage/dbapi/bintree.py pym/portage/package/ebuild/config.py --- f17de73d0cbedad35501669d12bd6cf50bcc9d06 diff --cc bin/binhost-snapshot index 825a11672,825a11672..64e33a14e --- a/bin/binhost-snapshot +++ b/bin/binhost-snapshot @@@ -1,4 -1,4 +1,4 @@@ --#!/usr/bin/python ++#!@PORTAGE_PYTHON@ # Copyright 2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 diff --cc bin/ebuild-helpers/4/dodoc index 0639b3989,c9068a8b5..48dc4d6e0 --- a/bin/ebuild-helpers/4/dodoc +++ b/bin/ebuild-helpers/4/dodoc @@@ -2,10 -2,10 +2,10 @@@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [ $# -lt 1 ] ; then - vecho "${0##*/}: at least one argument needed" 1>&2 + die "${0##*/}: at least one argument needed" exit 1 fi diff --cc bin/ebuild-helpers/die index da703a066,9869141dd..a27ebd4f8 --- a/bin/ebuild-helpers/die +++ b/bin/ebuild-helpers/die @@@ -1,11 -1,7 +1,7 @@@ -#!/bin/bash +#!@PORTAGE_BASH@ - # Copyright 2009 Gentoo Foundation + # Copyright 2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # TODO: Eliminate race condition in signal delivery by using pipe or socket - # IPC to guarantee that the ebuild process and all of its children (including - # this helper) are killed immediately, ensuring that "false success" is - # impossible. -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh die "$@" exit 1 diff --cc bin/ebuild-helpers/dobin index 1bae1b5cb,fc0b0359f..0b25b25a3 --- a/bin/ebuild-helpers/dobin +++ b/bin/ebuild-helpers/dobin @@@ -2,15 -2,15 +2,15 @@@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then - vecho "$0: at least one argument needed" 1>&2 + helpers_die "$0: at least one argument needed" exit 1 fi -if [[ ! -d ${D}${DESTTREE}/bin ]] ; then - install -d "${D}${DESTTREE}/bin" || { helpers_die "$0: failed to install ${D}${DESTTREE}/bin"; exit 2; } +if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then - install -d "${ED}${DESTTREE}/bin" || exit 2 ++ install -d "${ED}${DESTTREE}/bin" || { helpers_die "$0: failed to install ${ED}${DESTTREE}/bin"; exit 2; } fi ret=0 diff --cc bin/ebuild-helpers/dodir index d2747be52,58303b2fc..0327813b9 --- a/bin/ebuild-helpers/dodir +++ b/bin/ebuild-helpers/dodir @@@ -2,4 -2,9 +2,9 @@@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - exec install -d ${DIROPTIONS} "${@/#/${ED}/}" -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh ++source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + -install -d ${DIROPTIONS} "${@/#/${D}/}" ++install -d ${DIROPTIONS} "${@/#/${ED}/}" + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $ret diff --cc bin/ebuild-helpers/dodoc index 6536fd405,6d750c939..f67d283c1 --- a/bin/ebuild-helpers/dodoc +++ b/bin/ebuild-helpers/dodoc @@@ -2,9 -2,10 +2,10 @@@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh ++source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + if [ $# -lt 1 ] ; then - source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh - vecho "${0##*/}: at least one argument needed" 1>&2 + helpers_die "${0##*/}: at least one argument needed" exit 1 fi diff --cc bin/ebuild-helpers/doexe index 8917fc4a3,191e7f918..c293784ef --- a/bin/ebuild-helpers/doexe +++ b/bin/ebuild-helpers/doexe @@@ -2,10 -2,10 +2,10 @@@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 + helpers_die "$0: at least one argument needed" exit 1 fi diff --cc bin/ebuild-helpers/dohtml index 21535cefb,cb29dc3f3..743ce6f0a --- a/bin/ebuild-helpers/dohtml +++ b/bin/ebuild-helpers/dohtml @@@ -1,10 -1,14 +1,14 @@@ -#!/bin/bash +#!@PORTAGE_BASH@ - # Copyright 2009 Gentoo Foundation + # Copyright 2009-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh ++source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + -PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} -PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} +PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin} +PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-@PORTAGE_BASE@/pym} - # Set EPYTHON variable as empty so that dohtml doesn't try - # to use potentially unsupported version of Python. - EPYTHON= PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \ - exec "$PORTAGE_BIN_PATH/dohtml.py" "$@" + PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/dohtml.py" "$@" ++ "${PORTAGE_PYTHON:-@PORTAGE_PYTHON@}" "$PORTAGE_BIN_PATH/dohtml.py" "$@" + + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $ret diff --cc bin/ebuild-helpers/doinfo index 51f8a1d1d,2c3d1e071..1cf738d88 --- a/bin/ebuild-helpers/doinfo +++ b/bin/ebuild-helpers/doinfo @@@ -9,11 -9,11 +9,11 @@@ if [[ -z $1 ]] ; the exit 1 fi -if [[ ! -d ${D}usr/share/info ]] ; then - install -d "${D}usr/share/info" || { helpers_die "$0: failed to install ${D}usr/share/info"; exit 1; } +if [[ ! -d ${ED}usr/share/info ]] ; then - install -d "${ED}usr/share/info" || exit 1 ++ install -d "${ED}usr/share/info" || { helpers_die "$0: failed to install ${ED}usr/share/info"; exit 1; } fi -install -m0644 "$@" "${D}usr/share/info" +install -m0644 "$@" "${ED}usr/share/info" rval=$? if [ $rval -ne 0 ] ; then for x in "$@" ; do diff --cc bin/ebuild-helpers/doins index 6030eb4c9,c59b9bcfd..f18e7ebf2 --- a/bin/ebuild-helpers/doins +++ b/bin/ebuild-helpers/doins @@@ -2,10 -2,10 +2,10 @@@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [ $# -lt 1 ] ; then - echo "${0##*/}: at least one argument needed" 1>&2 + helpers_die "${0##*/}: at least one argument needed" exit 1 fi @@@ -18,9 -18,10 +18,10 @@@ f if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then vecho "-------------------------------------------------------" 1>&2 - vecho "You should not use \${D} with helpers." 1>&2 + vecho "You should not use \${D} or \${ED} with helpers." 1>&2 vecho " --> ${INSDESTTREE}" 1>&2 vecho "-------------------------------------------------------" 1>&2 + helpers_die "$0 used with \${D}" exit 1 fi diff --cc bin/ebuild-helpers/doman index 42d0abc81,0d95c18ba..90fce11ef --- a/bin/ebuild-helpers/doman +++ b/bin/ebuild-helpers/doman @@@ -2,10 -2,10 +2,10 @@@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 + helpers_die "$0: at least one argument needed" exit 1 fi diff --cc bin/ebuild-helpers/domo index 37cf1401b,43f78d010..a88b8d79d --- a/bin/ebuild-helpers/domo +++ b/bin/ebuild-helpers/domo @@@ -2,13 -2,15 +2,15 @@@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 + source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh + mynum=${#} if [ ${mynum} -lt 1 ] ; then - echo "${0}: at least one argument needed" + helpers_die "${0}: at least one argument needed" exit 1 fi -if [ ! -d "${D}${DESTTREE}/share/locale" ] ; then - install -d "${D}${DESTTREE}/share/locale/" +if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then + install -d "${ED}${DESTTREE}/share/locale/" fi ret=0 diff --cc bin/ebuild-helpers/dosbin index 6f40fa406,a16015ed6..a9a0401fd --- a/bin/ebuild-helpers/dosbin +++ b/bin/ebuild-helpers/dosbin @@@ -2,13 -2,15 +2,15 @@@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh ++source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + if [[ $# -lt 1 ]] ; then - echo "$0: at least one argument needed" 1>&2 + helpers_die "$0: at least one argument needed" exit 1 fi -if [[ ! -d ${D}${DESTTREE}/sbin ]] ; then - install -d "${D}${DESTTREE}/sbin" || { helpers_die "$0: failed to install ${D}${DESTTREE}/sbin"; exit 2; } +if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then - install -d "${ED}${DESTTREE}/sbin" || exit 2 ++ install -d "${ED}${DESTTREE}/sbin" || { helpers_die "$0: failed to install ${ED}${DESTTREE}/sbin"; exit 2; } fi ret=0 diff --cc bin/ebuild-helpers/dosym index 0a138a490,1015a28e5..ce4b84c57 --- a/bin/ebuild-helpers/dosym +++ b/bin/ebuild-helpers/dosym @@@ -2,16 -2,17 +2,20 @@@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh ++source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + if [[ $# -ne 2 ]] ; then - echo "$0: two arguments needed" 1>&2 + helpers_die "$0: two arguments needed" exit 1 fi -destdir=${2%/*} -[[ ! -d ${D}${destdir} ]] && dodir "${destdir}" +target="${1}" +linkname="${2}" +[[ ${target:0:1} == "/" ]] && target="${EPREFIX}${target}" +destdir=${linkname%/*} +[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}" - exec ln -snf "${target}" "${ED}/${linkname}" - -ln -snf "$1" "${D}$2" ++ln -snf "${target}" "${ED}/${linkname}" + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $ret diff --cc bin/ebuild-helpers/ecompress index 87999c3c2,8e6fc9c8d..ab952c16d --- a/bin/ebuild-helpers/ecompress +++ b/bin/ebuild-helpers/ecompress @@@ -2,10 -2,10 +2,10 @@@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [[ -z $1 ]] ; then - vecho "${0##*/}: at least one argument needed" 1>&2 + helpers_die "${0##*/}: at least one argument needed" exit 1 fi diff --cc bin/ebuild-helpers/ecompressdir index ffb60281b,fdecaf0a2..7608202f3 --- a/bin/ebuild-helpers/ecompressdir +++ b/bin/ebuild-helpers/ecompressdir @@@ -2,10 -2,10 +2,10 @@@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh if [[ -z $1 ]] ; then - vecho "${0##*/}: at least one argument needed" 1>&2 + helpers_die "${0##*/}: at least one argument needed" exit 1 fi @@@ -20,8 -20,11 +20,11 @@@ case $1 i --queue) shift set -- "${@/%/.ecompress.dir}" - set -- "${@/#/${D}}" + set -- "${@/#/${ED}}" - exec touch "$@" + touch "$@" + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $? ;; --dequeue) [[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2 diff --cc bin/ebuild-helpers/emake index d302091c1,7103585ce..78582da9d --- a/bin/ebuild-helpers/emake +++ b/bin/ebuild-helpers/emake @@@ -21,4 -21,7 +21,7 @@@ if [[ $PORTAGE_QUIET != 1 ]] ; the ) >&2 fi - exec ${MAKE:-make} SHELL="${BASH:-/bin/bash}" ${MAKEOPTS} ${EXTRA_EMAKE} "$@" -${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE} "$@" ++${MAKE:-make} SHELL="${BASH:-/bin/bash}" ${MAKEOPTS} ${EXTRA_EMAKE} "$@" + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $ret diff --cc bin/ebuild-helpers/fowners index 99be171a1,95a49fdad..962f66c80 --- a/bin/ebuild-helpers/fowners +++ b/bin/ebuild-helpers/fowners @@@ -2,7 -2,12 +2,12 @@@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh ++source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + # we can't prefix all arguments because # chown takes random options slash="/" - exec chown "${@/#${slash}/${ED}${slash}}" -chown "${@/#${slash}/${D}${slash}}" ++chown "${@/#${slash}/${ED}${slash}}" + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $ret diff --cc bin/ebuild-helpers/fperms index 0450af128,cdd409a05..322809038 --- a/bin/ebuild-helpers/fperms +++ b/bin/ebuild-helpers/fperms @@@ -2,7 -2,12 +2,12 @@@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh ++source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + # we can't prefix all arguments because # chmod takes random options slash="/" - exec chmod "${@/#${slash}/${ED}${slash}}" -chmod "${@/#${slash}/${D}${slash}}" ++chmod "${@/#${slash}/${ED}${slash}}" + ret=$? + [[ $ret -ne 0 ]] && helpers_die "$0 failed" + exit $ret diff --cc bin/ebuild-helpers/portageq index 575390091,ec30b66cb..39ccb09dd --- a/bin/ebuild-helpers/portageq +++ b/bin/ebuild-helpers/portageq @@@ -1,10 -1,8 +1,8 @@@ -#!/bin/bash +#!@PORTAGE_BASH@ - # Copyright 2009 Gentoo Foundation + # Copyright 2009-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} -PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} +PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin} +PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-@PORTAGE_BASE@/pym} - # Set EPYTHON variable as empty so that dohtml doesn't try - # to use potentially unsupported version of Python. - EPYTHON= PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \ - exec "$PORTAGE_BIN_PATH/portageq" "$@" + PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \ - exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/portageq" "$@" ++ exec "${PORTAGE_PYTHON:-@PORTAGE_PYTHON@}" "$PORTAGE_BIN_PATH/portageq" "$@" diff --cc bin/ebuild-ipc index 000000000,43e4a02ae..5bd7da1e2 mode 000000,100755..100755 --- a/bin/ebuild-ipc +++ b/bin/ebuild-ipc @@@ -1,0 -1,8 +1,8 @@@ -#!/bin/bash ++#!@PORTAGE_BASH@ + # Copyright 2010 Gentoo Foundation + # Distributed under the terms of the GNU General Public License v2 + + PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin} + PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym} + PYTHONPATH=$PORTAGE_PYM_PATH${PYTHONPATH:+:}$PYTHONPATH \ - exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/ebuild-ipc.py" "$@" ++ exec "${PORTAGE_PYTHON:-@PORTAGE_PYTHON@}" "$PORTAGE_BIN_PATH/ebuild-ipc.py" "$@" diff --cc bin/ebuild-ipc.py index 000000000,d0c17d037..ccbb23a30 mode 000000,100755..100755 --- a/bin/ebuild-ipc.py +++ b/bin/ebuild-ipc.py @@@ -1,0 -1,76 +1,76 @@@ -#!/usr/bin/python ++#!@PORTAGE_PYTHON@ + # Copyright 2010 Gentoo Foundation + # Distributed under the terms of the GNU General Public License v2 + # + # This is a helper which which ebuild processes can use + # to communicate with portage's main python process. + + import os + import pickle + import select + import signal + import sys + + def debug_signal(signum, frame): + import pdb + pdb.set_trace() + signal.signal(signal.SIGUSR1, debug_signal) + + # Avoid sandbox violations after python upgrade. + pym_path = os.path.join(os.path.dirname( + os.path.dirname(os.path.realpath(__file__))), "pym") + if os.environ.get("SANDBOX_ON") == "1": + sandbox_write = os.environ.get("SANDBOX_WRITE", "").split(":") + if pym_path not in sandbox_write: + sandbox_write.append(pym_path) + os.environ["SANDBOX_WRITE"] = \ + ":".join(filter(None, sandbox_write)) + + import portage + + class EbuildIpc(object): + + def __init__(self): + self.fifo_dir = os.environ['PORTAGE_BUILDDIR'] + self.ipc_in_fifo = os.path.join(self.fifo_dir, '.ipc_in') + self.ipc_out_fifo = os.path.join(self.fifo_dir, '.ipc_out') + self.ipc_lock_file = os.path.join(self.fifo_dir, '.ipc_lock') + + def communicate(self, args): + # Make locks quiet since unintended locking messages displayed on + # stdout could corrupt the intended output of this program. + portage.locks._quiet = True + lock_obj = portage.locks.lockfile(self.ipc_lock_file, unlinkfile=True) + try: + return self._communicate(args) + finally: + portage.locks.unlockfile(lock_obj) + + def _communicate(self, args): + input_fd = os.open(self.ipc_out_fifo, os.O_RDONLY|os.O_NONBLOCK) + input_file = os.fdopen(input_fd, 'rb') + output_file = open(self.ipc_in_fifo, 'wb') + pickle.dump(args, output_file) + output_file.flush() + + events = select.select([input_file], [], []) + reply = pickle.load(input_file) + output_file.close() + input_file.close() + + (out, err, rval) = reply + + if out: + portage.util.writemsg_stdout(out, noiselevel=-1) + + if err: + portage.util.writemsg(err, noiselevel=-1) + + return rval + + def ebuild_ipc_main(args): + ebuild_ipc = EbuildIpc() + return ebuild_ipc.communicate(args) + + if __name__ == '__main__': + sys.exit(ebuild_ipc_main(sys.argv[1:])) diff --cc bin/ebuild.sh index b6599341d,8813bd6d0..3e9b76730 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@@ -1,9 -1,9 +1,9 @@@ -#!/bin/bash +#!@PORTAGE_BASH@ - # Copyright 1999-2009 Gentoo Foundation + # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}" -PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}" +PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}" +PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-@PORTAGE_BASE@/pym}" # Don't use sandbox's BASH_ENV for new shells because it does # 'source /etc/profile' which can interfere with the build @@@ -169,10 -159,13 +165,13 @@@ has_version() die "portageq calls (has_version calls portageq) are not allowed in the global scope" fi - # Set EPYTHON variable as empty so that portageq doesn't try - # to use potentially unsupported version of Python. - EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_BIN_PATH}"/portageq has_version "${ROOT}" "$1" + if [[ -n $PORTAGE_IPC_DAEMON ]] ; then + "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1" "$USE" + return $? + fi + + PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" has_version "${ROOT}" "$1" ++ "${PORTAGE_PYTHON:-@PORTAGE_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" has_version "${ROOT}" "$1" local retval=$? case "${retval}" in 0) @@@ -192,10 -185,8 +191,8 @@@ portageq() die "portageq calls are not allowed in the global scope" fi - # Set EPYTHON variable as empty so that portageq doesn't try - # to use potentially unsupported version of Python. - EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_BIN_PATH}/portageq" "$@" + PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" "$@" ++ "${PORTAGE_PYTHON:-@PORTAGE_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" "$@" } @@@ -211,10 -202,13 +208,13 @@@ best_version() die "portageq calls (best_version calls portageq) are not allowed in the global scope" fi - # Set EPYTHON variable as empty so that portageq doesn't try - # to use potentially unsupported version of Python. - EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1" + if [[ -n $PORTAGE_IPC_DAEMON ]] ; then + "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1" "$USE" + return $? + fi + + PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1" ++ "${PORTAGE_PYTHON:-@PORTAGE_PYTHON@}" "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1" local retval=$? case "${retval}" in 0) @@@ -784,8 -776,13 +782,18 @@@ into() export DESTTREE="" else export DESTTREE=$1 ++<<<<<<< HEAD + if [ ! -d "${ED}${DESTTREE}" ]; then + install -d "${ED}${DESTTREE}" ++======= + if [ ! -d "${D}${DESTTREE}" ]; then + install -d "${D}${DESTTREE}" + local ret=$? + if [[ $ret -ne 0 ]] ; then + helpers_die "$0 failed" + return $ret + fi ++>>>>>>> overlays-gentoo-org/master fi fi } @@@ -795,8 -792,13 +803,13 @@@ insinto() export INSDESTTREE="" else export INSDESTTREE=$1 - if [ ! -d "${D}${INSDESTTREE}" ]; then - install -d "${D}${INSDESTTREE}" + if [ ! -d "${ED}${INSDESTTREE}" ]; then + install -d "${ED}${INSDESTTREE}" + local ret=$? + if [[ $ret -ne 0 ]] ; then + helpers_die "$0 failed" + return $ret + fi fi fi } @@@ -806,8 -808,13 +819,13 @@@ exeinto() export _E_EXEDESTTREE_="" else export _E_EXEDESTTREE_="$1" - if [ ! -d "${D}${_E_EXEDESTTREE_}" ]; then - install -d "${D}${_E_EXEDESTTREE_}" + if [ ! -d "${ED}${_E_EXEDESTTREE_}" ]; then + install -d "${ED}${_E_EXEDESTTREE_}" + local ret=$? + if [[ $ret -ne 0 ]] ; then + helpers_die "$0 failed" + return $ret + fi fi fi } @@@ -817,8 -824,13 +835,13 @@@ docinto() export _E_DOCDESTTREE_="" else export _E_DOCDESTTREE_="$1" - if [ ! -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then - install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" + if [ ! -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then + install -d "${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" + local ret=$? + if [[ $ret -ne 0 ]] ; then + helpers_die "$0 failed" + return $ret + fi fi fi } @@@ -1703,7 -1729,7 +1732,7 @@@ filter_readonly_variables() " fi - EPYTHON= "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed" - "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed" ++ "${PORTAGE_PYTHON:-@PORTAGE_PYTHON@}" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed" } # @FUNCTION: preprocess_ebuild_env @@@ -2194,9 -2227,11 +2225,11 @@@ elif [[ -n $EBUILD_SH_ARGS ]] ; the umask 002 save_ebuild_env | filter_readonly_variables > "$T/environment" assert "save_ebuild_env failed" - chown portage:portage "$T/environment" &>/dev/null + chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "$T/environment" &>/dev/null chmod g+w "$T/environment" &>/dev/null fi + [[ -n $PORTAGE_EBUILD_EXIT_FILE ]] && > "$PORTAGE_EBUILD_EXIT_FILE" + [[ -n $PORTAGE_IPC_DAEMON ]] && "$PORTAGE_BIN_PATH"/ebuild-ipc exit 0 exit 0 ) exit $? diff --cc bin/misc-functions.sh index 3c2277d61,3a199bdf7..922098fee mode 100644,100755..100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@@ -1,5 -1,5 +1,5 @@@ -#!/bin/bash +#!@PORTAGE_BASH@ - # Copyright 1999-2009 Gentoo Foundation + # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # # Miscellaneous shell functions that make use of the ebuild env but don't need @@@ -444,11 -404,7 +444,11 @@@ install_qa_check_misc() [[ ${abort} == "yes" ]] && die "add those ldscripts" # Make sure people don't store libtool files or static libs in /lib - # on AIX, "dynamic libs" have extention .a, so don't get false - f=$(ls "${D}"lib*/*.{a,la} 2>/dev/null) ++ # on AIX, "dynamic libs" have extension .a, so don't get false + # positives + [[ ${CHOST} == *-aix* ]] \ + && f=$(ls "${ED}"lib*/*.la 2>/dev/null || true) \ + || f=$(ls "${ED}"lib*/*.{a,la} 2>/dev/null) if [[ -n ${f} ]] ; then vecho -ne '\a\n' eqawarn "QA Notice: Excessive files found in the / partition" @@@ -533,7 -489,7 +533,7 @@@ done [[ $reset_debug = 1 ]] && set -x f=$(cat "${PORTAGE_LOG_FILE}" | \ - EPYTHON= "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed") - "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed") ++ "${PORTAGE_PYTHON:-@PORTAGE_PYTHON@}" "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed") if [[ -n ${f} ]] ; then # In the future this will be a forced "die". In preparation, @@@ -1469,8 -778,8 +1488,8 @@@ dyn_package() tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \ bzip2 -cf > "$PORTAGE_BINPKG_TMPFILE" assert "failed to pack binary package: '$PORTAGE_BINPKG_TMPFILE'" - EPYTHON= PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "$PORTAGE_BIN_PATH"/xpak-helper.py recompose \ + PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH"/xpak-helper.py recompose \ ++ "${PORTAGE_PYTHON:-@PORTAGE_PYTHON@}" "$PORTAGE_BIN_PATH"/xpak-helper.py recompose \ "$PORTAGE_BINPKG_TMPFILE" "$PORTAGE_BUILDDIR/build-info" if [ $? -ne 0 ]; then rm -f "${PORTAGE_BINPKG_TMPFILE}" diff --cc bin/repoman index 30880466e,740b92e78..8abb768cd --- a/bin/repoman +++ b/bin/repoman @@@ -1,5 -1,5 +1,5 @@@ -#!/usr/bin/python -O +#!@PORTAGE_PYTHON@ -O - # Copyright 1999-2006 Gentoo Foundation + # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Next to do: dep syntax checking in mask files @@@ -32,20 -30,25 +30,27 @@@ except ImportError from itertools import chain from stat import S_ISDIR - if not hasattr(__builtins__, "set"): - from sets import Set as set - - -try: - import portage -except ImportError: - from os import path as osp - sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) - import portage +# for an explanation on this logic, see pym/_emerge/__init__.py +import os +import sys +if os.environ.__contains__("PORTAGE_PYTHONPATH"): + sys.path.insert(0, os.environ["PORTAGE_PYTHONPATH"]) +else: + sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "pym")) +import portage - portage._disable_legacy_globals() + + try: + import xml.etree.ElementTree + from xml.parsers.expat import ExpatError + except ImportError: + msg = ["Please enable python's \"xml\" USE flag in order to use repoman."] + from portage.output import EOutput + out = EOutput() + for line in msg: + out.eerror(line) + sys.exit(1) + from portage import os from portage import subprocess_getstatusoutput from portage import _encodings diff --cc pym/_emerge/Package.py index 0721e4f64,1671c4ef7..f8781c786 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@@ -6,9 -6,9 +6,10 @@@ import sy from itertools import chain import portage from portage.cache.mappings import slot_dict_class - from portage.dep import isvalidatom, paren_reduce, use_reduce, \ - paren_normalize, paren_enclose, _slot_re + from portage.dep import isvalidatom, use_reduce, \ + paren_enclose, _slot_re + from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use +from portage.const import EPREFIX from _emerge.Task import Task if sys.hexversion >= 0x3000000: @@@ -31,7 -31,7 +32,7 @@@ class Package(Task) "INHERITED", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROVIDE", "RDEPEND", "repository", "PROPERTIES", "RESTRICT", "SLOT", "USE", - "_mtime_", "DEFINED_PHASES", "EPREFIX"] - "_mtime_", "DEFINED_PHASES", "REQUIRED_USE"] ++ "_mtime_", "DEFINED_PHASES", "REQUIRED_USE", "EPREFIX"] def __init__(self, **kwargs): Task.__init__(self, **kwargs) diff --cc pym/_emerge/depgraph.py index 8ff628292,643cc3edf..caa707464 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@@ -6171,12 -6054,22 +6054,28 @@@ def _get_masking_status(pkg, pkgsetting mreasons.append( _MaskReason("invalid", "invalid: %s" % (msg,))) + if pkg.metadata["REQUIRED_USE"] and \ + eapi_has_required_use(pkg.metadata["EAPI"]): + required_use = pkg.metadata["REQUIRED_USE"] + use = pkg.use.enabled + iuse = pkgsettings._get_implicit_iuse() + iuse.update(pkg.iuse.all) + try: + required_use_is_sat = portage.dep.check_required_use( + required_use, use, iuse) + except portage.exception.InvalidDependString: + mreasons.append("invalid: REQUIRED_USE") + else: + if not required_use_is_sat: + msg = "violated use flag constraints: '%s'" % required_use + mreasons.append(msg) + + if pkg.built and not pkg.installed: + if not "EPREFIX" in pkg.metadata or not pkg.metadata["EPREFIX"]: + mreasons.append("missing EPREFIX") + elif len(pkg.metadata["EPREFIX"].strip()) < len(pkgsettings["EPREFIX"]): + mreasons.append("EPREFIX: '%s' too small" % pkg.metadata["EPREFIX"]) + if not pkg.metadata["SLOT"]: mreasons.append( _MaskReason("invalid", "SLOT: undefined")) diff --cc pym/portage/dbapi/bintree.py index 7fe1539d0,d84031681..ba18080e5 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@@ -18,9 -18,9 +18,10 @@@ portage.proxy.lazyimport.lazyimport(glo from portage.cache.mappings import slot_dict_class from portage.dbapi.virtual import fakedbapi + from portage.dep import use_reduce, paren_enclose from portage.exception import InvalidPackageName, \ PermissionDenied, PortageException +from portage.const import EAPI from portage.localization import _ from portage import _movefile @@@ -56,7 -55,7 +56,7 @@@ class bindbapi(fakedbapi) ["BUILD_TIME", "CHOST", "DEPEND", "EAPI", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository", "RESTRICT", "SLOT", "USE", "DEFINED_PHASES", - "EPREFIX"]) - "REQUIRED_USE"]) ++ "REQUIRED_USE", "EPREFIX"]) self._aux_cache_slot_dict = slot_dict_class(self._aux_cache_keys) self._aux_cache = {} @@@ -227,7 -226,7 +227,7 @@@ class binarytree(object) ["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI", "IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "DEFINED_PHASES", - "EPREFIX"] - "REQUIRED_USE"] ++ "REQUIRED_USE", "EPREFIX"] self._pkgindex_aux_keys = list(self._pkgindex_aux_keys) self._pkgindex_use_evaluated_keys = \ ("LICENSE", "RDEPEND", "DEPEND", @@@ -252,9 -251,10 +252,10 @@@ "RESTRICT": "", "SLOT" : "0", "USE" : "", - "DEFINED_PHASES" : "" + "DEFINED_PHASES" : "", + "REQUIRED_USE" : "" } - self._pkgindex_inherited_keys = ["CHOST", "repository"] + self._pkgindex_inherited_keys = ["CHOST", "repository", "EPREFIX"] self._pkgindex_default_header_data = { "repository":"" } diff --cc pym/portage/package/ebuild/config.py index 9927c9744,9089ffb45..ed4dbe4e0 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@@ -2659,11 -2654,10 +2660,11 @@@ class config(object) mydict.pop("AA", None) # Prefix variables are supported starting with EAPI 3. - if phase == 'depend' or eapi is None or not eapi_supports_prefix(eapi): - mydict.pop("ED", None) - mydict.pop("EPREFIX", None) - mydict.pop("EROOT", None) + # but during transition, we just support them anywhere - #if phase == 'depend' or eapi in (None, "0", "1", "2"): - # mydict.pop("ED", None) - # mydict.pop("EPREFIX", None) - # mydict.pop("EROOT", None) ++# if phase == 'depend' or eapi is None or not eapi_supports_prefix(eapi): ++# mydict.pop("ED", None) ++# mydict.pop("EPREFIX", None) ++# mydict.pop("EROOT", None) if phase == 'depend': mydict.pop('FILESDIR', None) diff --cc runtests.sh index 000000000,2ba05e3e2..b6d437564 mode 000000,100755..100755 --- a/runtests.sh +++ b/runtests.sh @@@ -1,0 -1,30 +1,30 @@@ -#!/bin/bash ++#!@PORTAGE_BASH@ + + PYTHON_VERSIONS="2.6 2.7 3.1 3.2" + + case "${NOCOLOR:-false}" in + yes|true) + GOOD= + BAD= + NORMAL= + ;; + no|false) + GOOD=$'\e[1;32m' + BAD=$'\e[1;31m' + NORMAL=$'\e[0m' + ;; + esac + + exit_status="0" + for version in ${PYTHON_VERSIONS}; do - if [[ -x /usr/bin/python${version} ]]; then ++ if [[ -x @PORTAGE_PYTHON@${version} ]]; then + echo -e "${GOOD}Testing with Python ${version}...${NORMAL}" - if ! PYTHONPATH="pym${PYTHONPATH:+:}${PYTHONPATH}" /usr/bin/python${version} pym/portage/tests/runTests; then ++ if ! PYTHONPATH="pym${PYTHONPATH:+:}${PYTHONPATH}" @PORTAGE_PYTHON@${version} pym/portage/tests/runTests; then + echo -e "${BAD}Testing with Python ${version} failed${NORMAL}" + exit_status="1" + fi + echo + fi + done + + exit ${exit_status}